From f861c3ce9a2cfd0108153b0ca0a7ad9572e4fa86 Mon Sep 17 00:00:00 2001 From: Pierre-Marie Padiou Date: Wed, 21 Feb 2024 18:16:31 +0100 Subject: [PATCH] Fix build warnings (#604) Follow up to #594 which introduced deprecation warnings. --------- Co-authored-by: Dominique Padiou <5765435+dpad85@users.noreply.github.com> --- PhoenixCrypto/build.gradle.kts | 8 +-- build.gradle.kts | 49 ++++++++----------- .../electrum/ElectrumMiniWalletTest.kt | 1 + 3 files changed, 25 insertions(+), 33 deletions(-) diff --git a/PhoenixCrypto/build.gradle.kts b/PhoenixCrypto/build.gradle.kts index 3bee93cda..1993287e3 100644 --- a/PhoenixCrypto/build.gradle.kts +++ b/PhoenixCrypto/build.gradle.kts @@ -1,5 +1,5 @@ -listOf("iphoneos", "iphonesimulator").forEach { sdk -> - tasks.create("buildCrypto${sdk.capitalize()}") { +listOf("Iphoneos", "Iphonesimulator").forEach { sdk -> + tasks.create("buildCrypto$sdk") { group = "build" commandLine( @@ -7,7 +7,7 @@ listOf("iphoneos", "iphonesimulator").forEach { sdk -> "-quiet", "-project", "PhoenixCrypto.xcodeproj", "-target", "PhoenixCrypto", - "-sdk", sdk + "-sdk", sdk.lowercase() ) workingDir(projectDir) @@ -16,7 +16,7 @@ listOf("iphoneos", "iphonesimulator").forEach { sdk -> fileTree("$projectDir/PhoenixCrypto") ) outputs.files( - fileTree("$projectDir/build/Release-${sdk}") + fileTree("$projectDir/build/Release-${sdk.lowercase()}") ) } } diff --git a/build.gradle.kts b/build.gradle.kts index c5a03cdef..eff548e74 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,3 @@ -import org.jetbrains.dokka.Platform import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget import org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeTest @@ -48,28 +47,28 @@ kotlin { if (currentOs.isMacOsX) { iosX64 { // ios simulator on intel devices compilations["main"].cinterops.create("PhoenixCrypto") { - val platform = "iphonesimulator" + val platform = "Iphonesimulator" val interopTask = tasks[interopProcessingTaskName] - interopTask.dependsOn(":PhoenixCrypto:buildCrypto${platform.capitalize()}") - includeDirs.headerFilterOnly("$rootDir/PhoenixCrypto/build/Release-$platform/include") + interopTask.dependsOn(":PhoenixCrypto:buildCrypto$platform") + includeDirs.headerFilterOnly("$rootDir/PhoenixCrypto/build/Release-${platform.lowercase()}/include") } } iosArm64 { // actual ios devices compilations["main"].cinterops.create("PhoenixCrypto") { - val platform = "iphoneos" + val platform = "Iphoneos" val interopTask = tasks[interopProcessingTaskName] - interopTask.dependsOn(":PhoenixCrypto:buildCrypto${platform.capitalize()}") - includeDirs.headerFilterOnly("$rootDir/PhoenixCrypto/build/Release-$platform/include") + interopTask.dependsOn(":PhoenixCrypto:buildCrypto$platform") + includeDirs.headerFilterOnly("$rootDir/PhoenixCrypto/build/Release-${platform.lowercase()}/include") } } iosSimulatorArm64 { // actual ios devices compilations["main"].cinterops.create("PhoenixCrypto") { - val platform = "iphonesimulator" + val platform = "Iphonesimulator" val interopTask = tasks[interopProcessingTaskName] - interopTask.dependsOn(":PhoenixCrypto:buildCrypto${platform.capitalize()}") - includeDirs.headerFilterOnly("$rootDir/PhoenixCrypto/build/Release-$platform/include") + interopTask.dependsOn(":PhoenixCrypto:buildCrypto$platform") + includeDirs.headerFilterOnly("$rootDir/PhoenixCrypto/build/Release-${platform.lowercase()}/include") } } } @@ -138,7 +137,7 @@ kotlin { languageSettings.optIn("kotlin.ExperimentalStdlibApi") } } - + configurations.all { // do not cache changing (i.e. SNAPSHOT) dependencies resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS) @@ -156,18 +155,12 @@ kotlin { } } -val dokkaOutputDir = buildDir.resolve("dokka") +val dokkaOutputDir = layout.buildDirectory.dir("dokka") tasks.dokkaHtml { outputDirectory.set(file(dokkaOutputDir)) dokkaSourceSets { configureEach { - val platformName = when (platform.get()) { - Platform.jvm -> "jvm" - Platform.js -> "js" - Platform.native -> "native" - Platform.common -> "common" - Platform.wasm -> "wasm" - } + val platformName = platform.get().name displayName.set(platformName) perPackageOption { @@ -231,7 +224,7 @@ afterEvaluate { configure(targets) { compilations.all { cinterops.all { tasks[interopProcessingTaskName].enabled = false } - compileKotlinTask.enabled = false + compileTaskProvider.get().enabled = false tasks[processResourcesTaskName].enabled = false } binaries.all { linkTask.enabled = false } @@ -280,21 +273,19 @@ afterEvaluate { val dockerTestEnv by tasks.creating(Exec::class) { workingDir = projectDir.resolve("docker-local-test") commandLine("bash", "env.sh", "remove", "net-create", "btc-create", "elx-create", "btc-start", "elx-start") - doLast { - gradle.buildFinished { - exec { - println("Cleaning up dockers...") - workingDir = projectDir.resolve("docker-local-test") - commandLine("bash", "env.sh", "elx-stop", "btc-stop", "remove") - } - } - } +} + +val dockerCleanup by tasks.creating(Exec::class) { + println("Cleaning up dockers...") + workingDir = projectDir.resolve("docker-local-test") + commandLine("bash", "env.sh", "elx-stop", "btc-stop", "remove") } val includeIntegrationTests = project.findProperty("integrationTests") == "include" tasks.withType { if (includeIntegrationTests) { dependsOn(dockerTestEnv) + finalizedBy(dockerCleanup) } else { filter.excludeTestsMatching("*IntegrationTest") } diff --git a/src/commonTest/kotlin/fr/acinq/lightning/blockchain/electrum/ElectrumMiniWalletTest.kt b/src/commonTest/kotlin/fr/acinq/lightning/blockchain/electrum/ElectrumMiniWalletTest.kt index 3273f5220..e7f7a0dff 100644 --- a/src/commonTest/kotlin/fr/acinq/lightning/blockchain/electrum/ElectrumMiniWalletTest.kt +++ b/src/commonTest/kotlin/fr/acinq/lightning/blockchain/electrum/ElectrumMiniWalletTest.kt @@ -249,6 +249,7 @@ class ElectrumMiniWalletTest : LightningTestSuite() { } @Ignore + @Test fun `perf test generator`() = runSuspendTest(timeout = 45.seconds) { val client = connectToMainnetServer() val wallet = ElectrumMiniWallet(Block.LivenetGenesisBlock.hash, client, this, logger)