Skip to content

Commit d03f0d5

Browse files
committed
Fix PatternSetFactory incompatibility
1 parent 2d99c17 commit d03f0d5

File tree

3 files changed

+32
-14
lines changed

3 files changed

+32
-14
lines changed

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/rest/CopyRestApiTask.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525
import org.gradle.api.tasks.SkipWhenEmpty;
2626
import org.gradle.api.tasks.TaskAction;
2727
import org.gradle.api.tasks.util.PatternFilterable;
28-
import org.gradle.api.tasks.util.PatternSet;
29-
import org.gradle.internal.Factory;
28+
import org.gradle.api.tasks.util.internal.PatternSetFactory;
3029

3130
import java.io.File;
3231
import java.io.IOException;
@@ -65,14 +64,14 @@ public class CopyRestApiTask extends DefaultTask {
6564
@Inject
6665
public CopyRestApiTask(
6766
ProjectLayout projectLayout,
68-
Factory<PatternSet> patternSetFactory,
67+
PatternSetFactory patternSetFactory,
6968
FileSystemOperations fileSystemOperations,
7069
ObjectFactory objectFactory
7170
) {
7271
this.include = objectFactory.listProperty(String.class);
7372
this.outputResourceDir = objectFactory.directoryProperty();
7473
this.additionalYamlTestsDir = objectFactory.directoryProperty();
75-
this.patternSet = patternSetFactory.create();
74+
this.patternSet = patternSetFactory.createPatternSet();
7675
this.projectLayout = projectLayout;
7776
this.fileSystemOperations = fileSystemOperations;
7877
}

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/rest/CopyRestTestsTask.java

+24-5
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929
import org.gradle.api.tasks.SkipWhenEmpty;
3030
import org.gradle.api.tasks.TaskAction;
3131
import org.gradle.api.tasks.util.PatternFilterable;
32-
import org.gradle.api.tasks.util.PatternSet;
33-
import org.gradle.internal.Factory;
32+
import org.gradle.api.tasks.util.internal.PatternSetFactory;
3433

3534
import java.io.File;
3635
import java.util.Map;
@@ -72,19 +71,39 @@ public abstract class CopyRestTestsTask extends DefaultTask {
7271
@Inject
7372
public CopyRestTestsTask(
7473
ProjectLayout projectLayout,
75-
Factory<PatternSet> patternSetFactory,
74+
PatternSetFactory patternSetFactory,
7675
FileSystemOperations fileSystemOperations,
7776
ObjectFactory objectFactory
7877
) {
7978
this.includeCore = objectFactory.listProperty(String.class);
8079
this.includeXpack = objectFactory.listProperty(String.class);
8180
this.outputResourceDir = objectFactory.directoryProperty();
82-
this.corePatternSet = patternSetFactory.create();
83-
this.xpackPatternSet = patternSetFactory.create();
81+
this.corePatternSet = patternSetFactory.createPatternSet();
82+
this.xpackPatternSet = patternSetFactory.createPatternSet();
8483
this.projectLayout = projectLayout;
8584
this.fileSystemOperations = fileSystemOperations;
8685
}
8786

87+
@Inject
88+
protected ProjectLayout getProjectLayout() {
89+
throw new UnsupportedOperationException();
90+
}
91+
92+
@Inject
93+
protected FileSystemOperations getFileSystemOperations() {
94+
throw new UnsupportedOperationException();
95+
}
96+
97+
@Inject
98+
protected ObjectFactory getObjectFactory() {
99+
throw new UnsupportedOperationException();
100+
}
101+
102+
@Inject
103+
protected PatternSetFactory getPatternSetFactory() {
104+
throw new UnsupportedOperationException();
105+
}
106+
88107
@Input
89108
public ListProperty<String> getIncludeCore() {
90109
return includeCore;

build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/test/rest/compat/compat/RestCompatTestTransformTask.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
import org.gradle.api.tasks.TaskAction;
5959
import org.gradle.api.tasks.util.PatternFilterable;
6060
import org.gradle.api.tasks.util.PatternSet;
61-
import org.gradle.internal.Factory;
61+
import org.gradle.api.tasks.util.internal.PatternSetFactory;
6262

6363
import java.io.File;
6464
import java.io.IOException;
@@ -99,7 +99,7 @@ public abstract class RestCompatTestTransformTask extends DefaultTask {
9999
private final Map<PatternFilterable, List<Pair<String, String>>> skippedTestByTestNameTransformations = new HashMap<>();
100100

101101
@Inject
102-
protected Factory<PatternSet> getPatternSetFactory() {
102+
protected PatternSetFactory getPatternSetFactory() {
103103
throw new UnsupportedOperationException();
104104
}
105105

@@ -109,7 +109,7 @@ public RestCompatTestTransformTask(FileSystemOperations fileSystemOperations, Ob
109109
this.compatibleVersion = Version.fromString(VersionProperties.getVersions().get("elasticsearch")).getMajor() - 1;
110110
this.sourceDirectory = objectFactory.directoryProperty();
111111
this.outputDirectory = objectFactory.directoryProperty();
112-
this.testPatternSet = getPatternSetFactory().create();
112+
this.testPatternSet = getPatternSetFactory().createPatternSet();
113113
this.testPatternSet.include("/*" + "*/*.yml"); // concat these strings to keep build from thinking this is invalid javadoc
114114
// always inject compat headers
115115
headers.put("Content-Type", "application/vnd.elasticsearch+json;compatible-with=" + compatibleVersion);
@@ -144,7 +144,7 @@ public void skipTest(String fullTestName, String reason) {
144144
);
145145
}
146146

147-
PatternSet skippedPatternSet = getPatternSetFactory().create();
147+
PatternSet skippedPatternSet = getPatternSetFactory().createPatternSet();
148148
// create file patterns for all a1/a2/a3/b.yml possibilities.
149149
for (int i = testParts.length - 1; i > 1; i--) {
150150
final String lastPart = testParts[i];
@@ -158,7 +158,7 @@ public void skipTest(String fullTestName, String reason) {
158158
}
159159

160160
public void skipTestsByFilePattern(String filePattern, String reason) {
161-
PatternSet skippedPatternSet = getPatternSetFactory().create();
161+
PatternSet skippedPatternSet = getPatternSetFactory().createPatternSet();
162162
skippedPatternSet.include(filePattern);
163163
skippedTestByFilePatternTransformations.put(skippedPatternSet, reason);
164164
}

0 commit comments

Comments
 (0)