Skip to content
This repository was archived by the owner on Jan 25, 2021. It is now read-only.

Commit ac5a066

Browse files
committed
Merge branch 'gradle' into develop
# Conflicts: # build.gradle
2 parents d4c1a63 + 23706e2 commit ac5a066

File tree

19 files changed

+334
-72
lines changed

19 files changed

+334
-72
lines changed

build.gradle

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ repositories {
1616
}
1717

1818
ext {
19-
gradleVersions = '4.0'
2019
androidGradleBuildVersion = '3.0.0-alpha1'
20+
gradleVersions = '4.1'
2121
androidCompileSdkVersion = 'android-26'
2222
androidBuildToolsVersion = '26.0.0'
2323
}
@@ -47,15 +47,21 @@ task createClasspathManifest {
4747
}
4848
}
4949

50+
ext {
51+
versions = [:]
52+
}
53+
54+
versions.maven = "3.0.4"
55+
5056
dependencies {
5157
jacocoRuntime "org.jacoco:org.jacoco.agent:${jacoco.toolVersion}:runtime"
5258

5359
compile gradleApi()
5460

5561
// from gradle/gradle/dependencies.gradle
56-
compileOnly dependencies.module("org.apache.maven:maven-core:3.0.4") {
57-
dependency "org.apache.maven:maven-settings:3.0.4@jar"
58-
dependency "org.apache.maven:maven-settings-builder:3.0.4@jar"
62+
compileOnly dependencies.module("org.apache.maven:maven-core:${versions.maven}") {
63+
dependency "org.apache.maven:maven-settings:${versions.maven}@jar"
64+
dependency "org.apache.maven:maven-settings-builder:${versions.maven}@jar"
5965

6066
//plexus:
6167
dependency "org.codehaus.plexus:plexus-utils:2.0.6@jar"
@@ -69,16 +75,16 @@ dependencies {
6975
dependency "org.sonatype.plexus:plexus-sec-dispatcher:1.3@jar"
7076

7177
//core:
72-
dependency "org.apache.maven:maven-core:3.0.4@jar"
73-
dependency "org.apache.maven:maven-compat:3.0.4@jar"
74-
dependency "org.apache.maven:maven-model-builder:3.0.4@jar"
75-
dependency "org.apache.maven:maven-model:3.0.4@jar"
78+
dependency "org.apache.maven:maven-core:${versions.maven}@jar"
79+
dependency "org.apache.maven:maven-compat:${versions.maven}@jar"
80+
dependency "org.apache.maven:maven-model-builder:${versions.maven}@jar"
81+
dependency "org.apache.maven:maven-model:${versions.maven}@jar"
7682

7783
//somewhat core:
78-
dependency "org.apache.maven:maven-artifact:3.0.4@jar"
79-
dependency "org.apache.maven:maven-repository-metadata:3.0.4@jar"
80-
dependency "org.apache.maven:maven-plugin-api:3.0.4@jar"
81-
dependency "org.apache.maven:maven-aether-provider:3.0.4@jar"
84+
dependency "org.apache.maven:maven-artifact:${versions.maven}@jar"
85+
dependency "org.apache.maven:maven-repository-metadata:${versions.maven}@jar"
86+
dependency "org.apache.maven:maven-plugin-api:${versions.maven}@jar"
87+
dependency "org.apache.maven:maven-aether-provider:${versions.maven}@jar"
8288

8389
dependency 'org.apache.maven.wagon:wagon-file:2.4@jar'
8490
dependency 'org.apache.maven.wagon:wagon-http:2.4@jar'
@@ -223,7 +229,7 @@ jacocoTestReport.dependsOn test
223229
check.dependsOn jacocoTestReport
224230

225231
task wrapper(type: Wrapper) {
226-
gradleVersion = '4.0'
232+
gradleVersion = '4.1'
227233
distributionUrl = "https://services.gradle.org/distributions/gradle-${gradleVersion}-all.zip"
228234
}
229235

gradle/wrapper/gradle-wrapper.jar

2 Bytes
Binary file not shown.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#Tue Jul 04 23:29:18 EDT 2017
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
43
zipStoreBase=GRADLE_USER_HOME
54
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

src/test/core/src/testFixtures/groovy/org/gradle/api/internal/file/TestFiles.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,4 +96,8 @@ public static JavaExecHandleFactory javaExecHandleFactory(File baseDir) {
9696
public static Factory<PatternSet> getPatternSetFactory() {
9797
return resolver().getPatternSetFactory();
9898
}
99+
100+
public static String systemSpecificAbsolutePath(String path) {
101+
return new File(path).getAbsolutePath();
102+
}
99103
}

src/test/core/src/testFixtures/groovy/org/gradle/internal/operations/TestBuildOperationExecutor.java

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@
1717
package org.gradle.internal.operations;
1818

1919
import com.google.common.base.Function;
20+
import com.google.common.base.Predicate;
2021
import com.google.common.collect.ImmutableList;
22+
import com.google.common.collect.Iterables;
2123
import com.google.common.collect.Lists;
22-
import com.google.common.reflect.TypeToken;
2324
import org.gradle.api.Action;
24-
import org.gradle.api.Nullable;
25-
import org.gradle.internal.Cast;
2625
import org.gradle.internal.UncheckedException;
2726
import org.gradle.internal.logging.events.OperationIdentifier;
2827
import org.gradle.internal.progress.BuildOperationDescriptor;
2928
import org.gradle.internal.progress.BuildOperationState;
3029

30+
import javax.annotation.Nullable;
3131
import java.util.ArrayList;
3232
import java.util.List;
3333
import java.util.concurrent.CopyOnWriteArrayList;
@@ -84,9 +84,11 @@ private static class TestBuildOperationContext implements BuildOperationContext
8484

8585
private Object result;
8686
private String status;
87+
private Throwable failure;
8788

8889
@Override
8990
public void failed(@Nullable Throwable failure) {
91+
this.failure = failure;
9092
}
9193

9294
@Override
@@ -146,7 +148,7 @@ public BuildOperationDescriptor apply(@javax.annotation.Nullable Record input) {
146148
}
147149

148150
private <D, R, T extends BuildOperationType<D, R>> Record mostRecent(Class<T> type) {
149-
Class<D> detailsType = extractDetailsType(type);
151+
Class<D> detailsType = BuildOperationTypes.detailsType(type);
150152
ImmutableList<Record> copy = ImmutableList.copyOf(this.records).reverse();
151153
for (Record record : copy) {
152154
Object details = record.descriptor.getDetails();
@@ -158,15 +160,25 @@ private <D, R, T extends BuildOperationType<D, R>> Record mostRecent(Class<T> ty
158160
throw new AssertionError("Did not find operation with details of type: " + detailsType.getName());
159161
}
160162

163+
public <D, R, T extends BuildOperationType<D, R>> List<Record> all(Class<T> type) {
164+
final Class<D> detailsType = BuildOperationTypes.detailsType(type);
165+
return ImmutableList.copyOf(Iterables.filter(records, new Predicate<Record>() {
166+
@Override
167+
public boolean apply(Record input) {
168+
return detailsType.isInstance(input.descriptor.getDetails());
169+
}
170+
}));
171+
}
172+
161173
public <R, D, T extends BuildOperationType<D, R>> D mostRecentDetails(Class<T> type) {
162-
return extractDetailsType(type).cast(mostRecent(type).descriptor.getDetails());
174+
Class<D> detailsType = BuildOperationTypes.detailsType(type);
175+
return detailsType.cast(mostRecent(type).descriptor.getDetails());
163176
}
164177

165178
public <R, D, T extends BuildOperationType<D, R>> R mostRecentResult(Class<T> type) {
166179
Record record = mostRecent(type);
167180
Object result = record.result;
168-
169-
Class<R> resultType = extractResultType(type);
181+
Class<R> resultType = BuildOperationTypes.resultType(type);
170182
if (resultType.isInstance(result)) {
171183
return resultType.cast(result);
172184
} else {
@@ -178,16 +190,6 @@ public <D, R, T extends BuildOperationType<D, R>> Throwable mostRecentFailure(Cl
178190
return mostRecent(type).failure;
179191
}
180192

181-
private static <D, R, T extends BuildOperationType<D, R>> Class<R> extractResultType(Class<T> type) {
182-
return Cast.uncheckedCast(new TypeToken<R>(type) {
183-
}.getRawType());
184-
}
185-
186-
private static <D, T extends BuildOperationType<D, ?>> Class<D> extractDetailsType(Class<T> type) {
187-
return Cast.uncheckedCast(new TypeToken<D>(type) {
188-
}.getRawType());
189-
}
190-
191193
private static class Record {
192194

193195
public final BuildOperationDescriptor descriptor;
@@ -199,6 +201,10 @@ private Record(BuildOperationDescriptor descriptor) {
199201
this.descriptor = descriptor;
200202
}
201203

204+
@Override
205+
public String toString() {
206+
return descriptor.getDisplayName();
207+
}
202208
}
203209

204210
private void run(RunnableBuildOperation buildOperation) {
@@ -208,7 +214,9 @@ private void run(RunnableBuildOperation buildOperation) {
208214
try {
209215
buildOperation.run(context);
210216
} catch (Throwable failure) {
211-
record.failure = failure;
217+
if (record.failure == null) {
218+
record.failure = failure;
219+
}
212220
throw UncheckedException.throwAsUncheckedException(failure);
213221
}
214222
record.result = context.result;
@@ -222,7 +230,9 @@ private <T> T call(CallableBuildOperation<T> buildOperation) {
222230
try {
223231
t = buildOperation.call(context);
224232
} catch (Throwable failure) {
225-
record.failure = failure;
233+
if (record.failure == null) {
234+
record.failure = failure;
235+
}
226236
throw UncheckedException.throwAsUncheckedException(failure);
227237
}
228238
record.result = context.result;

src/test/internal-testing/src/main/groovy/org/gradle/integtests/fixtures/DefaultTestExecutionResult.groovy

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ class DefaultTestExecutionResult implements TestExecutionResult {
4646
new DefaultTestClassExecutionResult(results.collect {it.testClass(testClass)});
4747
}
4848

49+
TestClassExecutionResult testClassStartsWith(String testClass) {
50+
new DefaultTestClassExecutionResult(results.collect { it.testClassStartsWith(testClass) })
51+
}
52+
4953
private class DefaultTestClassExecutionResult implements TestClassExecutionResult {
5054
def testClassResults
5155

src/test/internal-testing/src/main/groovy/org/gradle/integtests/fixtures/HtmlTestExecutionResult.groovy

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ class HtmlTestExecutionResult implements TestExecutionResult {
5050
}
5151

5252
TestClassExecutionResult testClass(String testClass) {
53-
return new HtmlTestClassExecutionResult(new File(htmlReportDirectory, "classes/${FileUtils.toSafeFileName(testClass)}.html"));
53+
return new HtmlTestClassExecutionResult(new File(htmlReportDirectory, "classes/${FileUtils.toSafeFileName(testClass)}.html"))
54+
}
55+
56+
TestClassExecutionResult testClassStartsWith(String testClass) {
57+
return new HtmlTestClassExecutionResult(new File(htmlReportDirectory, "classes").listFiles().find { it.name.startsWith(FileUtils.toSafeFileName(testClass)) })
5458
}
5559

5660
private static class HtmlTestClassExecutionResult implements TestClassExecutionResult {

src/test/internal-testing/src/main/groovy/org/gradle/integtests/fixtures/JUnitXmlTestExecutionResult.groovy

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package org.gradle.integtests.fixtures
1818
import org.gradle.test.fixtures.file.TestFile
1919

2020
import static org.hamcrest.Matchers.*
21+
import static org.hamcrest.core.StringStartsWith.startsWith
2122
import static org.junit.Assert.assertThat
2223

2324
class JUnitXmlTestExecutionResult implements TestExecutionResult {
@@ -54,6 +55,11 @@ class JUnitXmlTestExecutionResult implements TestExecutionResult {
5455
return new JUnitTestClassExecutionResult(findTestClass(testClass), testClass, outputAssociation)
5556
}
5657

58+
TestClassExecutionResult testClassStartsWith(String testClass) {
59+
def matching = findTestClassStartsWith(testClass)
60+
return new JUnitTestClassExecutionResult(matching[1], matching[0], outputAssociation)
61+
}
62+
5763
private def findTestClass(String testClass) {
5864
def classes = findClasses()
5965
assertThat(classes.keySet(), hasItem(testClass))
@@ -62,6 +68,15 @@ class JUnitXmlTestExecutionResult implements TestExecutionResult {
6268
return new XmlSlurper().parse(classFile)
6369
}
6470

71+
private def findTestClassStartsWith(String testClass) {
72+
def classes = findClasses()
73+
assertThat(classes.keySet(), hasItem(startsWith(testClass)))
74+
def classEntry = classes.find { it.key.startsWith(testClass) }
75+
def classFile = classEntry.value
76+
assertThat(classFile, notNullValue())
77+
return [classEntry.key, new XmlSlurper().parse(classFile)]
78+
}
79+
6580
private def findClasses() {
6681
testResultsDir.assertIsDir()
6782

src/test/internal-testing/src/main/groovy/org/gradle/integtests/fixtures/TestExecutionResult.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,9 @@ public interface TestExecutionResult {
2626
* Returns the result for the given test class.
2727
*/
2828
TestClassExecutionResult testClass(String testClass);
29+
30+
/**
31+
* Returns the result for the first test class whose name starts with the given string.
32+
*/
33+
TestClassExecutionResult testClassStartsWith(String testClass);
2934
}

src/test/internal-testing/src/main/groovy/org/gradle/test/fixtures/ConcurrentTestUtil.groovy

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
package org.gradle.test.fixtures
1717

1818
import org.gradle.internal.concurrent.ExecutorFactory
19-
import org.gradle.internal.concurrent.StoppableExecutor
20-
import org.gradle.internal.concurrent.StoppableScheduledExecutor
19+
import org.gradle.internal.concurrent.ManagedExecutor
20+
import org.gradle.internal.concurrent.ManagedScheduledExecutor
2121
import org.junit.rules.ExternalResource
2222
import org.slf4j.Logger
2323
import org.slf4j.LoggerFactory
@@ -100,16 +100,16 @@ class ConcurrentTestUtil extends ExternalResource {
100100

101101
ExecutorFactory getExecutorFactory() {
102102
return new ExecutorFactory() {
103-
StoppableExecutor create(String displayName) {
104-
return new StoppableExecutorStub(ConcurrentTestUtil.this)
103+
ManagedExecutor create(String displayName) {
104+
return new ManagedExecutorStub(ConcurrentTestUtil.this)
105105
}
106106

107-
StoppableExecutor create(String displayName, int fixedSize) {
107+
ManagedExecutor create(String displayName, int fixedSize) {
108108
// Ignores size of thread pool
109-
return new StoppableExecutorStub(ConcurrentTestUtil.this)
109+
return new ManagedExecutorStub(ConcurrentTestUtil.this)
110110
}
111111

112-
StoppableScheduledExecutor createScheduled(String displayName, int fixedSize) {
112+
ManagedScheduledExecutor createScheduled(String displayName, int fixedSize) {
113113
throw new UnsupportedOperationException()
114114
}
115115
}
@@ -449,11 +449,11 @@ class CompositeTestParticipant extends AbstractTestParticipant {
449449
}
450450
}
451451

452-
class StoppableExecutorStub extends AbstractExecutorService implements StoppableExecutor {
452+
class ManagedExecutorStub extends AbstractExecutorService implements ManagedExecutor {
453453
final ConcurrentTestUtil owner
454454
final Set<TestThread> threads = new CopyOnWriteArraySet<TestThread>()
455455

456-
StoppableExecutorStub(ConcurrentTestUtil owner) {
456+
ManagedExecutorStub(ConcurrentTestUtil owner) {
457457
this.owner = owner
458458
}
459459

@@ -493,6 +493,11 @@ class StoppableExecutorStub extends AbstractExecutorService implements Stoppable
493493
boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
494494
throw new UnsupportedOperationException()
495495
}
496+
497+
@Override
498+
void setFixedPoolSize(int numThreads) {
499+
throw new UnsupportedOperationException()
500+
}
496501
}
497502

498503
class AbstractAsyncAction {

0 commit comments

Comments
 (0)