You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by su...@apache.org on 2016/11/10 15:14:21 UTC
[49/50] [abbrv] groovy git commit: Sync changes from master and clean
old files
http://git-wip-us.apache.org/repos/asf/groovy/blob/7efbf9ab/.travis.yml
----------------------------------------------------------------------
diff --cc .travis.yml
index 0000000,c42063e..09d1e5f
mode 000000,100644..100644
--- a/.travis.yml
+++ b/.travis.yml
@@@ -1,0 -1,38 +1,37 @@@
+ # Licensed to the Apache Software Foundation (ASF) under one or more
+ # contributor license agreements. See the NOTICE file distributed with
+ # this work for additional information regarding copyright ownership.
+ # The ASF licenses this file to You under the Apache License, Version 2.0
+ # (the "License"); you may not use this file except in compliance with
+ # the License. You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+
+ language: groovy
+
+ sudo: false
+
+ matrix:
+ include:
- - jdk: oraclejdk7
+ - jdk: oraclejdk8
+ addons:
+ apt:
+ packages:
+ - oracle-java8-installer
+
+ install: true
+
+ script: travis_wait 35 ./gradlew test
+
+ before_cache:
+ - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
+ cache:
+ directories:
+ - $HOME/.gradle/caches/
+ - $HOME/.gradle/wrapper/
http://git-wip-us.apache.org/repos/asf/groovy/blob/7efbf9ab/build.gradle
----------------------------------------------------------------------
diff --cc build.gradle
index f8056cb,cd3e6db..c33f324
--- a/build.gradle
+++ b/build.gradle
@@@ -15,10 -34,14 +34,16 @@@ buildscript
}
dependencies {
- classpath 'org.asciidoctor:asciidoctor-gradle-plugin:0.7.3'
- classpath 'org.jfrog.buildinfo:build-info-extractor-gradle:2.2.3'
- classpath 'me.champeau.gradle:japicmp-gradle-plugin:0.1.0'
- classpath 'me.champeau.gradle:antlr4-gradle-plugin:0.1'
+ // using the old "classpath" style of plugins because the new one doesn't play well with multi-modules
+ classpath 'org.asciidoctor:asciidoctor-gradle-plugin:1.5.2'
+ classpath "org.jfrog.buildinfo:build-info-extractor-gradle:3.0.3"
+ classpath 'me.champeau.gradle:gradle-javadoc-hotfix-plugin:0.1'
+ //classpath 'me.champeau.gradle:japicmp-gradle-plugin:0.1.1'
+ //classpath 'nl.javadude.gradle.plugins:license-gradle-plugin:0.11.0'
+ classpath "gradle.plugin.org.nosphere.apache:creadur-rat-gradle:0.1.3"
+ classpath "gradle.plugin.com.github.jk1:gradle-license-report:0.3.2"
++
++ classpath files("lib/antlr4-gradle-plugin-0.1.2-SNAPSHOT.jar");
}
}
@@@ -32,8 -75,8 +77,8 @@@ allprojects
apply plugin: 'java'
buildDir = 'target'
- sourceCompatibility = 1.6
- targetCompatibility = 1.6
- sourceCompatibility = 1.7
- targetCompatibility = 1.7
++ sourceCompatibility = 1.8
++ targetCompatibility = 1.8
group = 'org.codehaus.groovy'
version = groovyVersion
@@@ -107,21 -151,23 +153,24 @@@ ext
commonsHttpClientVersion = '3.1'
eclipseOsgiVersion = '3.9.1-v20140110-1610'
gparsVersion = '1.2.1'
- ivyVersion = '2.4.0-rc1'
- jansiVersion = '1.11'
+ gradleVersion = '3.1'
+ ivyVersion = '2.4.0'
+ jansiVersion = '1.13'
jarjarVersion = '1.3'
- jlineVersion = '2.12'
+ jlineVersion = '2.14.2'
jmockVersion = '1.2.0'
- logbackVersion = '1.1.2'
+ logbackVersion = '1.1.7'
log4jVersion = '1.2.17'
- log4j2Version = '2.0-rc1'
+ log4j2Version = '2.3' // 2.4 requires Java 7
luceneVersion = '4.7.2'
+ openbeansVersion = '1.0'
openejbVersion = '1.0'
qdoxVersion = '1.12.1'
- simianVersion = '2.2.4'
- slf4jVersion = '1.7.6'
- xmlunitVersion = '1.5'
- xstreamVersion = '1.4.7'
+ slf4jVersion = '1.7.21'
+ xmlunitVersion = '1.6'
+ xstreamVersion = '1.4.9'
+ spockVersion = '1.0-groovy-2.4'
++ antlr4Version = '4.5.3'
}
dependencies {
@@@ -411,12 -441,17 +446,17 @@@ allprojects
tasks.withType(GroovyCompile) {
logger.info("Building ${project.name}:${name} with InvokeDynamic support activated")
groovyOptions.optimizationOptions.indy = true
-- sourceCompatibility = 1.7
-- targetCompatibility = 1.7
++ sourceCompatibility = 1.8
++ targetCompatibility = 1.8
}
tasks.withType(JavaCompile) {
- sourceCompatibility = 1.7
- targetCompatibility = 1.7
+ if (project.name=='performance') {
+ sourceCompatibility = 1.8
+ targetCompatibility = 1.8
+ } else {
- sourceCompatibility = 1.7
- targetCompatibility = 1.7
++ sourceCompatibility = 1.8
++ targetCompatibility = 1.8
+ }
}
jar {
classifier = 'indy'
@@@ -442,11 -478,11 +483,11 @@@ if (file('user.gradle').exists())
apply from: 'user.gradle'
}
--if (!JavaVersion.current().java7Compatible) {
++if (!JavaVersion.current().java8Compatible) {
logger.lifecycle '''
**************************************** WARNING **********************************************
****** You are running the build with an older JDK. NEVER try to release with 1.6. ******
-- ****** You must use a JDK 1.7+ in order to compile all features of the language. ******
++ ****** You must use a JDK 1.8+ in order to compile all features of the language. ******
***********************************************************************************************
'''
}
http://git-wip-us.apache.org/repos/asf/groovy/blob/7efbf9ab/gradle/docs.gradle
----------------------------------------------------------------------
diff --cc gradle/docs.gradle
index 0c45ac9,03eef94..3e28e59
--- a/gradle/docs.gradle
+++ b/gradle/docs.gradle
@@@ -20,10 -46,10 +46,10 @@@ def javadocSpec =
version = true
overview = rootProject.file('src/main/overviewj.html')
footer = doc.footer
- source = rootProject.useIndy()?'1.7':'1.6'
- links('http://docs.oracle.com/javase/7/docs/api/', 'http://evgeny-goldin.org/javadoc/ant/api/',
- 'http://commons.apache.org/proper/commons-cli/javadocs/api-release', 'http://junit.org/javadoc/latest/',
- 'http://docs.oracle.com/javaee/6/api/', 'http://www.antlr2.org/javadoc')
- source = '1.7'
++ source = '1.8'
+ links('http://docs.oracle.com/javase/8/docs/api/', 'http://docs.oracle.com/javaee/7/api/',
+ 'http://commons.apache.org/proper/commons-cli/javadocs/api-release/', 'http://junit.org/junit4/javadoc/latest/',
+ 'http://docs.oracle.com/javaee/6/api/', 'http://www.antlr2.org/javadoc/')
}
}
@@@ -65,8 -89,8 +89,9 @@@ javadocAll
}
javadocAll javadocSpec
++
// Root project has an extra 'all' groovydoc task
- task groovydocAll(type: Groovydoc)
+ task groovydocAll(type: Groovydoc)
groovydocAll {
dependsOn( { project(':groovy-groovydoc').classes })
dependsOn( { project(':groovy-docgenerator').classes })
@@@ -159,23 -178,12 +179,12 @@@ task docGDK
}
}
- // this will apply the javadoc fix tool to all generated javadocs
- // we use it to make sure that the javadocs are not vulnerable independently of the JDK used to build
+ // apply javadoc fix tool to generated javadocs - ensures no vulnerability even on old JDK versions
allprojects {
- tasks.withType(Javadoc).all {
- doLast {
- logger.lifecycle("Applying Javadoc fix tool (see http://www.kb.cert.org/vuls/id/225657) into $destinationDir".toString())
- def javadocFix = new JavadocFixTool()
- javadocFix.recursive = true
- javadocFix.doPatch = true
- javadocFix.searchAndPatch(destinationDir)
- }
- }
+ apply plugin: 'javadocHotfix'
}
- if (JavaVersion.current().isJava7Compatible()) {
- javadocAll.options.source = '1.7'
- }
-javadocAll.options.source = '1.7'
++javadocAll.options.source = '1.8'
if (JavaVersion.current().isJava8Compatible()) {
allprojects {
http://git-wip-us.apache.org/repos/asf/groovy/blob/7efbf9ab/gradle/wrapper/gradle-wrapper.jar
----------------------------------------------------------------------
diff --cc gradle/wrapper/gradle-wrapper.jar
index 0569213,deedc7f..6ffa237
Binary files differ
http://git-wip-us.apache.org/repos/asf/groovy/blob/7efbf9ab/gradle/wrapper/gradle-wrapper.properties
----------------------------------------------------------------------
diff --cc gradle/wrapper/gradle-wrapper.properties
index 628a575,78b4785..5e7d5bc
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@@ -1,4 -1,4 +1,4 @@@
- #Thu Apr 10 09:16:15 EST 2014
-#Tue Sep 20 10:39:07 AEST 2016
++#Thu Nov 10 22:20:14 CST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
http://git-wip-us.apache.org/repos/asf/groovy/blob/7efbf9ab/lib/antlr4-gradle-plugin-0.1.2-SNAPSHOT.jar
----------------------------------------------------------------------
diff --cc lib/antlr4-gradle-plugin-0.1.2-SNAPSHOT.jar
index 0000000,0000000..638ed51
new file mode 100644
Binary files differ
http://git-wip-us.apache.org/repos/asf/groovy/blob/7efbf9ab/src/main/org/codehaus/groovy/control/CompilerConfiguration.java
----------------------------------------------------------------------
diff --cc src/main/org/codehaus/groovy/control/CompilerConfiguration.java
index c188ac8,e85a62f..cfffa83
--- a/src/main/org/codehaus/groovy/control/CompilerConfiguration.java
+++ b/src/main/org/codehaus/groovy/control/CompilerConfiguration.java
@@@ -251,15 -222,9 +228,15 @@@ public class CompilerConfiguration
}
Map options = new HashMap<String,Boolean>(3);
if (indy) {
- options.put("indy", Boolean.TRUE);
+ options.put(INVOKEDYNAMIC, Boolean.TRUE);
}
setOptimizationOptions(options);
+
+ try {
- antlr2Parser = System.getProperty("groovy.antlr4")==null;
++ antlr2Parser = !"true".equals(System.getProperty("groovy.antlr4"));
+ } catch (Exception e) {
+ // IGNORE
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/groovy/blob/7efbf9ab/src/main/org/codehaus/groovy/control/ParserPluginFactory.java
----------------------------------------------------------------------
diff --cc src/main/org/codehaus/groovy/control/ParserPluginFactory.java
index 16b2414,30a0d1c..1d7a994
--- a/src/main/org/codehaus/groovy/control/ParserPluginFactory.java
+++ b/src/main/org/codehaus/groovy/control/ParserPluginFactory.java
@@@ -15,64 -18,36 +18,75 @@@
*/
package org.codehaus.groovy.control;
+import groovy.lang.GroovyRuntimeException;
import org.codehaus.groovy.antlr.AntlrParserPluginFactory;
+import java.security.AccessController;
- import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+
/**
* A factory of parser plugin instances
*
*/
public abstract class ParserPluginFactory {
- private static Class <?> ANTLR4_CLASS=null;
++ private static Class<?> ANTLR4_CLASS=null;
/**
- * Creates a new instance of {@link ParserPluginFactory}.
- *
- * <p>The <code>useNewParser</code> parameter is not used, and this method
- * is kept for backward compatibility.
- *
- * @param useNewParser unused.
- * @return the new parser factory.
- * @deprecated use {@link #newInstance()}
+ * creates the ANTLR 4 parser
+ * @return the factory for the parser
+ */
+ public static ParserPluginFactory antlr4() {
+ if (ANTLR4_CLASS==null) {
- String name = "org.codehaus.groovy.parser.antlr4.Antlrv4PluginFactory";
++ String name = "org.apache.groovy.parser.antlr4.Antlr4PluginFactory";
+ try {
+ ANTLR4_CLASS =
+ Class.forName(name, false, ParserPluginFactory.class.getClassLoader());
+ } catch (Exception e) {
+ throw new GroovyRuntimeException("Could not find or load parser plugin factory for antlr4", e);
+ }
+ }
+ try {
+ return AccessController.doPrivileged(new PrivilegedExceptionAction<ParserPluginFactory>() {
+ public ParserPluginFactory run() throws Exception {
+ return (ParserPluginFactory) ANTLR4_CLASS.newInstance();
+ }
+ });
+ } catch (PrivilegedActionException e) {
+ throw new GroovyRuntimeException("Could not create instance of parser plugin factory for antlr4", e.getCause());
+ }
+ }
+
+ /**
+ * creates the ANTLR 2.7 parser
+ * @return the factory for the parser
+ */
+ public static ParserPluginFactory antlr2() {
+ return new AntlrParserPluginFactory();
+ }
+
+ /**
+ * creates the ANTLR 2.7 parser. This method was used to switch between the pre JSR
+ * parser and the new ANTLR 2.7 based parser, but even before Groovy 1.0 this
+ * method was changed to always return the ANTLR 2.7 parser.
+ * @param useNewParser - ignored
+ * @return the ANTLR 2.7 based parser
*/
@Deprecated
public static ParserPluginFactory newInstance(boolean useNewParser) {
+ return newInstance();
+ }
+
+ /**
- * Creates a new instance of {@link ParserPluginFactory}.
++ * creates the ANTLR 2.7 parser. This method was used to switch between the pre JSR
++ * parser and the new ANTLR 2.7 based parser, but even before Groovy 1.0 this
++ * method was changed to always return the ANTLR 2.7 parser.
+ *
+ * @return the new parser factory.
+ */
++ @Deprecated
+ public static ParserPluginFactory newInstance() {
- return new AntlrParserPluginFactory();
+ return antlr2();
}
public abstract ParserPlugin createParserPlugin();
http://git-wip-us.apache.org/repos/asf/groovy/blob/7efbf9ab/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
----------------------------------------------------------------------
diff --cc src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
index c4a719a,81bb35e..0ebf76b
--- a/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
+++ b/src/main/org/codehaus/groovy/runtime/DefaultGroovyMethods.java
@@@ -9328,7 -11106,7 +11106,7 @@@ public class DefaultGroovyMethods exten
*/
@SuppressWarnings("unchecked")
public static <T> T[] plus(T[] left, T[] right) {
-- return (T[]) plus(toList(left), toList(right)).toArray();
++ return (T[]) plus((List<T>) toList(left), (Collection<T>) toList(right)).toArray();
}
/**
@@@ -9364,7 -11142,7 +11142,7 @@@
*/
@SuppressWarnings("unchecked")
public static <T> T[] plus(T[] left, Collection<T> right) {
-- return (T[]) plus(toList(left), right).toArray();
++ return (T[]) plus((List<T>) toList(left), (Collection<T>) right).toArray();
}
/**
@@@ -9386,7 -11164,7 +11164,7 @@@
*/
@SuppressWarnings("unchecked")
public static <T> T[] plus(T[] left, Iterable<T> right) {
-- return (T[]) plus(toList(left), toList(right)).toArray();
++ return (T[]) plus((List<T>) toList(left), (Collection<T>) toList(right)).toArray();
}
/**
http://git-wip-us.apache.org/repos/asf/groovy/blob/7efbf9ab/subprojects/groovy-antlr4-grammar/README.md
----------------------------------------------------------------------
diff --cc subprojects/groovy-antlr4-grammar/README.md
index e77d7e1,0000000..ba31dc0
mode 100644,000000..100644
--- a/subprojects/groovy-antlr4-grammar/README.md
+++ b/subprojects/groovy-antlr4-grammar/README.md
@@@ -1,20 -1,0 +1,16 @@@
+This is the home of the new antlr4 parser for Groovy.
+
- In the gradle build the property useAntlr4 has to be set to enable the build of the parser
- and the execution of all tests with it.
++In the gradle build the property useAntlr4 has to be set to enable the build of the parser and the execution of all tests with it.
+
+Command line example:
+./gradlew -PuseAntlr4=true bootstrapJar
+
-
- To enable the new parser automatically at runtime the system property groovy.antlr4 has to be
- set.
++To enable the new parser automatically at runtime the system property groovy.antlr4 has to be set.
+
+Command line example:
+export JAVA_OPTS="-Dgroovy.antlr4=true"
+groovy foo.groovy
+
- This system property also controls groovyc and has to be used in case it is used outside of
- this build, for example with:
++This system property also controls groovyc and has to be used in case it is used outside of this build, for example with:
+
- groovyOptions.forkOptions.jvmArgs += ["-Dgroovy.antlr4=true"]
++groovyOptions.forkOptions.jvmArgs += ["-Dgroovy.antlr4=true"]
http://git-wip-us.apache.org/repos/asf/groovy/blob/7efbf9ab/subprojects/groovy-antlr4-grammar/build.gradle
----------------------------------------------------------------------
diff --cc subprojects/groovy-antlr4-grammar/build.gradle
index 4f956f9,0000000..a301a58
mode 100644,000000..100644
--- a/subprojects/groovy-antlr4-grammar/build.gradle
+++ b/subprojects/groovy-antlr4-grammar/build.gradle
@@@ -1,37 -1,0 +1,55 @@@
+if (!rootProject.hasProperty('useAntlr4')) return
+
+apply plugin: 'me.champeau.gradle.antlr4'
+
- def srcMain = 'subprojects/groovy-antlr4-grammar/src/main/'
++def srcBase = "subprojects/groovy-antlr4-grammar/src"
++def srcMain = "$srcBase/main"
++def srcTest = "$srcBase/test"
++def antlr4Source = "$srcMain/antlr4"
++def antlr4OutputRootDir = "$buildDir/generated-sources"
++def antlr4Output = "$antlr4OutputRootDir/org/apache/groovy/parser/antlr4"
++
+// set package for antlr generated classes
+antlr4 {
- source = file(srcMain+'antlr4')
- extraArgs = ["-package", "org.codehaus.groovy.parser.antlr4"]
- output = file("$buildDir/generated-sources/org/codehaus/groovy/parser/antlr4")
++ source = file(antlr4Source)
++ extraArgs = ["-no-listener", "-package", "org.apache.groovy.parser.antlr4"]
++ output = file(antlr4Output)
+}
+
+// make the Java compile task depend on the antlr4 task
+compileJava.dependsOn antlr4
+
+// add antlr4 to classpath
+configurations {
+ compile.extendsFrom antlr4
+}
+
- // add the generated source files to the list of java sources
- sourceSets.main.java.srcDirs += antlr4.output
- sourceSets.main.java.srcDirs += file(srcMain+'java')
-
- sourceSets {
- main {
- java {
- exclude '/com/xseagullx/groovy/gsoc/**'
- }
- }
++dependencies {
++ antlr4 "com.tunnelvisionlabs:antlr4:$antlr4Version"
++ testCompile project(':groovy-test')
++}
++
++
++task cleanGeneratedSources(type: Delete) {
++ delete antlr4OutputRootDir
++ file(antlr4OutputRootDir).mkdirs()
+}
+
++antlr4.dependsOn cleanGeneratedSources
++
++// add the generated source files to the list of java sources
++sourceSets.main.java.srcDirs += file("$antlr4OutputRootDir");
++sourceSets.main.java.srcDirs += file("$srcMain/java");
++sourceSets.main.groovy.srcDirs += file("$srcMain/groovy");
++sourceSets.main.resources.srcDirs += file("$antlr4Source");
++sourceSets.main.resources.srcDirs += file("$srcMain/resources");
++sourceSets.test.java.srcDirs += file("$srcTest/java");
++sourceSets.test.groovy.srcDirs += file("$srcTest/groovy");
++sourceSets.test.resources.srcDirs += file("$srcTest/resources");
++
++
+allprojects {
+ tasks.withType(GroovyCompile) {
+ groovyOptions.forkOptions.jvmArgs += ["-Dgroovy.antlr4=true"]
+ }
- }
++}