Skip to content

Commit 4579acf

Browse files
chore: disable sign tasks when publishing snapshots.
Serializing Sign inputs during CC store is extremely slow. This will make certain flows much faster.
1 parent fd91434 commit 4579acf

2 files changed

Lines changed: 28 additions & 23 deletions

File tree

build-logic/convention/src/main/kotlin/com/autonomousapps/convention/BaseConventionPlugin.kt

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -79,36 +79,45 @@ internal class BaseConventionPlugin(private val project: Project) {
7979
.orElse("false")
8080
.map { it.toBoolean() }
8181

82-
val taskGraph = gradle.taskGraph
83-
val isFunctionalTest: Provider<Boolean> = providers.provider { taskGraph.hasTask(":functionalTest") }
82+
// Both these values are static and safe to get during configuration
83+
val shouldSign = !isCi.get() && !isSnapshot.get()
8484

8585
tasks.withType(Sign::class.java).configureEach { t ->
86+
// Disabling this task is better than configuring it with `onlyIf()`. The latter is evaluated at execution time,
87+
// so the task still has to get serialized during the CC store phase, which takes a very long time when Sign task
88+
// inputs must be serialized. Apparently the task is "some of the worst code in Gradle in terms of laziness"
89+
// (personal communication).
90+
t.enabled = shouldSign
91+
8692
with(t) {
8793
inputs.property("version", publishedVersion)
88-
inputs.property("is-snapshot", isSnapshot)
89-
inputs.property("is-ci", isCi)
90-
inputs.property("is-functional-test", isFunctionalTest)
91-
92-
// Don't sign snapshots
93-
onlyIf("Not a snapshot") {
94-
!(inputs.properties["is-snapshot"] as Boolean)
95-
}
96-
// We currently don't support publishing from CI
97-
onlyIf("release environment") {
98-
!(inputs.properties["is-ci"] as Boolean)
99-
}
100-
// Don't sign when running functional tests
101-
onlyIf("not running functional tests") {
102-
!(inputs.properties["is-functional-test"] as Boolean)
103-
}
104-
94+
// inputs.property("is-snapshot", isSnapshot)
95+
// inputs.property("is-ci", isCi)
96+
// inputs.property("is-functional-test", isFunctionalTest)
97+
//
98+
// // Don't sign snapshots
99+
// onlyIf("Not a snapshot") {
100+
// !(inputs.properties["is-snapshot"] as Boolean)
101+
// }
102+
// // We currently don't support publishing from CI
103+
// onlyIf("release environment") {
104+
// !(inputs.properties["is-ci"] as Boolean)
105+
// }
106+
// // Don't sign when running functional tests
107+
// onlyIf("not running functional tests") {
108+
// !(inputs.properties["is-functional-test"] as Boolean)
109+
// }
110+
//
105111
doFirst {
106112
val version = inputs.properties["version"] as String
107113
logger.quiet("Signing v$version")
108114
}
109115
}
110116
}
111117

118+
val taskGraph = gradle.taskGraph
119+
val isFunctionalTest: Provider<Boolean> = providers.provider { taskGraph.hasTask(":functionalTest") }
120+
112121
tasks.withType(DokkaGeneratePublicationTask::class.java).configureEach { t ->
113122
val key = "is-functional-test"
114123
t.inputs.property(key, isFunctionalTest)

build-logic/convention/src/main/kotlin/com/autonomousapps/convention/DagpExtension.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,6 @@ public abstract class DagpExtension(
8383
}
8484
}
8585
}
86-
87-
// TODO(tsr): update URL
88-
//val releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
89-
//val snapshotsRepoUrl = "https://central.sonatype.com/repository/maven-snapshots/"
9086
}
9187

9288
internal companion object {

0 commit comments

Comments
 (0)