From d0a3e3f7f1a652fddb1a00287379163dbde864f4 Mon Sep 17 00:00:00 2001 From: Alexander Ioffe Date: Fri, 2 Feb 2024 10:08:58 -0500 Subject: [PATCH] Comment and continue --- build.gradle.kts | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index fe3b3a4..46f4e65 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -93,8 +93,12 @@ subprojects { signing { val signingKeyRaw = System.getenv("NEW_SIGNING_KEY_ID_BASE64") if (signingKeyRaw == null) error("ERROR: No Signing Key Found") - // Seems like the right way was to have newlines after all but not the - // BEGIN PGP PRIVATE KEY BLOCK as part of the key. + // Seems like the right way was to have newlines after all the exported (ascii armored) lines + // and you can put them into the github-var with newlines but if you + // include the "-----BEGIN PGP PRIVATE KEY BLOCK-----" and "-----END PGP PRIVATE KEY BLOCK-----" + // parts with that then errors happen. Have a look at https://github.com/gradle/gradle/issues/15718 for more detail + // Ultimately however `iurysza` is only partially correct and they key-itself does not need to be escaped + // and can be put into a github-var with newlines. val signingKey = "-----BEGIN PGP PRIVATE KEY BLOCK-----\n\n${signingKeyRaw}\n-----END PGP PRIVATE KEY BLOCK-----" useInMemoryPgpKeys( System.getenv("NEW_SIGNING_KEY_ID_BASE64_ID"), @@ -107,4 +111,20 @@ subprojects { tasks.withType { onlyIf { !project.hasProperty("nosign") } } + + // Fix for Kotlin issue: https://youtrack.jetbrains.com/issue/KT-61313 + tasks.withType().configureEach { + val pubName = name.removePrefix("sign").removeSuffix("Publication") + + // These tasks only exist for native targets, hence findByName() to avoid trying to find them for other targets + + // Task ':linkDebugTest' uses this output of task ':signPublication' without declaring an explicit or implicit dependency + tasks.findByName("linkDebugTest$pubName")?.let { + mustRunAfter(it) + } + // Task ':compileTestKotlin' uses this output of task ':signPublication' without declaring an explicit or implicit dependency + tasks.findByName("compileTestKotlin$pubName")?.let { + mustRunAfter(it) + } + } } \ No newline at end of file