Skip to content

Commit

Permalink
Add configureSignAndPublishDependencies to make sign tasks work wit…
Browse files Browse the repository at this point in the history
…h gradle 8.1.1 (#736)
  • Loading branch information
eymar authored Jun 29, 2023
1 parent 5e5ea52 commit da45eaa
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions skiko/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -1303,6 +1303,53 @@ if (skiko.isCIBuild || mavenCentral.signArtifacts) {
sign(publishing.publications)
useInMemoryPgpKeys(mavenCentral.signArtifactsKey.get(), mavenCentral.signArtifactsPassword.get())
}
configureSignAndPublishDependencies()
}


fun configureSignAndPublishDependencies() {
if (supportWasm) {
tasks.forEach { task ->
val name = task.name
val publishJs = "publishJsPublicationTo"
val publishWasm = "publishSkikoWasmRuntimePublicationTo"
val signWasm = "signSkikoWasmRuntimePublication"
val signJs = "signJsPublication"

when {
name.startsWith(publishJs) -> task.dependsOn(signWasm)
name.startsWith(publishWasm) -> task.dependsOn(signJs)
}
}
}
if (supportAndroid) {
tasks.forEach { task ->
val name = task.name
val signAndroid = "signAndroidPublication"
val generateMetadata = "generateMetadataFileForAndroidPublication"
val publishAndroid = "publishAndroidPublicationTo"
val publishX64 = "publishSkikoJvmRuntimeAndroidX64PublicationTo"
val publishArm64 = "publishSkikoJvmRuntimeAndroidArm64PublicationTo"
val signX64 = "signSkikoJvmRuntimeAndroidX64Publication"
val signArm64 = "signSkikoJvmRuntimeAndroidArm64Publication"
val skikoAndroidJar = "skikoAndroidJar"

when {
name.startsWith(signAndroid) || name.startsWith(generateMetadata) -> {
task.dependsOn(skikoAndroidJar)
}
name.startsWith(publishAndroid) -> {
task.dependsOn(signX64, signArm64)
}
name.startsWith(publishX64) -> {
task.dependsOn(signAndroid, signArm64)
}
name.startsWith(publishArm64) -> {
task.dependsOn(signX64, signAndroid)
}
}
}
}
}

/**
Expand Down Expand Up @@ -1357,3 +1404,4 @@ rootProject.plugins.withType<org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJ
nodeExtension.download = false
}
}

0 comments on commit da45eaa

Please sign in to comment.