Skip to content

Commit

Permalink
Merge pull request #16 from jprinet/chore/upgrade-dv-1.21
Browse files Browse the repository at this point in the history
Upgrade to Develocity extension 1.21
  • Loading branch information
gsmet authored Apr 5, 2024
2 parents 1056450 + 6b87afc commit 13c1d6f
Show file tree
Hide file tree
Showing 19 changed files with 59 additions and 63 deletions.
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<groupId>io.quarkus.develocity</groupId>
<artifactId>quarkus-project-develocity-extension</artifactId>
<packaging>jar</packaging>
<version>1.0.9-SNAPSHOT</version>
<version>1.1.0-SNAPSHOT</version>
<name>Quarkus project's Develocity extension</name>
<description>A Maven extension to configure the Develocity build cache for the Quarkus project</description>
<url>https://github.com/quarkusio/quarkus-project-develocity-extension</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

<gradle-enterprise-maven-extension.version>1.20.1</gradle-enterprise-maven-extension.version>
<develocity-maven-extension.version>1.21</develocity-maven-extension.version>
<maven-core.version>3.9.6</maven-core.version>
<plexus-component.version>2.2.0</plexus-component.version>
<sisu-inject.version>0.3.5</sisu-inject.version>
Expand Down Expand Up @@ -43,8 +43,8 @@
</dependency>
<dependency>
<groupId>com.gradle</groupId>
<artifactId>gradle-enterprise-maven-extension</artifactId>
<version>${gradle-enterprise-maven-extension.version}</version>
<artifactId>develocity-maven-extension</artifactId>
<version>${develocity-maven-extension.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 = "-";
Expand All @@ -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);
}
Expand All @@ -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<ConfiguredPlugin> configuredGoals = List.of(
new CompilerConfiguredPlugin(),
Expand All @@ -91,7 +88,7 @@ public void configure(GradleEnterpriseApi gradleEnterpriseApi, MavenSession mave
);

for (ConfiguredPlugin configuredGoal : configuredGoals) {
configuredGoal.configureBuildCache(gradleEnterpriseApi, mavenSession);
configuredGoal.configureBuildCache(develocityApi, mavenSession);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down

0 comments on commit 13c1d6f

Please sign in to comment.