...
 
Commits (6)
......@@ -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"
}
}
......
gradle (4.4.1-1) unstable; urgency=medium
* Team upload.
* New upstream release
- Refreshed the patches
* Fixed the build failure with Java 11 (Closes: #909905)
* Depend on Java 9+
-- Emmanuel Bourg <ebourg@apache.org> Wed, 03 Oct 2018 15:53:14 +0200
gradle (4.4-3) unstable; urgency=medium
* Team upload.
......
......@@ -7,7 +7,7 @@ Build-Depends: ant,
bnd (>= 3.5.0),
debhelper (>= 11),
default-jdk-doc,
default-jdk (>= 2:1.8),
default-jdk (>= 2:1.9),
dh-exec,
gradle (>= 3.4),
groovy (>= 2.4.7),
......@@ -77,7 +77,7 @@ Homepage: https://gradle.org
Package: gradle
Architecture: all
Depends: default-jre-headless (>= 2:1.8) | java8-runtime-headless,
Depends: default-jre-headless (>= 2:1.9) | java9-runtime-headless,
libgradle-core-java (>= ${binary:Version}),
libgradle-plugins-java (>= ${binary:Version}),
${misc:Depends}
......
......@@ -19,7 +19,7 @@ Forwarded: not-needed
--- a/build.gradle
+++ b/build.gradle
@@ -220,7 +220,6 @@
@@ -223,7 +223,6 @@
apply from: "$rootDir/gradle/publish.gradle"
}
......
......@@ -14,7 +14,7 @@ AWS SDK for Java is not in Debian yet.
--- a/build.gradle
+++ b/build.gradle
@@ -150,7 +150,7 @@
@@ -153,7 +153,7 @@
'platformJvm', 'languageJvm', 'languageJava', 'languageGroovy', 'languageScala',
'platformNative', 'platformPlay', 'idePlay', 'languageNative', 'ideNative', 'testingBase',
'testingNative', 'testingJvm', 'pluginDevelopment', 'pluginUse', 'resourcesHttp',
......
......@@ -14,7 +14,7 @@ Forwarded: not-needed
include 'scala'
--- a/build.gradle
+++ b/build.gradle
@@ -150,7 +150,7 @@
@@ -153,7 +153,7 @@
'platformJvm', 'languageJvm', 'languageJava', 'languageGroovy', 'languageScala',
'platformNative', 'platformPlay', 'idePlay', 'languageNative', 'ideNative', 'testingBase',
'testingNative', 'testingJvm', 'pluginDevelopment', 'pluginUse', 'resourcesHttp',
......
......@@ -10,7 +10,7 @@ jmh-gradle-plugin is not in Debian yet
--- a/gradle/groovyProject.gradle
+++ b/gradle/groovyProject.gradle
@@ -102,9 +102,6 @@
@@ -124,9 +124,6 @@
apply from: "$rootDir/gradle/performanceTest.gradle"
}
......
......@@ -13,7 +13,7 @@ Forwarded: not-needed
--- a/build.gradle
+++ b/build.gradle
@@ -213,6 +213,7 @@
@@ -216,6 +216,7 @@
apply from: "$rootDir/gradle/java9.gradle"
check.dependsOn ":docs:checkstyleApi"
check.dependsOn "codeQuality"
......
......@@ -58,7 +58,7 @@ Forwarded: not-needed
testCompile 'org.hamcrest:hamcrest-core:1.3'
--- a/build.gradle
+++ b/build.gradle
@@ -172,7 +172,6 @@
@@ -175,7 +175,6 @@
}
apply from: "gradle/buildScanUserData.gradle"
......@@ -66,7 +66,7 @@ Forwarded: not-needed
apply from: "gradle/versioning.gradle"
apply from: "gradle/dependencies.gradle"
apply from: "gradle/wrapper.gradle"
@@ -194,13 +193,6 @@
@@ -197,13 +196,6 @@
maven { url 'file:///usr/share/maven-repo' }
maven { url "file://${rootDir}/debian/maven-repo" }
}
......
Description: Fixes the compatibility with Java 11. The patch can be removed after upgrading to the version 4.8
Origin: backport, https://github.com/gradle/gradle/commit/ac15612d41b43c39c8e39d12fdd6621589b0f782
https://github.com/gradle/gradle/commit/028548460bd929fd034a552704798ad7f689493a
https://github.com/gradle/gradle/commit/3db6e256987053171178aa96a0ef46caedc8d1a4
--- a/subprojects/base-services/src/main/java/org/gradle/api/JavaVersion.java
+++ b/subprojects/base-services/src/main/java/org/gradle/api/JavaVersion.java
@@ -26,7 +26,7 @@
public enum JavaVersion {
VERSION_1_1(false), VERSION_1_2(false), VERSION_1_3(false), VERSION_1_4(false),
// starting from here versions are 1_ but their official name is "Java 6", "Java 7", ...
- VERSION_1_5(true), VERSION_1_6(true), VERSION_1_7(true), VERSION_1_8(true), VERSION_1_9(true), VERSION_1_10(true);
+ VERSION_1_5(true), VERSION_1_6(true), VERSION_1_7(true), VERSION_1_8(true), VERSION_1_9(true), VERSION_1_10(true), VERSION_1_11(true);
private static JavaVersion currentJavaVersion;
private final boolean hasMajorVersion;
private final String versionName;
--- a/subprojects/base-services/src/main/java/org/gradle/internal/classloader/ClassLoaderUtils.java
+++ b/subprojects/base-services/src/main/java/org/gradle/internal/classloader/ClassLoaderUtils.java
@@ -24,6 +24,9 @@
import javax.annotation.Nullable;
import java.io.IOException;
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
import java.lang.reflect.Field;
import java.net.MalformedURLException;
import java.net.URL;
@@ -31,16 +34,15 @@
public abstract class ClassLoaderUtils {
- private static final Unsafe UNSAFE;
+ private static MethodHandle defineClassMethodHandle;
static {
try {
- Field theUnsafe = Unsafe.class.getDeclaredField("theUnsafe");
- theUnsafe.setAccessible(true);
- UNSAFE = (Unsafe) theUnsafe.get(null);
- } catch (NoSuchFieldException e) {
- throw new RuntimeException(e);
- } catch (IllegalAccessException e) {
+ MethodHandles.Lookup baseLookup = MethodHandles.lookup();
+ MethodType defineClassMethodType = MethodType.methodType(Class.class, new Class[]{String.class, byte[].class, int.class, int.class});
+ MethodHandles.Lookup lookup = MethodHandles.privateLookupIn(ClassLoader.class, baseLookup);
+ defineClassMethodHandle = lookup.findVirtual(ClassLoader.class, "defineClass", defineClassMethodType);
+ } catch (Throwable e) {
throw new RuntimeException(e);
}
}
@@ -101,6 +103,10 @@
}
public static <T> Class<T> define(ClassLoader targetClassLoader, String className, byte[] clazzBytes) {
- return Cast.uncheckedCast(UNSAFE.defineClass(className, clazzBytes, 0, clazzBytes.length, targetClassLoader, null));
+ try {
+ return (Class) defineClassMethodHandle.bindTo(targetClassLoader).invokeWithArguments(className, clazzBytes, 0, clazzBytes.length);
+ } catch (Throwable e) {
+ throw new RuntimeException(e);
+ }
}
}
......@@ -24,3 +24,4 @@ disable-binary-compatibility.patch
gradle-4-compatibility.patch
disable-google-apis.patch
disable-internal-android-performance-testing.patch
java11-compatibility.patch
......@@ -21,7 +21,7 @@ Forwarded: not-needed
--- a/build.gradle
+++ b/build.gradle
@@ -191,9 +191,8 @@
@@ -194,9 +194,8 @@
group = 'org.gradle'
repositories {
......
......@@ -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