Commit b8c415cb authored by Emmanuel Bourg's avatar Emmanuel Bourg

New upstream version 4.4.1

parent 1f2273f0
......@@ -15,8 +15,11 @@
*/
import org.gradle.build.Install
import org.gradle.build.DefaultJavaInstallation
import org.gradle.cleanup.EmptyDirectoryCheck
import org.gradle.jvm.toolchain.internal.JavaInstallationProbe
defaultTasks 'assemble'
apply plugin: 'java-base'
apply plugin: 'build-types'
......@@ -287,9 +290,29 @@ task patchExternalModules(type: PatchExternalModules) {
task verifyIsProductionBuildEnvironment {
doLast {
assert javaVersion.java7: "Must use a Java 7 compatible JVM to perform this build. Current JVM is ${jvm}"
assert javaVersion.java8:
"Must use a Java 8 compatible JVM to perform this build. Current JVM is ${jvm}"
def javaHomeProperty = { propertyName -> project.findProperty(propertyName) ?: System.getProperty(propertyName) }
def assertJavaHomeVersion = { propertyName, javaVersion ->
def javaInstallationPath = javaHomeProperty(propertyName)
assert javaInstallationPath:
"Must set $propertyName to the path of a Java $javaVersion compatible JVM to perform this build. " +
"Currently unset. Set -P$propertyName=/path/to/jvm/$javaVersion"
def javaInstallation = new DefaultJavaInstallation()
gradle.services.get(JavaInstallationProbe).checkJdk(file(javaInstallationPath)).configure(javaInstallation)
assert javaInstallation.javaVersion == javaVersion:
"Must set $propertyName to the path of a Java $javaVersion compatible JVM to perform this build. " +
"Is currently ${javaInstallation.displayName} at $javaInstallationPath. Set -P$propertyName=/path/to/jvm/$javaVersion"
}
assertJavaHomeVersion("java7Home", JavaVersion.VERSION_1_7)
if (javaHomeProperty("testJavaHome")) {
assertJavaHomeVersion("testJavaHome", JavaVersion.VERSION_1_8)
}
def systemCharset = java.nio.charset.Charset.defaultCharset().name()
assert systemCharset == "UTF-8": "Platform encoding must be UTF-8. Is currently $systemCharset. Set -Dfile.encoding=UTF-8."
assert systemCharset == "UTF-8": "Platform encoding must be UTF-8. Is currently $systemCharset. Set -Dfile.encoding=UTF-8"
}
}
......
......@@ -7,7 +7,7 @@ if (!hasProperty('java7Home')) {
// possible to set compilation with Java 7 from the command line and from gradle.properties.
// Note that is this needs to work for buildSrc, too. Gradle properties passed
// on the command line (-P) are not inherited to buildSrc while system properties are.
ext.java7Home = System.getProperty('java7.home')
ext.java7Home = System.getProperty('java7Home')
}
def javaInstallationProbe = gradle.services.get(JavaInstallationProbe)
......
......@@ -19,7 +19,7 @@ ext {
libraries = [:]
}
versions.gradle_kotlin_dsl = '0.13.1'
versions.gradle_kotlin_dsl = '0.13.2'
versions.commons_io = 'commons-io:commons-io:2.2'
......
import org.gradle.build.ClasspathManifest
import org.gradle.build.DefaultJavaInstallation
import org.gradle.testing.DistributionTest
import org.gradle.internal.jvm.Jvm
import org.gradle.jvm.toolchain.internal.JavaInstallationProbe
import java.util.jar.Attributes
apply plugin: 'groovy'
......@@ -9,14 +13,29 @@ archivesBaseName = "gradle-${name.replaceAll("\\p{Upper}") { "-${it.toLowerCase(
sourceCompatibility = 1.7
def javaInstallationProbe = gradle.services.get(JavaInstallationProbe)
ext {
compileTasks = tasks.matching { it instanceof JavaCompile || it instanceof GroovyCompile }
testTasks = tasks.withType(Test)
javaInstallationForTest = new DefaultJavaInstallation()
generatedResourcesDir = file("$buildDir/generated-resources/main")
generatedTestResourcesDir = file("$buildDir/generated-resources/test")
jarTasks = tasks.withType(Jar)
}
if(!hasProperty("testJavaHome")) {
ext.testJavaHome = System.getProperty("testJavaHome")
}
if (testJavaHome) {
def testJavaHomeFile = new File(testJavaHome)
javaInstallationForTest.javaHome = testJavaHomeFile
javaInstallationProbe.checkJdk(testJavaHomeFile).configure(javaInstallationForTest)
} else {
javaInstallationForTest.javaHome = jvm.javaHome
javaInstallationProbe.current(javaInstallationForTest)
}
dependencies {
testCompile libraries.junit, libraries.jmock, libraries.spock, libraries.groovy
}
......@@ -49,12 +68,15 @@ testTasks.all { task ->
}
}
}
if (javaVersion.java7) {
executable = Jvm.forHome(javaInstallationForTest.javaHome).javaExecutable
environment['JAVA_HOME'] = javaInstallationForTest.javaHome.absolutePath
if (javaInstallationForTest.javaVersion.java7) {
// enable class unloading
task.jvmArgs '-XX:+UseConcMarkSweepGC', '-XX:+CMSClassUnloadingEnabled'
}
task.inputs.property('javaInstallation') {
currentJavaInstallation.displayName
// Includes JVM vendor and major version
javaInstallationForTest.displayName
}
doFirst {
if (isCiServer) {
......
......@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-rc-5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-bin.zip
{
"latestReleaseSnapshot": {
"buildTime": "20171107130851+0000",
"version": "4.3.1-20171107130851+0000"
"buildTime": "20171130161825+0000",
"version": "4.4-20171130161825+0000"
},
"latestRc": {
"buildTime": "20171026162557+0000",
"version": "4.3-rc-4"
"buildTime": "20171204084815+0000",
"version": "4.4-rc-6"
},
"finalReleases": [
{
"version": "4.3.1",
"buildTime": "20171108085945+0000"
"version": "4.4",
"buildTime": "20171206090506+0000"
},
{
"buildTime": "20171108085945+0000",
"version": "4.3.1"
},
{
"buildTime": "20171030154329+0000",
......@@ -217,4 +221,4 @@
"version": "0.7"
}
]
}
\ No newline at end of file
}
......@@ -33,6 +33,12 @@ public class DefaultModuleVersionSelector implements ModuleVersionSelector {
this.name = name;
this.moduleVersionConstraint = versionConstraint;
}
// DO NOT USE THIS CONSTRUCTOR DIRECTLY
// It's only there for backwards compatibility with the Nebula plugin
public DefaultModuleVersionSelector(String group, String name, String version) {
this(group, name, new DefaultMutableVersionConstraint(version));
}
public String getGroup() {
return group;
......
......@@ -24,6 +24,8 @@ import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
......@@ -81,8 +83,24 @@ class ImplementationDependencyRelocator extends Remapper {
}
public boolean keepOriginalResource(String resource) {
return resource == null || maybeRelocateResource(resource) == null
|| !resource.startsWith("com/sun/jna"); // in order to use a newer version of jna the resources must not be available in the old location
return resource == null
|| maybeRelocateResource(resource) == null
|| !mustBeRelocated(resource);
}
private final List<String> mustRelocateList = Arrays.asList(
// In order to use a newer version of jna the resources must not be available in the old location
"com/sun/jna",
// JGit properties work from their relocated locations and conflict if they are left in place.
"org/eclipse/jgit");
private final boolean mustBeRelocated(String resource) {
for (String mustRelocate : mustRelocateList) {
if (resource.startsWith(mustRelocate)) {
return true;
}
}
return false;
}
public ClassLiteralRemapping maybeRemap(String literal) {
......
......@@ -17,6 +17,8 @@
package org.gradle.plugin.devel.impldeps
import org.gradle.testfixtures.ProjectBuilder
import org.gradle.util.Requires
import org.gradle.util.TestPrecondition
import spock.lang.Issue
class GradleImplDepsShadingIssuesIntegrationTest extends BaseGradleImplDepsIntegrationTest {
......@@ -147,4 +149,33 @@ class GradleImplDepsShadingIssuesIntegrationTest extends BaseGradleImplDepsInteg
then:
succeeds 'test'
}
@Issue("https://github.com/gradle/gradle/issues/3780")
@Requires(TestPrecondition.JDK8_OR_LATER)
def "can use different JGit API"() {
when:
buildFile << testableGroovyProject()
buildFile << """
dependencies {
testCompile 'org.eclipse.jgit:org.eclipse.jgit:4.9.1.201712030800-r'
}
"""
file('src/test/groovy/JGitTest.groovy') << '''
import org.junit.Test
class JGitTest {
@Test
void loadJGitResources() {
assert org.eclipse.jgit.internal.JGitText.getPackage().getImplementationVersion() == "4.9.1.201712030800-r"
assert org.eclipse.jgit.internal.JGitText.get() != null
assert org.gradle.internal.impldep.org.eclipse.jgit.internal.JGitText.get() != null
}
}
'''.stripIndent()
then:
succeeds 'test'
}
}
......@@ -17,6 +17,7 @@
package org.gradle.smoketests
import spock.lang.Issue
import spock.lang.Unroll
class NebulaPluginsSmokeTest extends AbstractSmokeTest {
......@@ -123,4 +124,70 @@ testCompile('junit:junit:4.7')""")
then:
runner('buildEnvironment', 'generateLock').build()
}
@Issue("gradle/gradle#3798")
@Unroll
def "nebula dependency lock plugin version #version binary compatibility"() {
when:
buildFile << """
plugins {
id 'java-library'
id 'nebula.dependency-lock' version '$version'
}
repositories {
jcenter()
}
dependencies {
api 'org.apache.commons:commons-math3:3.6.1'
}
task resolve {
doFirst {
configurations.compileClasspath.each { println it.name }
}
}
"""
file('dependencies.lock') << '''{
"compileClasspath": {
"org.apache.commons:commons-math3": {
"locked": "3.6.1",
"requested": "3.6.1"
}
},
"default": {
"org.apache.commons:commons-math3": {
"locked": "3.6.1",
"requested": "3.6.1"
}
},
"runtimeClasspath": {
"org.apache.commons:commons-math3": {
"locked": "3.6.1",
"requested": "3.6.1"
}
},
"testCompileClasspath": {
"org.apache.commons:commons-math3": {
"locked": "3.6.1",
"requested": "3.6.1"
}
},
"testRuntimeClasspath": {
"org.apache.commons:commons-math3": {
"locked": "3.6.1",
"requested": "3.6.1"
}
}
}'''
then:
runner('dependencies').build()
runner('generateLock').build()
runner('resolve').build()
where:
version << ['4.9.5', '5.0.0']
}
}
4.4
\ No newline at end of file
4.4.1
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment