Skip to content

Commit 451f9df

Browse files
authored
Make the project multi-modules (#725)
Instead of using a root project, using https://github.com/Kotlin/kotlinx-io project as reference. Using modules allows a finer control of classes visibility and will be especially useful for a future `db` module containing a default sqldelight implementation (see sqldelight/sqldelight#1333 (comment)).
1 parent 0537e61 commit 451f9df

364 files changed

Lines changed: 34 additions & 36 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎gradle.properties‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
group=fr.acinq.lightning
2+
version=1.8.5-SNAPSHOT
13
# gradle
24
org.gradle.jvmargs=-Xmx1536m
35
org.gradle.parallel=true
Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import org.jetbrains.kotlin.gradle.plugin.mpp.DefaultCInteropSettings
12
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
23
import org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeSimulatorTest
34
import org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeTest
@@ -9,20 +10,6 @@ plugins {
910
`maven-publish`
1011
}
1112

12-
allprojects {
13-
group = "fr.acinq.lightning"
14-
version = "1.8.5-SNAPSHOT"
15-
16-
repositories {
17-
// using the local maven repository with Kotlin Multi Platform can lead to build errors that are hard to diagnose.
18-
// uncomment this only if you need to experiment with snapshot dependencies that have not yet be published.
19-
// mavenLocal()
20-
maven("https://oss.sonatype.org/content/repositories/snapshots")
21-
mavenCentral()
22-
google()
23-
}
24-
}
25-
2613
val currentOs = org.gradle.internal.os.OperatingSystem.current()
2714

2815
kotlin {
@@ -50,30 +37,29 @@ kotlin {
5037

5138
macosArm64()
5239

40+
fun DefaultCInteropSettings.configureFor(platform: String) {
41+
val interopTask = tasks[interopProcessingTaskName]
42+
interopTask.dependsOn(":lightning-kmp-ios-crypto:buildCrypto$platform")
43+
val libPath = "$rootDir/modules/ios-crypto/build/Release-${platform.lowercase()}"
44+
extraOpts("-libraryPath", libPath)
45+
includeDirs.headerFilterOnly("$libPath/include")
46+
}
47+
5348
iosX64 { // ios simulator on intel devices
5449
compilations["main"].cinterops.create("PhoenixCrypto") {
55-
val platform = "Iphonesimulator"
56-
val interopTask = tasks[interopProcessingTaskName]
57-
interopTask.dependsOn(":PhoenixCrypto:buildCrypto$platform")
58-
includeDirs.headerFilterOnly("$rootDir/PhoenixCrypto/build/Release-${platform.lowercase()}/include")
50+
configureFor("Iphonesimulator")
5951
}
6052
}
6153

6254
iosArm64 { // actual ios devices
6355
compilations["main"].cinterops.create("PhoenixCrypto") {
64-
val platform = "Iphoneos"
65-
val interopTask = tasks[interopProcessingTaskName]
66-
interopTask.dependsOn(":PhoenixCrypto:buildCrypto$platform")
67-
includeDirs.headerFilterOnly("$rootDir/PhoenixCrypto/build/Release-${platform.lowercase()}/include")
56+
configureFor("Iphoneos")
6857
}
6958
}
7059

7160
iosSimulatorArm64 { // actual ios devices
7261
compilations["main"].cinterops.create("PhoenixCrypto") {
73-
val platform = "Iphonesimulator"
74-
val interopTask = tasks[interopProcessingTaskName]
75-
interopTask.dependsOn(":PhoenixCrypto:buildCrypto$platform")
76-
includeDirs.headerFilterOnly("$rootDir/PhoenixCrypto/build/Release-${platform.lowercase()}/include")
62+
configureFor("Iphonesimulator")
7763
}
7864
}
7965
}
@@ -281,12 +267,12 @@ afterEvaluate {
281267

282268
/** Electrum integration test environment + tasks configuration */
283269
val dockerTestEnv by tasks.creating(Exec::class) {
284-
workingDir = projectDir.resolve("docker-local-test")
270+
workingDir = rootDir.resolve("testing")
285271
commandLine("bash", "env.sh", "remove", "net-create", "btc-create", "elx-create", "btc-start", "elx-start")
286272
}
287273

288274
val dockerCleanup by tasks.creating(Exec::class) {
289-
workingDir = projectDir.resolve("docker-local-test")
275+
workingDir = rootDir.resolve("testing")
290276
commandLine("bash", "env.sh", "elx-stop", "btc-stop", "remove")
291277
}
292278

src/commonMain/kotlin/fr/acinq/lightning/CltvExpiry.kt renamed to modules/core/src/commonMain/kotlin/fr/acinq/lightning/CltvExpiry.kt

File renamed without changes.

src/commonMain/kotlin/fr/acinq/lightning/EncodedNodeId.kt renamed to modules/core/src/commonMain/kotlin/fr/acinq/lightning/EncodedNodeId.kt

File renamed without changes.

src/commonMain/kotlin/fr/acinq/lightning/Features.kt renamed to modules/core/src/commonMain/kotlin/fr/acinq/lightning/Features.kt

File renamed without changes.

src/commonMain/kotlin/fr/acinq/lightning/MilliSatoshi.kt renamed to modules/core/src/commonMain/kotlin/fr/acinq/lightning/MilliSatoshi.kt

File renamed without changes.

src/commonMain/kotlin/fr/acinq/lightning/NodeEvents.kt renamed to modules/core/src/commonMain/kotlin/fr/acinq/lightning/NodeEvents.kt

File renamed without changes.

src/commonMain/kotlin/fr/acinq/lightning/NodeParams.kt renamed to modules/core/src/commonMain/kotlin/fr/acinq/lightning/NodeParams.kt

File renamed without changes.

src/commonMain/kotlin/fr/acinq/lightning/ShortChannelId.kt renamed to modules/core/src/commonMain/kotlin/fr/acinq/lightning/ShortChannelId.kt

File renamed without changes.

src/commonMain/kotlin/fr/acinq/lightning/blockchain/IClient.kt renamed to modules/core/src/commonMain/kotlin/fr/acinq/lightning/blockchain/IClient.kt

File renamed without changes.

0 commit comments

Comments
 (0)