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

Commit 06b5859

Browse files
committed
Merge branch 'gradle' into develop
# Conflicts: # build.gradle # gradle/wrapper/gradle-wrapper.jar # gradle/wrapper/gradle-wrapper.properties # gradlew # src/test/internal-testing/src/main/groovy/org/gradle/test/fixtures/archive/JarTestFixture.groovy # src/test/internal-testing/src/main/groovy/org/gradle/test/fixtures/file/AbstractTestDirectoryProvider.java # src/test/internal-testing/src/main/groovy/org/gradle/test/fixtures/file/TestFile.java
2 parents 761af07 + 2cb49f5 commit 06b5859

30 files changed

+889
-221
lines changed

build.gradle

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

1818
ext {
19-
gradleVersions = '3.0,3.1,3.2,3.2.1,3.3'
19+
gradleVersions = '4.0'
2020
androidGradleBuildVersion = '2.2.0-beta1'
2121
androidCompileSdkVersion = 'android-24'
2222
androidBuildToolsVersion = '24.0.0'
@@ -101,7 +101,7 @@ dependencies {
101101

102102
testCompile 'junit:junit:4.12',
103103
'org.hamcrest:hamcrest-all:1.3',
104-
'org.codehaus.groovy:groovy-all:2.4.7'
104+
'org.codehaus.groovy:groovy-all:2.4.11'
105105

106106
// from gradle/subprojects/core/core.gradle, gradle/subprojects/internal-testing/internal-testing.gradle and gradle/gradle/dependencies.gradle
107107
testCompile 'commons-io:commons-io:2.2',
@@ -214,7 +214,7 @@ jacocoTestReport {
214214
reports {
215215
xml.enabled true
216216
html.enabled true
217-
html.destination "${buildDir}/jacocoHtml"
217+
html.destination file("${buildDir}/jacocoHtml")
218218
}
219219
}
220220

@@ -223,7 +223,7 @@ jacocoTestReport.dependsOn test
223223
check.dependsOn jacocoTestReport
224224

225225
task wrapper(type: Wrapper) {
226-
gradleVersion = '3.3'
226+
gradleVersion = '4.0'
227227
distributionUrl = "https://services.gradle.org/distributions/gradle-${gradleVersion}-all.zip"
228228
}
229229

gradle/wrapper/gradle-wrapper.jar

498 Bytes
Binary file not shown.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Tue Jan 03 21:54:54 EST 2017
1+
#Tue Jul 04 23:29:18 EDT 2017
22
distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip

gradlew

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS=""
3333
# Use the maximum available, or set MAX_FD != -1 to use that value.
3434
MAX_FD="maximum"
3535

36-
warn ( ) {
36+
warn () {
3737
echo "$*"
3838
}
3939

40-
die ( ) {
40+
die () {
4141
echo
4242
echo "$*"
4343
echo
@@ -155,7 +155,7 @@ if $cygwin ; then
155155
fi
156156

157157
# Escape application args
158-
save ( ) {
158+
save () {
159159
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160160
echo " "
161161
}

src/main/java/org/gradle/api/plugins/AndroidMavenPlugin.java

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
import org.gradle.api.artifacts.maven.Conf2ScopeMappingContainer;
2828
import org.gradle.api.artifacts.maven.MavenPom;
2929
import org.gradle.api.artifacts.maven.MavenResolver;
30-
import org.gradle.api.internal.artifacts.DefaultModuleVersionIdentifier;
30+
import org.gradle.api.internal.artifacts.ImmutableModuleIdentifierFactory;
3131
import org.gradle.api.internal.artifacts.Module;
3232
import org.gradle.api.internal.artifacts.configurations.ConfigurationInternal;
3333
import org.gradle.api.internal.artifacts.dsl.DefaultRepositoryHandler;
@@ -69,19 +69,22 @@ public class AndroidMavenPlugin implements Plugin<ProjectInternal> {
6969
private final ProjectConfigurationActionContainer configurationActionContainer;
7070
private final MavenSettingsProvider mavenSettingsProvider;
7171
private final LocalMavenRepositoryLocator mavenRepositoryLocator;
72+
private final ImmutableModuleIdentifierFactory moduleIdentifierFactory;
7273

7374
private Project project;
7475

7576
@Inject
7677
public AndroidMavenPlugin(Factory<LoggingManagerInternal> loggingManagerFactory, FileResolver fileResolver,
7778
ProjectPublicationRegistry publicationRegistry, ProjectConfigurationActionContainer configurationActionContainer,
78-
MavenSettingsProvider mavenSettingsProvider, LocalMavenRepositoryLocator mavenRepositoryLocator) {
79+
MavenSettingsProvider mavenSettingsProvider, LocalMavenRepositoryLocator mavenRepositoryLocator,
80+
ImmutableModuleIdentifierFactory moduleIdentifierFactory) {
7981
this.loggingManagerFactory = loggingManagerFactory;
8082
this.fileResolver = fileResolver;
8183
this.publicationRegistry = publicationRegistry;
8284
this.configurationActionContainer = configurationActionContainer;
8385
this.mavenSettingsProvider = mavenSettingsProvider;
8486
this.mavenRepositoryLocator = mavenRepositoryLocator;
87+
this.moduleIdentifierFactory = moduleIdentifierFactory;
8588
}
8689

8790
public void apply(final ProjectInternal project) {
@@ -142,6 +145,12 @@ public void execute(WarPlugin warPlugin) {
142145
configureWarScopeMappings(project.getConfigurations(), pluginConvention.getConf2ScopeMappings());
143146
}
144147
});
148+
plugins.withType(JavaLibraryPlugin.class, new Action<JavaLibraryPlugin>() {
149+
@Override
150+
public void execute(JavaLibraryPlugin javaLibraryPlugin) {
151+
configureJavaLibraryScopeMappings(project.getConfigurations(), pluginConvention.getConf2ScopeMappings());
152+
}
153+
});
145154
}
146155

147156
private void configureUploadTasks(final DefaultDeployerFactory deployerFactory) {
@@ -167,7 +176,7 @@ public void execute(Project project) {
167176
Module module = configuration.getModule();
168177
for (MavenResolver resolver : uploadArchives.getRepositories().withType(MavenResolver.class)) {
169178
MavenPom pom = resolver.getPom();
170-
ModuleVersionIdentifier publicationId = new DefaultModuleVersionIdentifier(
179+
ModuleVersionIdentifier publicationId = moduleIdentifierFactory.moduleWithVersion(
171180
pom.getGroupId().equals(MavenProject.EMPTY_PROJECT_GROUP_ID) ? module.getGroup() : pom.getGroupId(),
172181
pom.getArtifactId().equals(MavenProject.EMPTY_PROJECT_ARTIFACT_ID) ? module.getName() : pom.getArtifactId(),
173182
pom.getVersion().equals(MavenProject.EMPTY_PROJECT_VERSION) ? module.getVersion() : pom.getVersion()
@@ -195,10 +204,19 @@ private void configureJavaScopeMappings(ConfigurationContainer configurations, C
195204
Conf2ScopeMappingContainer.COMPILE);
196205
mavenScopeMappings.addMapping(RUNTIME_PRIORITY, configurations.getByName(JavaPlugin.RUNTIME_CONFIGURATION_NAME),
197206
Conf2ScopeMappingContainer.RUNTIME);
207+
mavenScopeMappings.addMapping(RUNTIME_PRIORITY, configurations.getByName(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME),
208+
Conf2ScopeMappingContainer.RUNTIME);
198209
mavenScopeMappings.addMapping(TEST_COMPILE_PRIORITY, configurations.getByName(JavaPlugin.TEST_COMPILE_CONFIGURATION_NAME),
199210
Conf2ScopeMappingContainer.TEST);
200211
mavenScopeMappings.addMapping(TEST_RUNTIME_PRIORITY, configurations.getByName(JavaPlugin.TEST_RUNTIME_CONFIGURATION_NAME),
201212
Conf2ScopeMappingContainer.TEST);
213+
mavenScopeMappings.addMapping(TEST_RUNTIME_PRIORITY, configurations.getByName(JavaPlugin.TEST_IMPLEMENTATION_CONFIGURATION_NAME),
214+
Conf2ScopeMappingContainer.TEST);
215+
}
216+
217+
private void configureJavaLibraryScopeMappings(ConfigurationContainer configurations, Conf2ScopeMappingContainer mavenScopeMappings) {
218+
mavenScopeMappings.addMapping(COMPILE_PRIORITY, configurations.getByName(JavaPlugin.API_CONFIGURATION_NAME),
219+
Conf2ScopeMappingContainer.COMPILE);
202220
}
203221

204222
private void configureWarScopeMappings(ConfigurationContainer configurations, Conf2ScopeMappingContainer mavenScopeMappings) {
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* Copyright 2017 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.gradle.api.internal.cache;
18+
19+
import org.gradle.api.internal.file.TestFiles;
20+
import org.gradle.internal.serialize.Serializer;
21+
22+
import java.io.File;
23+
24+
public class TestFileContentCacheFactory implements FileContentCacheFactory {
25+
@Override
26+
public <V> FileContentCache<V> newCache(String name, int normalizedCacheSize, final Calculator<? extends V> calculator, Serializer<V> serializer) {
27+
return new FileContentCache<V>() {
28+
@Override
29+
public V get(File file) {
30+
return calculator.calculate(file, TestFiles.fileSystem().stat(file).getType());
31+
}
32+
};
33+
}
34+
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
import org.gradle.api.tasks.util.internal.PatternSets;
2222
import org.gradle.internal.Factory;
2323
import org.gradle.internal.nativeintegration.filesystem.FileSystem;
24+
import org.gradle.internal.resource.local.FileResourceConnector;
25+
import org.gradle.internal.resource.local.FileResourceRepository;
2426
import org.gradle.process.internal.DefaultExecActionFactory;
2527
import org.gradle.process.internal.ExecActionFactory;
2628
import org.gradle.process.internal.ExecHandleFactory;
@@ -41,6 +43,10 @@ public static FileSystem fileSystem() {
4143
return FILE_SYSTEM;
4244
}
4345

46+
public static FileResourceRepository fileRepository() {
47+
return new FileResourceConnector(FILE_SYSTEM);
48+
}
49+
4450
/**
4551
* Returns a resolver with no base directory.
4652
*/

src/test/core/src/testFixtures/groovy/org/gradle/api/tasks/AbstractTaskTest.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,15 @@ public abstract class AbstractTaskTest extends AbstractProjectBuilderSpec {
131131
getTask().getActions().add(Actions.doNothing())
132132

133133
then:
134-
2 == getTask().getActions().size()
134+
getTask().getActions().size() == 2
135135

136136
when:
137137
List<Action<? super Task>> actions = Lists.newArrayList()
138138
actions.add(Actions.doNothing())
139139
getTask().setActions(actions)
140140

141141
then:
142-
1 == getTask().getActions().size()
142+
getTask().getActions().size() == 1
143143
}
144144

145145
def "addAction with null throws"() {

0 commit comments

Comments
 (0)