diff --git a/pom.xml b/pom.xml index 956ab2a..b0b1562 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ io.quarkus.develocity quarkus-project-develocity-extension jar - 1.0.9-SNAPSHOT + 1.1.0-SNAPSHOT Quarkus project's Develocity extension A Maven extension to configure the Develocity build cache for the Quarkus project https://github.com/quarkusio/quarkus-project-develocity-extension @@ -11,7 +11,7 @@ UTF-8 UTF-8 - 1.20.1 + 1.21 3.9.6 2.2.0 0.3.5 @@ -43,8 +43,8 @@ com.gradle - gradle-enterprise-maven-extension - ${gradle-enterprise-maven-extension.version} + develocity-maven-extension + ${develocity-maven-extension.version} provided diff --git a/src/main/java/io/quarkus/develocity/project/ConfiguredPlugin.java b/src/main/java/io/quarkus/develocity/project/ConfiguredPlugin.java index 7380f53..575270f 100644 --- a/src/main/java/io/quarkus/develocity/project/ConfiguredPlugin.java +++ b/src/main/java/io/quarkus/develocity/project/ConfiguredPlugin.java @@ -2,10 +2,10 @@ import org.apache.maven.execution.MavenSession; -import com.gradle.maven.extension.api.GradleEnterpriseApi; +import com.gradle.develocity.agent.maven.api.DevelocityApi; public interface ConfiguredPlugin { - void configureBuildCache(GradleEnterpriseApi gradleEnterpriseApi, MavenSession mavenSession); + void configureBuildCache(DevelocityApi develocityApi, MavenSession mavenSession); } diff --git a/src/main/java/io/quarkus/develocity/project/QuarkusProjectDevelocityConfigurationListener.java b/src/main/java/io/quarkus/develocity/project/QuarkusProjectDevelocityConfigurationListener.java index 620279b..340ee85 100644 --- a/src/main/java/io/quarkus/develocity/project/QuarkusProjectDevelocityConfigurationListener.java +++ b/src/main/java/io/quarkus/develocity/project/QuarkusProjectDevelocityConfigurationListener.java @@ -9,10 +9,10 @@ import org.apache.maven.execution.MavenSession; import org.codehaus.plexus.component.annotations.Component; -import com.gradle.maven.extension.api.GradleEnterpriseApi; -import com.gradle.maven.extension.api.GradleEnterpriseListener; -import com.gradle.maven.extension.api.cache.BuildCacheApi; -import com.gradle.maven.scan.extension.internal.api.BuildScanApiInternal; +import com.gradle.develocity.agent.maven.api.DevelocityApi; +import com.gradle.develocity.agent.maven.api.DevelocityListener; +import com.gradle.develocity.agent.maven.api.cache.BuildCacheApi; +import com.gradle.develocity.agent.maven.api.scan.BuildScanPublishing; import io.quarkus.develocity.project.normalization.Normalization; import io.quarkus.develocity.project.plugins.CompilerConfiguredPlugin; @@ -22,15 +22,14 @@ import io.quarkus.develocity.project.plugins.ImpsortConfiguredPlugin; import io.quarkus.develocity.project.plugins.KotlinConfiguredPlugin; import io.quarkus.develocity.project.plugins.QuarkusConfiguredPlugin; -import io.quarkus.develocity.project.plugins.SourceConfiguredPlugin; import io.quarkus.develocity.project.plugins.SpotlessConfiguredPlugin; import io.quarkus.develocity.project.plugins.SurefireConfiguredPlugin; import io.quarkus.develocity.project.scan.BuildScanMetadata; import io.quarkus.develocity.project.scan.MavenVersionChecker; @SuppressWarnings("deprecation") -@Component(role = GradleEnterpriseListener.class, hint = "quarkus-project-build-cache", description = "Configures Develocity for the Quarkus project") -public class QuarkusProjectDevelocityConfigurationListener implements GradleEnterpriseListener { +@Component(role = DevelocityListener.class, hint = "quarkus-project-build-cache", description = "Configures Develocity for the Quarkus project") +public class QuarkusProjectDevelocityConfigurationListener implements DevelocityListener { private static final String QUICKLY = "-Dquickly"; private static final String DASH = "-"; @@ -42,23 +41,22 @@ public class QuarkusProjectDevelocityConfigurationListener implements GradleEnte File.separator + "target" + File.separator + "test-project" + File.separator); @Override - public void configure(GradleEnterpriseApi gradleEnterpriseApi, MavenSession mavenSession) throws Exception { + public void configure(DevelocityApi develocityApi, MavenSession mavenSession) throws Exception { if (ignoreProject(mavenSession)) { // do not publish a build scan for test builds Log.debug("Disabling build scan publication and build cache for nested project: " + mavenSession.getRequest().getBaseDirectory()); - gradleEnterpriseApi.getBuildScan().publishAlwaysIf(false); - gradleEnterpriseApi.getBuildScan().publishOnFailureIf(false); - gradleEnterpriseApi.getBuildCache().getLocal().setEnabled(false); - gradleEnterpriseApi.getBuildCache().getRemote().setEnabled(false); + develocityApi.getBuildScan().getPublishing().onlyIf(context -> false); + develocityApi.getBuildCache().getLocal().setEnabled(false); + develocityApi.getBuildCache().getRemote().setEnabled(false); if (System.getenv("GITHUB_ACTIONS") != null) { try { Path storageLocationTmpDir = Files.createTempDirectory(Path.of(System.getenv("RUNNER_TEMP")), "buildScanTmp"); Log.debug("Update storage location to " + storageLocationTmpDir); - gradleEnterpriseApi.setStorageDirectory(storageLocationTmpDir); + develocityApi.setStorageDirectory(storageLocationTmpDir); } catch (IOException e) { Log.error("Temporary storage location directory cannot be created, the Build Scan will be published", e); } @@ -67,14 +65,13 @@ public void configure(GradleEnterpriseApi gradleEnterpriseApi, MavenSession mave return; } - gradleEnterpriseApi.getBuildScan().publishAlways(); - ((BuildScanApiInternal) gradleEnterpriseApi.getBuildScan()).publishIfAuthenticated(); - BuildScanMetadata.addMetadataToBuildScan(gradleEnterpriseApi.getBuildScan()); - MavenVersionChecker.checkRuntimeMavenVersion(gradleEnterpriseApi.getBuildScan(), mavenSession); + develocityApi.getBuildScan().publishing(p -> p.onlyIf(BuildScanPublishing.PublishingContext::isAuthenticated)); + BuildScanMetadata.addMetadataToBuildScan(develocityApi.getBuildScan()); + MavenVersionChecker.checkRuntimeMavenVersion(develocityApi.getBuildScan(), mavenSession); - workaroundQuickly(gradleEnterpriseApi.getBuildCache()); + workaroundQuickly(develocityApi.getBuildCache()); - Normalization.configureNormalization(gradleEnterpriseApi.getBuildCache()); + Normalization.configureNormalization(develocityApi.getBuildCache()); List configuredGoals = List.of( new CompilerConfiguredPlugin(), @@ -91,7 +88,7 @@ public void configure(GradleEnterpriseApi gradleEnterpriseApi, MavenSession mave ); for (ConfiguredPlugin configuredGoal : configuredGoals) { - configuredGoal.configureBuildCache(gradleEnterpriseApi, mavenSession); + configuredGoal.configureBuildCache(develocityApi, mavenSession); } } diff --git a/src/main/java/io/quarkus/develocity/project/SimpleQuarkusConfiguredPlugin.java b/src/main/java/io/quarkus/develocity/project/SimpleQuarkusConfiguredPlugin.java index 9da80c9..bef8c2e 100644 --- a/src/main/java/io/quarkus/develocity/project/SimpleQuarkusConfiguredPlugin.java +++ b/src/main/java/io/quarkus/develocity/project/SimpleQuarkusConfiguredPlugin.java @@ -9,16 +9,15 @@ import org.apache.maven.execution.MavenSession; import org.apache.maven.project.MavenProject; -import com.gradle.maven.extension.api.GradleEnterpriseApi; -import com.gradle.maven.extension.api.cache.MojoMetadataProvider; -import com.gradle.maven.extension.api.cache.NormalizationProvider; - +import com.gradle.develocity.agent.maven.api.DevelocityApi; +import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider; +import com.gradle.develocity.agent.maven.api.cache.NormalizationProvider; public abstract class SimpleQuarkusConfiguredPlugin implements ConfiguredPlugin { @Override - public void configureBuildCache(GradleEnterpriseApi gradleEnterpriseApi, MavenSession mavenSession) { - gradleEnterpriseApi.getBuildCache().registerMojoMetadataProvider(context -> { + public void configureBuildCache(DevelocityApi develocityApi, MavenSession mavenSession) { + develocityApi.getBuildCache().registerMojoMetadataProvider(context -> { context.withPlugin(getPluginName(), () -> { if (!isBuildCacheEnabled(context.getProject())) { Log.debug(getPluginName(), "Build cache is disabled."); diff --git a/src/main/java/io/quarkus/develocity/project/normalization/Normalization.java b/src/main/java/io/quarkus/develocity/project/normalization/Normalization.java index c59cd2b..c114cda 100644 --- a/src/main/java/io/quarkus/develocity/project/normalization/Normalization.java +++ b/src/main/java/io/quarkus/develocity/project/normalization/Normalization.java @@ -2,7 +2,7 @@ import java.nio.file.Path; -import com.gradle.maven.extension.api.cache.BuildCacheApi; +import com.gradle.develocity.agent.maven.api.cache.BuildCacheApi; import io.quarkus.develocity.project.util.Matchers; diff --git a/src/main/java/io/quarkus/develocity/project/plugins/CompilerConfiguredPlugin.java b/src/main/java/io/quarkus/develocity/project/plugins/CompilerConfiguredPlugin.java index b94ca3f..fed231b 100644 --- a/src/main/java/io/quarkus/develocity/project/plugins/CompilerConfiguredPlugin.java +++ b/src/main/java/io/quarkus/develocity/project/plugins/CompilerConfiguredPlugin.java @@ -3,8 +3,8 @@ import java.nio.file.Path; import java.util.Map; -import com.gradle.maven.extension.api.cache.MojoMetadataProvider; -import com.gradle.maven.extension.api.cache.MojoMetadataProvider.Context.FileSet.NormalizationStrategy; +import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider; +import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider.Context.FileSet.NormalizationStrategy; import io.quarkus.develocity.project.SimpleQuarkusConfiguredPlugin; import io.quarkus.develocity.project.util.Matchers; diff --git a/src/main/java/io/quarkus/develocity/project/plugins/EnforcerConfiguredPlugin.java b/src/main/java/io/quarkus/develocity/project/plugins/EnforcerConfiguredPlugin.java index 77a52f8..e0d87d2 100644 --- a/src/main/java/io/quarkus/develocity/project/plugins/EnforcerConfiguredPlugin.java +++ b/src/main/java/io/quarkus/develocity/project/plugins/EnforcerConfiguredPlugin.java @@ -3,7 +3,7 @@ import java.util.Map; import java.util.stream.Collectors; -import com.gradle.maven.extension.api.cache.MojoMetadataProvider; +import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider; import io.quarkus.develocity.project.SimpleQuarkusConfiguredPlugin; diff --git a/src/main/java/io/quarkus/develocity/project/plugins/FailsafeConfiguredPlugin.java b/src/main/java/io/quarkus/develocity/project/plugins/FailsafeConfiguredPlugin.java index 4e5629e..f1d2b6d 100644 --- a/src/main/java/io/quarkus/develocity/project/plugins/FailsafeConfiguredPlugin.java +++ b/src/main/java/io/quarkus/develocity/project/plugins/FailsafeConfiguredPlugin.java @@ -3,8 +3,8 @@ import java.nio.file.Path; import java.util.Map; -import com.gradle.maven.extension.api.cache.MojoMetadataProvider; -import com.gradle.maven.extension.api.cache.MojoMetadataProvider.Context.FileSet.NormalizationStrategy; +import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider; +import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider.Context.FileSet.NormalizationStrategy; import io.quarkus.develocity.project.SimpleQuarkusConfiguredPlugin; import io.quarkus.develocity.project.util.Matchers; diff --git a/src/main/java/io/quarkus/develocity/project/plugins/FormatterConfiguredPlugin.java b/src/main/java/io/quarkus/develocity/project/plugins/FormatterConfiguredPlugin.java index 58aad34..5d94c07 100644 --- a/src/main/java/io/quarkus/develocity/project/plugins/FormatterConfiguredPlugin.java +++ b/src/main/java/io/quarkus/develocity/project/plugins/FormatterConfiguredPlugin.java @@ -2,9 +2,9 @@ import java.util.Map; -import com.gradle.maven.extension.api.cache.MojoMetadataProvider; -import com.gradle.maven.extension.api.cache.MojoMetadataProvider.Context.FileSet.EmptyDirectoryHandling; -import com.gradle.maven.extension.api.cache.MojoMetadataProvider.Context.FileSet.NormalizationStrategy; +import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider; +import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider.Context.FileSet.EmptyDirectoryHandling; +import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider.Context.FileSet.NormalizationStrategy; import io.quarkus.develocity.project.SimpleQuarkusConfiguredPlugin; diff --git a/src/main/java/io/quarkus/develocity/project/plugins/ImpsortConfiguredPlugin.java b/src/main/java/io/quarkus/develocity/project/plugins/ImpsortConfiguredPlugin.java index 04856e0..1e9975c 100644 --- a/src/main/java/io/quarkus/develocity/project/plugins/ImpsortConfiguredPlugin.java +++ b/src/main/java/io/quarkus/develocity/project/plugins/ImpsortConfiguredPlugin.java @@ -2,9 +2,9 @@ import java.util.Map; -import com.gradle.maven.extension.api.cache.MojoMetadataProvider; -import com.gradle.maven.extension.api.cache.MojoMetadataProvider.Context.FileSet.EmptyDirectoryHandling; -import com.gradle.maven.extension.api.cache.MojoMetadataProvider.Context.FileSet.NormalizationStrategy; +import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider; +import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider.Context.FileSet.EmptyDirectoryHandling; +import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider.Context.FileSet.NormalizationStrategy; import io.quarkus.develocity.project.SimpleQuarkusConfiguredPlugin; diff --git a/src/main/java/io/quarkus/develocity/project/plugins/KotlinConfiguredPlugin.java b/src/main/java/io/quarkus/develocity/project/plugins/KotlinConfiguredPlugin.java index 0870098..ec8ed07 100644 --- a/src/main/java/io/quarkus/develocity/project/plugins/KotlinConfiguredPlugin.java +++ b/src/main/java/io/quarkus/develocity/project/plugins/KotlinConfiguredPlugin.java @@ -2,10 +2,10 @@ import java.util.Map; -import com.gradle.maven.extension.api.cache.MojoMetadataProvider; -import com.gradle.maven.extension.api.cache.MojoMetadataProvider.Context.FileSet.EmptyDirectoryHandling; -import com.gradle.maven.extension.api.cache.MojoMetadataProvider.Context.FileSet.LineEndingHandling; -import com.gradle.maven.extension.api.cache.MojoMetadataProvider.Context.FileSet.NormalizationStrategy; +import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider; +import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider.Context.FileSet.EmptyDirectoryHandling; +import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider.Context.FileSet.LineEndingHandling; +import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider.Context.FileSet.NormalizationStrategy; import io.quarkus.develocity.project.SimpleQuarkusConfiguredPlugin; diff --git a/src/main/java/io/quarkus/develocity/project/plugins/QuarkusConfiguredPlugin.java b/src/main/java/io/quarkus/develocity/project/plugins/QuarkusConfiguredPlugin.java index 9cd41a5..046fcc0 100644 --- a/src/main/java/io/quarkus/develocity/project/plugins/QuarkusConfiguredPlugin.java +++ b/src/main/java/io/quarkus/develocity/project/plugins/QuarkusConfiguredPlugin.java @@ -3,8 +3,8 @@ import java.util.Map; import java.util.stream.Collectors; -import com.gradle.maven.extension.api.cache.MojoMetadataProvider; -import com.gradle.maven.extension.api.cache.MojoMetadataProvider.Context.FileSet.NormalizationStrategy; +import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider; +import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider.Context.FileSet.NormalizationStrategy; import io.quarkus.develocity.project.SimpleQuarkusConfiguredPlugin; diff --git a/src/main/java/io/quarkus/develocity/project/plugins/QuarkusExtensionConfiguredPlugin.java b/src/main/java/io/quarkus/develocity/project/plugins/QuarkusExtensionConfiguredPlugin.java index 3f528bf..d291991 100644 --- a/src/main/java/io/quarkus/develocity/project/plugins/QuarkusExtensionConfiguredPlugin.java +++ b/src/main/java/io/quarkus/develocity/project/plugins/QuarkusExtensionConfiguredPlugin.java @@ -2,8 +2,8 @@ import java.util.Map; -import com.gradle.maven.extension.api.cache.MojoMetadataProvider; -import com.gradle.maven.extension.api.cache.MojoMetadataProvider.Context.FileSet.NormalizationStrategy; +import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider; +import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider.Context.FileSet.NormalizationStrategy; import io.quarkus.develocity.project.SimpleQuarkusConfiguredPlugin; diff --git a/src/main/java/io/quarkus/develocity/project/plugins/SourceConfiguredPlugin.java b/src/main/java/io/quarkus/develocity/project/plugins/SourceConfiguredPlugin.java index 7fc2fcb..c5805de 100644 --- a/src/main/java/io/quarkus/develocity/project/plugins/SourceConfiguredPlugin.java +++ b/src/main/java/io/quarkus/develocity/project/plugins/SourceConfiguredPlugin.java @@ -3,8 +3,8 @@ import java.util.Map; import java.util.stream.Collectors; -import com.gradle.maven.extension.api.cache.MojoMetadataProvider; -import com.gradle.maven.extension.api.cache.MojoMetadataProvider.Context.FileSet.NormalizationStrategy; +import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider; +import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider.Context.FileSet.NormalizationStrategy; import io.quarkus.develocity.project.SimpleQuarkusConfiguredPlugin; diff --git a/src/main/java/io/quarkus/develocity/project/plugins/SpotlessConfiguredPlugin.java b/src/main/java/io/quarkus/develocity/project/plugins/SpotlessConfiguredPlugin.java index 21e71b3..3505cd0 100644 --- a/src/main/java/io/quarkus/develocity/project/plugins/SpotlessConfiguredPlugin.java +++ b/src/main/java/io/quarkus/develocity/project/plugins/SpotlessConfiguredPlugin.java @@ -2,9 +2,9 @@ import java.util.Map; -import com.gradle.maven.extension.api.cache.MojoMetadataProvider; -import com.gradle.maven.extension.api.cache.MojoMetadataProvider.Context.FileSet.EmptyDirectoryHandling; -import com.gradle.maven.extension.api.cache.MojoMetadataProvider.Context.FileSet.LineEndingHandling; +import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider; +import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider.Context.FileSet.EmptyDirectoryHandling; +import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider.Context.FileSet.LineEndingHandling; import io.quarkus.develocity.project.SimpleQuarkusConfiguredPlugin; diff --git a/src/main/java/io/quarkus/develocity/project/plugins/SurefireConfiguredPlugin.java b/src/main/java/io/quarkus/develocity/project/plugins/SurefireConfiguredPlugin.java index e399c5f..5143b6f 100644 --- a/src/main/java/io/quarkus/develocity/project/plugins/SurefireConfiguredPlugin.java +++ b/src/main/java/io/quarkus/develocity/project/plugins/SurefireConfiguredPlugin.java @@ -3,8 +3,8 @@ import java.nio.file.Path; import java.util.Map; -import com.gradle.maven.extension.api.cache.MojoMetadataProvider; -import com.gradle.maven.extension.api.cache.MojoMetadataProvider.Context.FileSet.NormalizationStrategy; +import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider; +import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider.Context.FileSet.NormalizationStrategy; import io.quarkus.develocity.project.SimpleQuarkusConfiguredPlugin; import io.quarkus.develocity.project.util.Matchers; diff --git a/src/main/java/io/quarkus/develocity/project/scan/BuildScanMetadata.java b/src/main/java/io/quarkus/develocity/project/scan/BuildScanMetadata.java index 3a9bc94..7ed5a34 100644 --- a/src/main/java/io/quarkus/develocity/project/scan/BuildScanMetadata.java +++ b/src/main/java/io/quarkus/develocity/project/scan/BuildScanMetadata.java @@ -12,7 +12,7 @@ import java.util.ArrayList; import java.util.List; -import com.gradle.maven.extension.api.scan.BuildScanApi; +import com.gradle.develocity.agent.maven.api.scan.BuildScanApi; import io.quarkus.develocity.project.Log; diff --git a/src/main/java/io/quarkus/develocity/project/scan/MavenVersionChecker.java b/src/main/java/io/quarkus/develocity/project/scan/MavenVersionChecker.java index c781469..192bb27 100644 --- a/src/main/java/io/quarkus/develocity/project/scan/MavenVersionChecker.java +++ b/src/main/java/io/quarkus/develocity/project/scan/MavenVersionChecker.java @@ -13,7 +13,7 @@ import org.apache.maven.rtinfo.RuntimeInformation; import org.codehaus.plexus.component.repository.exception.ComponentLookupException; -import com.gradle.maven.extension.api.scan.BuildScanApi; +import com.gradle.develocity.agent.maven.api.scan.BuildScanApi; import io.quarkus.develocity.project.Log; diff --git a/src/main/java/io/quarkus/develocity/project/util/Matchers.java b/src/main/java/io/quarkus/develocity/project/util/Matchers.java index 7d5695e..0a8b1e8 100644 --- a/src/main/java/io/quarkus/develocity/project/util/Matchers.java +++ b/src/main/java/io/quarkus/develocity/project/util/Matchers.java @@ -5,8 +5,8 @@ import org.apache.maven.execution.MavenSession; import org.apache.maven.project.MavenProject; -import com.gradle.maven.extension.api.cache.MojoMetadataProvider; -import com.gradle.maven.extension.api.cache.NormalizationProvider; +import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider; +import com.gradle.develocity.agent.maven.api.cache.NormalizationProvider; public final class Matchers {