diff --git a/MAINTAINERS.md b/MAINTAINERS.md index f620ec1..734af5b 100644 --- a/MAINTAINERS.md +++ b/MAINTAINERS.md @@ -6,12 +6,12 @@ i.e. anybody with direct push access to the git repository. ## Continuous integration -Continuous integration happens on a self-hosted Jenkins instance at https://ci.hibernate.org/job/hibernate-search-develocity-extension/. +Continuous integration happens on a self-hosted Jenkins instance at https://ci.hibernate.org/job/hibernate-develocity-maven-extension/. ## Release -* Go to [CI](https://ci.hibernate.org/job/hibernate-search-develocity-extension/). +* Go to [CI](https://ci.hibernate.org/job/hibernate-develocity-maven-extension/). * Click the "play" button (green triangle) to launch a build. * Input the parameters. * Click "Build". -* If something doesn't work, [call for help](https://hibernate.org/community/#contribute). \ No newline at end of file +* If something doesn't work, [call for help](https://hibernate.org/community/#contribute). diff --git a/README.md b/README.md index d7bd90f..e6de5a1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Maven extension configuring the Develocity build cache configuration for the Hibernate Search project -[![Version](https://img.shields.io/maven-central/v/org.hibernate.search.develocity/hibernate-search-develocity-extension?logo=apache-maven&style=for-the-badge)](https://central.sonatype.com/artifact/org.hibernate.search.develocity/hibernate-search-develocity-extension) +[![Version](https://img.shields.io/maven-central/v/org.hibernate.infra.develocity/hibernate-develocity-maven-extension?logo=apache-maven&style=for-the-badge)](https://central.sonatype.com/artifact/org.hibernate.infra.develocity/hibernate-develocity-maven-extension) ## About diff --git a/pom.xml b/pom.xml index cd5507b..57fac89 100644 --- a/pom.xml +++ b/pom.xml @@ -1,17 +1,17 @@ 4.0.0 - org.hibernate.search.develocity - hibernate-search-develocity-extension + org.hibernate.infra.develocity + hibernate-develocity-maven-extension jar 2.0.1-SNAPSHOT - Hibernate Search Develocity extension - A Maven extension to configure the Develocity build cache for the Hibernate Search project - https://github.com/hibernate/hibernate-search-develocity-extension + Hibernate Develocity extension for Maven Projects + A Maven extension to configure the Develocity build cache for the Hibernate projects using Maven as a build tool. + https://github.com/hibernate/hibernate-develocity-maven-extension UTF-8 UTF-8 - 1.21 + 1.22.2 3.9.6 2.2.0 0.3.5 @@ -192,15 +192,15 @@ - https://github.com/hibernate/hibernate-search-develocity-extension - scm:git:git@github.com:hibernate/hibernate-search-develocity-extension.git - scm:git:git@github.com:hibernate/hibernate-search-develocity-extension.git + https://github.com/hibernate/hibernate-develocity-maven-extension + scm:git:git@github.com:hibernate/hibernate-develocity-maven-extension.git + scm:git:git@github.com:hibernate/hibernate-develocity-maven-extension.git HEAD GitHub - https://github.com/hibernate/hibernate-search-develocity-extension/issues + https://github.com/hibernate/hibernate-develocity-maven-extension/issues diff --git a/src/main/java/org/hibernate/search/develocity/ConfiguredPlugin.java b/src/main/java/org/hibernate/infra/develocity/ConfiguredPlugin.java similarity index 85% rename from src/main/java/org/hibernate/search/develocity/ConfiguredPlugin.java rename to src/main/java/org/hibernate/infra/develocity/ConfiguredPlugin.java index 3a7e633..b2af8ea 100644 --- a/src/main/java/org/hibernate/search/develocity/ConfiguredPlugin.java +++ b/src/main/java/org/hibernate/infra/develocity/ConfiguredPlugin.java @@ -1,4 +1,4 @@ -package org.hibernate.search.develocity; +package org.hibernate.infra.develocity; import org.apache.maven.execution.MavenSession; diff --git a/src/main/java/org/hibernate/search/develocity/GoalMetadataProvider.java b/src/main/java/org/hibernate/infra/develocity/GoalMetadataProvider.java similarity index 90% rename from src/main/java/org/hibernate/search/develocity/GoalMetadataProvider.java rename to src/main/java/org/hibernate/infra/develocity/GoalMetadataProvider.java index 1808892..c4dc3ca 100644 --- a/src/main/java/org/hibernate/search/develocity/GoalMetadataProvider.java +++ b/src/main/java/org/hibernate/infra/develocity/GoalMetadataProvider.java @@ -1,9 +1,9 @@ -package org.hibernate.search.develocity; +package org.hibernate.infra.develocity; import java.util.function.Consumer; -import org.hibernate.search.develocity.util.MavenMojoExecutionConfig; -import org.hibernate.search.develocity.util.MavenProperties; +import org.hibernate.infra.develocity.util.MavenMojoExecutionConfig; +import org.hibernate.infra.develocity.util.MavenProperties; import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider; import com.gradle.develocity.agent.maven.api.scan.BuildScanApi; diff --git a/src/main/java/org/hibernate/search/develocity/HibernateSearchProjectDevelocityListener.java b/src/main/java/org/hibernate/infra/develocity/HibernateSearchProjectDevelocityListener.java similarity index 74% rename from src/main/java/org/hibernate/search/develocity/HibernateSearchProjectDevelocityListener.java rename to src/main/java/org/hibernate/infra/develocity/HibernateSearchProjectDevelocityListener.java index 0ae485b..55fc0ea 100644 --- a/src/main/java/org/hibernate/search/develocity/HibernateSearchProjectDevelocityListener.java +++ b/src/main/java/org/hibernate/infra/develocity/HibernateSearchProjectDevelocityListener.java @@ -1,16 +1,16 @@ -package org.hibernate.search.develocity; +package org.hibernate.infra.develocity; import java.util.List; import com.gradle.develocity.agent.maven.api.scan.BuildScanPublishing; import org.apache.maven.execution.MavenSession; import org.codehaus.plexus.component.annotations.Component; -import org.hibernate.search.develocity.normalization.Normalization; -import org.hibernate.search.develocity.plugins.CompilerConfiguredPlugin; -import org.hibernate.search.develocity.plugins.FailsafeConfiguredPlugin; -import org.hibernate.search.develocity.plugins.ForbiddenApisConfiguredPlugin; -import org.hibernate.search.develocity.plugins.SurefireConfiguredPlugin; -import org.hibernate.search.develocity.scan.BuildScanMetadata; +import org.hibernate.infra.develocity.normalization.Normalization; +import org.hibernate.infra.develocity.plugins.CompilerConfiguredPlugin; +import org.hibernate.infra.develocity.plugins.FailsafeConfiguredPlugin; +import org.hibernate.infra.develocity.plugins.ForbiddenApisConfiguredPlugin; +import org.hibernate.infra.develocity.plugins.SurefireConfiguredPlugin; +import org.hibernate.infra.develocity.scan.BuildScanMetadata; import com.gradle.develocity.agent.maven.api.DevelocityApi; import com.gradle.develocity.agent.maven.api.DevelocityListener; @@ -26,7 +26,7 @@ public void configure(DevelocityApi develocityApi, MavenSession mavenSession) { develocityApi.getBuildScan().getPublishing() .onlyIf( BuildScanPublishing.PublishingContext::isAuthenticated ); - BuildScanMetadata.addMainMetadata(develocityApi.getBuildScan()); + BuildScanMetadata.addMainMetadata(develocityApi.getBuildScan(), mavenSession); Normalization.configureNormalization(develocityApi.getBuildCache()); diff --git a/src/main/java/org/hibernate/search/develocity/Log.java b/src/main/java/org/hibernate/infra/develocity/Log.java similarity index 97% rename from src/main/java/org/hibernate/search/develocity/Log.java rename to src/main/java/org/hibernate/infra/develocity/Log.java index b2e3988..2798e7f 100644 --- a/src/main/java/org/hibernate/search/develocity/Log.java +++ b/src/main/java/org/hibernate/infra/develocity/Log.java @@ -1,4 +1,4 @@ -package org.hibernate.search.develocity; +package org.hibernate.infra.develocity; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/org/hibernate/search/develocity/SimpleConfiguredPlugin.java b/src/main/java/org/hibernate/infra/develocity/SimpleConfiguredPlugin.java similarity index 95% rename from src/main/java/org/hibernate/search/develocity/SimpleConfiguredPlugin.java rename to src/main/java/org/hibernate/infra/develocity/SimpleConfiguredPlugin.java index 8dac33d..77af4f7 100644 --- a/src/main/java/org/hibernate/search/develocity/SimpleConfiguredPlugin.java +++ b/src/main/java/org/hibernate/infra/develocity/SimpleConfiguredPlugin.java @@ -1,12 +1,12 @@ -package org.hibernate.search.develocity; +package org.hibernate.infra.develocity; import java.util.Collections; import java.util.Map; import java.util.Map.Entry; import java.util.function.Function; -import org.hibernate.search.develocity.scan.BuildScanMetadata; -import org.hibernate.search.develocity.util.JavaVersions; +import org.hibernate.infra.develocity.scan.BuildScanMetadata; +import org.hibernate.infra.develocity.util.JavaVersions; import com.gradle.develocity.agent.maven.api.DevelocityApi; import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider; diff --git a/src/main/java/org/hibernate/search/develocity/normalization/Normalization.java b/src/main/java/org/hibernate/infra/develocity/normalization/Normalization.java similarity index 92% rename from src/main/java/org/hibernate/search/develocity/normalization/Normalization.java rename to src/main/java/org/hibernate/infra/develocity/normalization/Normalization.java index 4f988d7..8804e72 100644 --- a/src/main/java/org/hibernate/search/develocity/normalization/Normalization.java +++ b/src/main/java/org/hibernate/infra/develocity/normalization/Normalization.java @@ -1,4 +1,4 @@ -package org.hibernate.search.develocity.normalization; +package org.hibernate.infra.develocity.normalization; import com.gradle.develocity.agent.maven.api.cache.BuildCacheApi; diff --git a/src/main/java/org/hibernate/search/develocity/plugins/CompilerConfiguredPlugin.java b/src/main/java/org/hibernate/infra/develocity/plugins/CompilerConfiguredPlugin.java similarity index 72% rename from src/main/java/org/hibernate/search/develocity/plugins/CompilerConfiguredPlugin.java rename to src/main/java/org/hibernate/infra/develocity/plugins/CompilerConfiguredPlugin.java index 45e5870..464d9ea 100644 --- a/src/main/java/org/hibernate/search/develocity/plugins/CompilerConfiguredPlugin.java +++ b/src/main/java/org/hibernate/infra/develocity/plugins/CompilerConfiguredPlugin.java @@ -1,11 +1,11 @@ -package org.hibernate.search.develocity.plugins; +package org.hibernate.infra.develocity.plugins; import java.util.Map; -import org.hibernate.search.develocity.GoalMetadataProvider; -import org.hibernate.search.develocity.SimpleConfiguredPlugin; -import org.hibernate.search.develocity.scan.BuildScanMetadata; -import org.hibernate.search.develocity.util.JavaVersions; +import org.hibernate.infra.develocity.GoalMetadataProvider; +import org.hibernate.infra.develocity.SimpleConfiguredPlugin; +import org.hibernate.infra.develocity.scan.BuildScanMetadata; +import org.hibernate.infra.develocity.util.JavaVersions; public class CompilerConfiguredPlugin extends SimpleConfiguredPlugin { diff --git a/src/main/java/org/hibernate/search/develocity/plugins/FailsafeConfiguredPlugin.java b/src/main/java/org/hibernate/infra/develocity/plugins/FailsafeConfiguredPlugin.java similarity index 93% rename from src/main/java/org/hibernate/search/develocity/plugins/FailsafeConfiguredPlugin.java rename to src/main/java/org/hibernate/infra/develocity/plugins/FailsafeConfiguredPlugin.java index e161f3c..4658cc3 100644 --- a/src/main/java/org/hibernate/search/develocity/plugins/FailsafeConfiguredPlugin.java +++ b/src/main/java/org/hibernate/infra/develocity/plugins/FailsafeConfiguredPlugin.java @@ -1,9 +1,9 @@ -package org.hibernate.search.develocity.plugins; +package org.hibernate.infra.develocity.plugins; import java.util.Map; -import org.hibernate.search.develocity.GoalMetadataProvider; -import org.hibernate.search.develocity.scan.BuildScanMetadata; +import org.hibernate.infra.develocity.GoalMetadataProvider; +import org.hibernate.infra.develocity.scan.BuildScanMetadata; import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider; diff --git a/src/main/java/org/hibernate/search/develocity/plugins/ForbiddenApisConfiguredPlugin.java b/src/main/java/org/hibernate/infra/develocity/plugins/ForbiddenApisConfiguredPlugin.java similarity index 68% rename from src/main/java/org/hibernate/search/develocity/plugins/ForbiddenApisConfiguredPlugin.java rename to src/main/java/org/hibernate/infra/develocity/plugins/ForbiddenApisConfiguredPlugin.java index 333a09f..dd9f1c1 100644 --- a/src/main/java/org/hibernate/search/develocity/plugins/ForbiddenApisConfiguredPlugin.java +++ b/src/main/java/org/hibernate/infra/develocity/plugins/ForbiddenApisConfiguredPlugin.java @@ -1,10 +1,10 @@ -package org.hibernate.search.develocity.plugins; +package org.hibernate.infra.develocity.plugins; import java.io.File; import java.util.Map; -import org.hibernate.search.develocity.GoalMetadataProvider; -import org.hibernate.search.develocity.SimpleConfiguredPlugin; +import org.hibernate.infra.develocity.GoalMetadataProvider; +import org.hibernate.infra.develocity.SimpleConfiguredPlugin; import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider.Context.FileSet.NormalizationStrategy; @@ -39,10 +39,10 @@ private static void configureCheck(GoalMetadataProvider.Context context) { inputs.fileSet("classpathElements", fs -> fs.normalizationStrategy(NormalizationStrategy.COMPILE_CLASSPATH)); inputs.fileSet("classesDirectory", fs -> fs.normalizationStrategy(NormalizationStrategy.COMPILE_CLASSPATH)); - // for now, we push only one signature artifacts but we could explore the config if it was strictly necessary - File hibernateSearchBuildConfigArtifactFile = resolveHibernateSearchBuildConfigArtifact(context); + // for now, we push only one signature artifacts, but we could explore the config if it was strictly necessary + File buildConfigArtifactFile = resolveBuildConfigArtifact(context); - inputs.fileSet("hibernateSearchBuildConfig", hibernateSearchBuildConfigArtifactFile, + inputs.fileSet("buildConfigArtifact", buildConfigArtifactFile, fs -> fs.normalizationStrategy(NormalizationStrategy.CLASSPATH)); inputs.ignore("signaturesArtifacts", "projectRepos", "repoSession"); @@ -63,9 +63,20 @@ private static void configureTestCheck(GoalMetadataProvider.Context context) { }); } - private static File resolveHibernateSearchBuildConfigArtifact(GoalMetadataProvider.Context context) { - Artifact hibernateSearchBuildConfigArtifact = new DefaultArtifact("org.hibernate.search", - "hibernate-search-build-config", "jar", + private static File resolveBuildConfigArtifact(GoalMetadataProvider.Context context) { + String groupId = context.metadata().getProject().getModel().getGroupId(); + if ("org.hibernate.search".equals(groupId)) { + return resolveBuildConfigArtifact("org.hibernate.search", "hibernate-search-build-config", context); + } else if ("org.hibernate.validator".equals(groupId)) { + return resolveBuildConfigArtifact("org.hibernate.validator", "hibernate-validator-build-config", context); + } else { + throw new IllegalArgumentException("This project is not supported by the extension: %s:%s".formatted(groupId, context.metadata().getProject().getArtifactId())); + } + + } + + private static File resolveBuildConfigArtifact(String groupId, String artifactId, GoalMetadataProvider.Context context) { + Artifact hibernateSearchBuildConfigArtifact = new DefaultArtifact(groupId, artifactId, "jar", context.metadata().getProject().getVersion()); File hibernateSearchBuildConfigArtifactFile = context.metadata().getSession().getRepositorySession().getWorkspaceReader() .findArtifact(hibernateSearchBuildConfigArtifact); diff --git a/src/main/java/org/hibernate/search/develocity/plugins/SurefireConfiguredPlugin.java b/src/main/java/org/hibernate/infra/develocity/plugins/SurefireConfiguredPlugin.java similarity index 89% rename from src/main/java/org/hibernate/search/develocity/plugins/SurefireConfiguredPlugin.java rename to src/main/java/org/hibernate/infra/develocity/plugins/SurefireConfiguredPlugin.java index 95fdb9b..69eaa40 100644 --- a/src/main/java/org/hibernate/search/develocity/plugins/SurefireConfiguredPlugin.java +++ b/src/main/java/org/hibernate/infra/develocity/plugins/SurefireConfiguredPlugin.java @@ -1,11 +1,12 @@ -package org.hibernate.search.develocity.plugins; +package org.hibernate.infra.develocity.plugins; import java.util.Map; import java.util.regex.Pattern; -import org.hibernate.search.develocity.GoalMetadataProvider; -import org.hibernate.search.develocity.SimpleConfiguredPlugin; -import org.hibernate.search.develocity.util.JavaVersions; +import org.hibernate.infra.develocity.GoalMetadataProvider; +import org.hibernate.infra.develocity.SimpleConfiguredPlugin; +import org.hibernate.infra.develocity.scan.BuildScanMetadata; +import org.hibernate.infra.develocity.util.JavaVersions; import com.gradle.develocity.agent.maven.api.cache.MojoMetadataProvider; @@ -35,6 +36,10 @@ protected void configureTest(GoalMetadataProvider.Context context) { } ); configureEnvironmentVariables(context); + + if ( !isSkipped( context ) ) { + BuildScanMetadata.addSurefireMetadata( context ); + } } // Develocity handles environment variables as a big blob by default, diff --git a/src/main/java/org/hibernate/search/develocity/scan/BuildScanMetadata.java b/src/main/java/org/hibernate/infra/develocity/scan/BuildScanMetadata.java similarity index 50% rename from src/main/java/org/hibernate/search/develocity/scan/BuildScanMetadata.java rename to src/main/java/org/hibernate/infra/develocity/scan/BuildScanMetadata.java index 29aeb2c..68145ca 100644 --- a/src/main/java/org/hibernate/search/develocity/scan/BuildScanMetadata.java +++ b/src/main/java/org/hibernate/infra/develocity/scan/BuildScanMetadata.java @@ -1,6 +1,6 @@ -package org.hibernate.search.develocity.scan; +package org.hibernate.infra.develocity.scan; -import static org.hibernate.search.develocity.util.Strings.isBlank; +import static org.hibernate.infra.develocity.util.Strings.isBlank; import java.io.IOException; import java.nio.file.Files; @@ -8,11 +8,13 @@ import java.util.Objects; import java.util.regex.Pattern; -import org.hibernate.search.develocity.GoalMetadataProvider; -import org.hibernate.search.develocity.Log; -import org.hibernate.search.develocity.util.JavaVersions; -import org.hibernate.search.develocity.util.MavenProperties; -import org.hibernate.search.develocity.util.Strings; +import org.apache.maven.execution.MavenSession; +import org.apache.maven.model.Profile; +import org.hibernate.infra.develocity.GoalMetadataProvider; +import org.hibernate.infra.develocity.Log; +import org.hibernate.infra.develocity.util.JavaVersions; +import org.hibernate.infra.develocity.util.MavenProperties; +import org.hibernate.infra.develocity.util.Strings; import com.gradle.develocity.agent.maven.api.scan.BuildScanApi; @@ -25,7 +27,7 @@ public final class BuildScanMetadata { private BuildScanMetadata() { } - public static void addMainMetadata(BuildScanApi buildScanApi) { + public static void addMainMetadata(BuildScanApi buildScanApi, MavenSession mavenSession) { // Add mvn command line final String mavenCommandLine = System.getenv( "MAVEN_CMD_LINE_ARGS" ) != null ? "mvn " + System.getenv( @@ -34,10 +36,10 @@ public static void addMainMetadata(BuildScanApi buildScanApi) { if ( !isBlank( mavenCommandLine ) ) { buildScanApi.value( "Maven command line", mavenCommandLine ); } - - buildScanApi.tag( "hibernate-search" ); + buildScanApi.tag(mavenSession.getTopLevelProject().getGroupId()); } + public static void addCompilerMetadata(GoalMetadataProvider.Context context) { var buildScanApi = context.buildScan(); String compilerId = context.configuration().getString( "compilerId" ); @@ -68,54 +70,80 @@ public static void addFailsafeMetadata(GoalMetadataProvider.Context context) { var buildScanApi = context.buildScan(); var project = context.metadata().getProject(); - boolean dependsOnOrm = false; - boolean dependsOnLucene = false; - boolean dependsOnElasticsearch = false; - var artifactFilter = context.configuration().getFailsafeClasspathFilter(); - for ( var dependency : project.getArtifacts() ) { - if ( !artifactFilter.include( dependency ) ) { - continue; + if ("org.hibernate.search".equals(project.getGroupId())) { + boolean dependsOnOrm = false; + boolean dependsOnLucene = false; + boolean dependsOnElasticsearch = false; + var artifactFilter = context.configuration().getFailsafeClasspathFilter(); + for (var dependency : project.getArtifacts()) { + if (!artifactFilter.include(dependency)) { + continue; + } + var artifactId = dependency.getArtifactId(); + dependsOnOrm = dependsOnOrm || artifactId.contains("mapper-orm"); + dependsOnLucene = dependsOnLucene || artifactId.contains("backend-lucene"); + dependsOnElasticsearch = dependsOnElasticsearch || artifactId.contains("backend-elasticsearch"); } - var artifactId = dependency.getArtifactId(); - dependsOnOrm = dependsOnOrm || artifactId.contains( "mapper-orm" ); - dependsOnLucene = dependsOnLucene || artifactId.contains( "backend-lucene" ); - dependsOnElasticsearch = dependsOnElasticsearch || artifactId.contains( "backend-elasticsearch" ); - } - if ( dependsOnOrm ) { - var dbKind = context.properties().getString( "test.database.run.kind" ); - if ( !Strings.isBlank( dbKind ) ) { - if ( dbKind.equals( "h2" ) ) { - // H2 doesn't use containers - buildScanApi.tag( "h2" ); - } - else { - addDockerfileMetadata( context, - "database/%s.Dockerfile".formatted( dbKind ), dbKind, null, false ); + if (dependsOnOrm) { + var dbKind = context.properties().getString("test.database.run.kind"); + if (!Strings.isBlank(dbKind)) { + if (dbKind.equals("h2")) { + // H2 doesn't use containers + buildScanApi.tag("h2"); + } else { + addDockerfileMetadata(context, + "database/%s.Dockerfile".formatted(dbKind), dbKind, null, false); + } } } - } - String explicitBackend = context.configuration() - .getFailsafeSystemProperty( "org.hibernate.search.integrationtest.backend.type" ); - if ( Strings.isBlank( explicitBackend ) ) { - explicitBackend = null; - } + String explicitBackend = context.configuration() + .getFailsafeSystemProperty("org.hibernate.search.integrationtest.backend.type"); + if (Strings.isBlank(explicitBackend)) { + explicitBackend = null; + } + + if (dependsOnLucene + && (explicitBackend == null || "lucene".equals(explicitBackend)) + && !context.properties().getBoolean("test.lucene.skip")) { + buildScanApi.tag("lucene"); + } - if ( dependsOnLucene - && ( explicitBackend == null || "lucene".equals( explicitBackend ) ) - && !context.properties().getBoolean( "test.lucene.skip" ) ) { - buildScanApi.tag( "lucene" ); + if (dependsOnElasticsearch + && (explicitBackend == null || "elasticsearch".equals(explicitBackend)) + && !context.properties().getBoolean("test.elasticsearch.skip")) { + var distribution = context.properties().getString("test.elasticsearch.distribution"); + addDockerfileMetadata(context, + "search-backend/%s.Dockerfile".formatted(distribution), + "elastic".equals(distribution) ? "elasticsearch" : distribution, + context.properties().getString("test.elasticsearch.version"), true); + } + } else if (!"org.hibernate.validator".equals(project.getGroupId())) { + Log.warn("Project %s:%s is unknown, no specific Failsafe metadata added.".formatted(project.getGroupId(), project.getArtifactId())); } + } - if ( dependsOnElasticsearch - && ( explicitBackend == null || "elasticsearch".equals( explicitBackend ) ) - && !context.properties().getBoolean( "test.elasticsearch.skip" ) ) { - var distribution = context.properties().getString( "test.elasticsearch.distribution" ); - addDockerfileMetadata( context, - "search-backend/%s.Dockerfile".formatted( distribution ), - "elastic".equals( distribution ) ? "elasticsearch" : distribution, - context.properties().getString( "test.elasticsearch.version" ), true ); + public static void addSurefireMetadata(GoalMetadataProvider.Context context) { + var buildScanApi = context.buildScan(); + var project = context.metadata().getProject(); + if ("org.hibernate.validator".equals(project.getGroupId())) { + if ("hibernate-validator-tck-runner".equals(project.getArtifactId())) { + project.getActiveProfiles().stream().map(Profile::getId) + .filter("local"::equals).findAny() + .ifPresent(id -> buildScanApi.tag("Standalone-TCK")); + + project.getActiveProfiles().stream().map(Profile::getId) + .filter(id -> id.startsWith("incontainer")).findAny() + .ifPresent(id -> buildScanApi.tag("In-Container-TCK")); + + project.getArtifacts().stream() + .filter(a -> "validation-tck-tests".equals(a.getArtifactId())) + .findAny() + .ifPresent(a -> buildScanApi.tag("Validation-TCK-%s".formatted(a.getVersion()))); + } + } else if (!"org.hibernate.search".equals(project.getGroupId())) { + Log.warn("Project %s:%s is unknown, no specific Surefire metadata added.".formatted(project.getGroupId(), project.getArtifactId())); } } diff --git a/src/main/java/org/hibernate/search/develocity/util/JavaVersions.java b/src/main/java/org/hibernate/infra/develocity/util/JavaVersions.java similarity index 98% rename from src/main/java/org/hibernate/search/develocity/util/JavaVersions.java rename to src/main/java/org/hibernate/infra/develocity/util/JavaVersions.java index e1a946b..568e2b1 100644 --- a/src/main/java/org/hibernate/search/develocity/util/JavaVersions.java +++ b/src/main/java/org/hibernate/infra/develocity/util/JavaVersions.java @@ -1,4 +1,4 @@ -package org.hibernate.search.develocity.util; +package org.hibernate.infra.develocity.util; import java.io.IOException; import java.nio.charset.StandardCharsets; diff --git a/src/main/java/org/hibernate/search/develocity/util/Matchers.java b/src/main/java/org/hibernate/infra/develocity/util/Matchers.java similarity index 97% rename from src/main/java/org/hibernate/search/develocity/util/Matchers.java rename to src/main/java/org/hibernate/infra/develocity/util/Matchers.java index 1b4ccf2..4f9533c 100644 --- a/src/main/java/org/hibernate/search/develocity/util/Matchers.java +++ b/src/main/java/org/hibernate/infra/develocity/util/Matchers.java @@ -1,4 +1,4 @@ -package org.hibernate.search.develocity.util; +package org.hibernate.infra.develocity.util; import java.nio.file.Path; diff --git a/src/main/java/org/hibernate/search/develocity/util/MavenMojoExecutionConfig.java b/src/main/java/org/hibernate/infra/develocity/util/MavenMojoExecutionConfig.java similarity index 97% rename from src/main/java/org/hibernate/search/develocity/util/MavenMojoExecutionConfig.java rename to src/main/java/org/hibernate/infra/develocity/util/MavenMojoExecutionConfig.java index 4550528..ca9712a 100644 --- a/src/main/java/org/hibernate/search/develocity/util/MavenMojoExecutionConfig.java +++ b/src/main/java/org/hibernate/infra/develocity/util/MavenMojoExecutionConfig.java @@ -1,11 +1,11 @@ -package org.hibernate.search.develocity.util; +package org.hibernate.infra.develocity.util; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; -import org.hibernate.search.develocity.Log; +import org.hibernate.infra.develocity.Log; import org.apache.maven.artifact.resolver.filter.AndArtifactFilter; import org.apache.maven.artifact.resolver.filter.ArtifactFilter; diff --git a/src/main/java/org/hibernate/search/develocity/util/MavenProperties.java b/src/main/java/org/hibernate/infra/develocity/util/MavenProperties.java similarity index 96% rename from src/main/java/org/hibernate/search/develocity/util/MavenProperties.java rename to src/main/java/org/hibernate/infra/develocity/util/MavenProperties.java index c7f7e48..1c13af0 100644 --- a/src/main/java/org/hibernate/search/develocity/util/MavenProperties.java +++ b/src/main/java/org/hibernate/infra/develocity/util/MavenProperties.java @@ -1,4 +1,4 @@ -package org.hibernate.search.develocity.util; +package org.hibernate.infra.develocity.util; import org.apache.maven.execution.MavenSession; import org.apache.maven.plugin.MojoExecution; diff --git a/src/main/java/org/hibernate/search/develocity/util/Strings.java b/src/main/java/org/hibernate/infra/develocity/util/Strings.java similarity index 82% rename from src/main/java/org/hibernate/search/develocity/util/Strings.java rename to src/main/java/org/hibernate/infra/develocity/util/Strings.java index 59fa119..4eeeb06 100644 --- a/src/main/java/org/hibernate/search/develocity/util/Strings.java +++ b/src/main/java/org/hibernate/infra/develocity/util/Strings.java @@ -1,4 +1,4 @@ -package org.hibernate.search.develocity.util; +package org.hibernate.infra.develocity.util; public final class Strings { diff --git a/src/test/java/org/hibernate/search/develocity/scan/BuildScanMetadataTest.java b/src/test/java/org/hibernate/infra/develocity/scan/BuildScanMetadataTest.java similarity index 86% rename from src/test/java/org/hibernate/search/develocity/scan/BuildScanMetadataTest.java rename to src/test/java/org/hibernate/infra/develocity/scan/BuildScanMetadataTest.java index a99efd4..f7bbfa3 100644 --- a/src/test/java/org/hibernate/search/develocity/scan/BuildScanMetadataTest.java +++ b/src/test/java/org/hibernate/infra/develocity/scan/BuildScanMetadataTest.java @@ -1,9 +1,7 @@ -package org.hibernate.search.develocity.scan; +package org.hibernate.infra.develocity.scan; import static org.junit.jupiter.api.Assertions.assertEquals; -import org.hibernate.search.develocity.util.JavaVersions; - import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; @@ -21,4 +19,4 @@ void toShortImageRef(String expected, String ref) { assertEquals( expected, BuildScanMetadata.toShortImageRef( ref ) ); } -} \ No newline at end of file +} diff --git a/src/test/java/org/hibernate/search/develocity/scan/util/JavaVersionsTest.java b/src/test/java/org/hibernate/infra/develocity/scan/util/JavaVersionsTest.java similarity index 88% rename from src/test/java/org/hibernate/search/develocity/scan/util/JavaVersionsTest.java rename to src/test/java/org/hibernate/infra/develocity/scan/util/JavaVersionsTest.java index c7d1b6a..efab669 100644 --- a/src/test/java/org/hibernate/search/develocity/scan/util/JavaVersionsTest.java +++ b/src/test/java/org/hibernate/infra/develocity/scan/util/JavaVersionsTest.java @@ -1,9 +1,8 @@ -package org.hibernate.search.develocity.scan.util; +package org.hibernate.infra.develocity.scan.util; import static org.junit.jupiter.api.Assertions.assertEquals; -import org.hibernate.search.develocity.scan.BuildScanMetadata; -import org.hibernate.search.develocity.util.JavaVersions; +import org.hibernate.infra.develocity.util.JavaVersions; import org.junit.jupiter.params.ParameterizedTest; import org.junit.jupiter.params.provider.CsvSource; @@ -35,4 +34,4 @@ void toJdkMajor(String expected, String fullVersionText) { assertEquals( expected, JavaVersions.toJdkMajor( fullVersionText, "notfound" ) ); } -} \ No newline at end of file +}