Skip to content

Commit

Permalink
Make the project multi-modules (#725)
Browse files Browse the repository at this point in the history
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)).
  • Loading branch information
pm47 authored Nov 13, 2024
1 parent 0537e61 commit 451f9df
Show file tree
Hide file tree
Showing 364 changed files with 34 additions and 36 deletions.
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
group=fr.acinq.lightning
version=1.8.5-SNAPSHOT
# gradle
org.gradle.jvmargs=-Xmx1536m
org.gradle.parallel=true
Expand Down
42 changes: 14 additions & 28 deletions build.gradle.kts → modules/core/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import org.jetbrains.kotlin.gradle.plugin.mpp.DefaultCInteropSettings
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeSimulatorTest
import org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeTest
Expand All @@ -9,20 +10,6 @@ plugins {
`maven-publish`
}

allprojects {
group = "fr.acinq.lightning"
version = "1.8.5-SNAPSHOT"

repositories {
// using the local maven repository with Kotlin Multi Platform can lead to build errors that are hard to diagnose.
// uncomment this only if you need to experiment with snapshot dependencies that have not yet be published.
// mavenLocal()
maven("https://oss.sonatype.org/content/repositories/snapshots")
mavenCentral()
google()
}
}

val currentOs = org.gradle.internal.os.OperatingSystem.current()

kotlin {
Expand Down Expand Up @@ -50,30 +37,29 @@ kotlin {

macosArm64()

fun DefaultCInteropSettings.configureFor(platform: String) {
val interopTask = tasks[interopProcessingTaskName]
interopTask.dependsOn(":lightning-kmp-ios-crypto:buildCrypto$platform")
val libPath = "$rootDir/modules/ios-crypto/build/Release-${platform.lowercase()}"
extraOpts("-libraryPath", libPath)
includeDirs.headerFilterOnly("$libPath/include")
}

iosX64 { // ios simulator on intel devices
compilations["main"].cinterops.create("PhoenixCrypto") {
val platform = "Iphonesimulator"
val interopTask = tasks[interopProcessingTaskName]
interopTask.dependsOn(":PhoenixCrypto:buildCrypto$platform")
includeDirs.headerFilterOnly("$rootDir/PhoenixCrypto/build/Release-${platform.lowercase()}/include")
configureFor("Iphonesimulator")
}
}

iosArm64 { // actual ios devices
compilations["main"].cinterops.create("PhoenixCrypto") {
val platform = "Iphoneos"
val interopTask = tasks[interopProcessingTaskName]
interopTask.dependsOn(":PhoenixCrypto:buildCrypto$platform")
includeDirs.headerFilterOnly("$rootDir/PhoenixCrypto/build/Release-${platform.lowercase()}/include")
configureFor("Iphoneos")
}
}

iosSimulatorArm64 { // actual ios devices
compilations["main"].cinterops.create("PhoenixCrypto") {
val platform = "Iphonesimulator"
val interopTask = tasks[interopProcessingTaskName]
interopTask.dependsOn(":PhoenixCrypto:buildCrypto$platform")
includeDirs.headerFilterOnly("$rootDir/PhoenixCrypto/build/Release-${platform.lowercase()}/include")
configureFor("Iphonesimulator")
}
}
}
Expand Down Expand Up @@ -281,12 +267,12 @@ afterEvaluate {

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

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

Expand Down
Loading

0 comments on commit 451f9df

Please sign in to comment.