Skip to content

Commit 6de8efc

Browse files
committed
Ignore Lucene indexes used in tests when building cache keys
1 parent 6302660 commit 6de8efc

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/main/java/org/hibernate/search/develocity/plugins/SurefireConfiguredPlugin.java

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.hibernate.search.develocity.plugins;
22

33
import java.util.Map;
4+
import java.util.regex.Pattern;
45

56
import org.hibernate.search.develocity.GoalMetadataProvider;
67
import org.hibernate.search.develocity.SimpleConfiguredPlugin;
@@ -12,6 +13,8 @@ public class SurefireConfiguredPlugin extends SimpleConfiguredPlugin {
1213

1314
private static final String SUREFIRE_ENVIRONMENT_VARIABLES = "environmentVariables";
1415

16+
private static final Pattern TEST_INDEXES_PATTERN = Pattern.compile( "(^|/)test-indexes($|/)" );
17+
1518
@Override
1619
protected String getPluginName() {
1720
return "maven-surefire-plugin";
@@ -56,10 +59,16 @@ private void configureEnvironmentVariables(GoalMetadataProvider.Context context)
5659
value = "";
5760
}
5861
if ( value.startsWith( context.metadata().getSession().getExecutionRootDirectory() ) ) {
59-
inputs.fileSet( keyForDevelocity, value, fileSet -> {
60-
fileSet.normalizationStrategy(
61-
MojoMetadataProvider.Context.FileSet.NormalizationStrategy.RELATIVE_PATH );
62-
} );
62+
if ( TEST_INDEXES_PATTERN.matcher( "test-indexes" ).find() ) {
63+
// Lucene indexes used in tests -- we don't care about these.
64+
inputs.ignore( keyForDevelocity );
65+
}
66+
else {
67+
inputs.fileSet( keyForDevelocity, value, fileSet -> {
68+
fileSet.normalizationStrategy(
69+
MojoMetadataProvider.Context.FileSet.NormalizationStrategy.RELATIVE_PATH );
70+
} );
71+
}
6372
}
6473
else {
6574
inputs.property( keyForDevelocity, value );

0 commit comments

Comments
 (0)