File tree Expand file tree Collapse file tree
build-logic/convention/src/main/kotlin/com/autonomousapps/convention
testkit/gradle-testkit-plugin Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -70,11 +70,11 @@ public abstract class DagpExtension(
7070 }
7171
7272 project.tasks.named(" publishToMavenCentral" ) { t ->
73- t.notCompatibleWithConfigurationCache( " Cannot serialize object of type DefaultProject " )
74- t.inputs.property(" is-snapshot " , isSnapshot)
73+ val key = " is-snapshot "
74+ t.inputs.property(key , isSnapshot)
7575
7676 t.doLast {
77- if (isSnapshot.get( )) {
77+ if ((t.inputs.properties[key] as Boolean )) {
7878 t.logger.quiet(" Browse files at https://central.sonatype.com/service/rest/repository/browse/maven-snapshots/com/autonomousapps/" )
7979 } else {
8080 t.logger.quiet(
Original file line number Diff line number Diff line change 33package com.autonomousapps.convention
44
55import com.autonomousapps.convention.internal.kotlin.KotlinConfigurer
6+ import com.gradle.publish.PublishTask
67import com.vanniktech.maven.publish.GradlePublishPlugin
78import com.vanniktech.maven.publish.MavenPublishBaseExtension
89import org.gradle.api.Plugin
@@ -28,6 +29,9 @@ public abstract class PluginConventionPlugin : Plugin<Project> {
2829 configureKotlin()
2930 configurePlugins()
3031 configurePublishing()
32+
33+ // TODO(tsr): figure out this CC issue.
34+ // disableConfigurationCache()
3135 }
3236
3337 private fun Project.configureGroovy (versionCatalog : VersionCatalog ) {
@@ -58,4 +62,13 @@ public abstract class PluginConventionPlugin : Plugin<Project> {
5862 configure(GradlePublishPlugin ())
5963 }
6064 }
65+
66+ private fun Project.disableConfigurationCache () {
67+ tasks.withType(PublishTask ::class .java).configureEach { t ->
68+ t.notCompatibleWithConfigurationCache(" cannot serialize Gradle script object references as these are not supported with the configuration cache." )
69+ }
70+ // tasks.withType(org.gradle.api.publish.maven.tasks.AbstractPublishToMaven::class.java) { t ->
71+ // t.notCompatibleWithConfigurationCache("Various problems")
72+ // }
73+ }
6174}
Original file line number Diff line number Diff line change 1- import org.gradle.plugin.compatibility.compatibility
2-
31// Copyright (c) 2026. Tony Robalik.
42// SPDX-License-Identifier: Apache-2.0
3+ import org.gradle.plugin.compatibility.compatibility
4+
55plugins {
66 id(" build-logic.plugin" )
77 id(" groovy" )
@@ -15,7 +15,7 @@ plugins {
1515val VERSION : String by project
1616version = VERSION
1717
18- val isSnapshot: Boolean = project. version.toString().endsWith(" SNAPSHOT" )
18+ val isSnapshot: Boolean = version.toString().endsWith(" SNAPSHOT" )
1919val isRelease: Boolean = ! isSnapshot
2020
2121dagp {
@@ -319,10 +319,14 @@ val publishToMavenCentral = tasks.named("publishToMavenCentral") {
319319}
320320
321321val publishToPluginPortal = tasks.named(" publishPlugins" ) {
322+ val key = " is-release"
323+ inputs.property(key, isRelease)
322324 // Can't publish snapshots to the portal
323- onlyIf(" only publish releases to the plugin portal" ) { isRelease }
324- shouldRunAfter(publishToMavenCentral)
325+ onlyIf(" only publish releases to the plugin portal" ) {
326+ inputs.properties[key] as Boolean
327+ }
325328
329+ shouldRunAfter(publishToMavenCentral)
326330 configureForRelease()
327331}
328332
Original file line number Diff line number Diff line change 1- import org.gradle.kotlin.dsl.assign
2- import org.gradle.plugin.compatibility.compatibility
3-
41// Copyright (c) 2026. Tony Robalik.
52// SPDX-License-Identifier: Apache-2.0
3+ import org.gradle.plugin.compatibility.compatibility
4+
65plugins {
76 id(" build-logic.plugin" )
87 id(" com.github.gmazzo.buildconfig" )
@@ -80,8 +79,13 @@ val publishToMavenCentral = tasks.named("publishToMavenCentral") {
8079}
8180
8281val publishToPluginPortal = tasks.named(" publishPlugins" ) {
82+ val key = " is-release"
83+ inputs.property(key, isRelease)
8384 // Can't publish snapshots to the portal
84- onlyIf { isRelease }
85+ onlyIf(" only publish releases to the plugin portal" ) {
86+ inputs.properties[key] as Boolean
87+ }
88+
8589 shouldRunAfter(publishToMavenCentral)
8690
8791 // Note that publishing a release requires a successful smokeTest
You can’t perform that action at this time.
0 commit comments