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 2017/08/06 17:37:48 UTC

groovy git commit: Enable the new parser Parrot by default(Groovy 3.0.0+ Only)

Repository: groovy
Updated Branches:
  refs/heads/master bbe543d9a -> 517e77168


Enable the new parser Parrot by default(Groovy 3.0.0+ Only)


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/517e7716
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/517e7716
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/517e7716

Branch: refs/heads/master
Commit: 517e771687c582e52fd56715d0225ec4e69ae0f4
Parents: bbe543d
Author: sunlan <su...@apache.org>
Authored: Mon Aug 7 01:37:35 2017 +0800
Committer: sunlan <su...@apache.org>
Committed: Mon Aug 7 01:37:35 2017 +0800

----------------------------------------------------------------------
 .travis.yml                                            |  2 +-
 .../codehaus/groovy/control/CompilerConfiguration.java | 13 +++++++++++--
 src/test/gls/syntax/MethodCallValidationTest.groovy    |  8 ++++++++
 subprojects/groovy-console/build.gradle                |  4 +---
 subprojects/parser-antlr4/build.gradle                 |  7 -------
 5 files changed, 21 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/517e7716/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index e4f512c..9bf1700 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -27,7 +27,7 @@ matrix:
 
 install: true
 
-script: travis_wait 60 ./gradlew -PuseAntlr4=true test
+script: travis_wait 60 ./gradlew test
 
 before_cache:
   - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock

http://git-wip-us.apache.org/repos/asf/groovy/blob/517e7716/src/main/org/codehaus/groovy/control/CompilerConfiguration.java
----------------------------------------------------------------------
diff --git a/src/main/org/codehaus/groovy/control/CompilerConfiguration.java b/src/main/org/codehaus/groovy/control/CompilerConfiguration.java
index e924c2c..8e230ea 100644
--- a/src/main/org/codehaus/groovy/control/CompilerConfiguration.java
+++ b/src/main/org/codehaus/groovy/control/CompilerConfiguration.java
@@ -95,6 +95,8 @@ public class CompilerConfiguration {
      */
     public static final CompilerConfiguration DEFAULT = new CompilerConfiguration();
 
+    private static final String GROOVY_ANTLR4_OPT = "groovy.antlr4";
+
     /**
      * See {@link WarningMessage} for levels.
      */
@@ -196,8 +198,11 @@ public class CompilerConfiguration {
     /**
      * defines if antlr2 parser should be used or the antlr4 one if
      * no factory is set yet
+     *
+     * The antlr4 parser Parrot is enabled by default
+     *
      */
-    private boolean antlr2Parser = true;
+    private boolean antlr2Parser = false;
 
     /**
      * Sets the Flags to defaults.
@@ -253,7 +258,11 @@ public class CompilerConfiguration {
         setOptimizationOptions(options);
 
         try {
-            antlr2Parser = !"true".equals(System.getProperty("groovy.antlr4"));
+            String groovyAntlr4Opt = System.getProperty(GROOVY_ANTLR4_OPT);
+
+            if (null != groovyAntlr4Opt) {
+                antlr2Parser = !Boolean.valueOf(groovyAntlr4Opt);
+            }
         } catch (Exception e) {
             // IGNORE
         }

http://git-wip-us.apache.org/repos/asf/groovy/blob/517e7716/src/test/gls/syntax/MethodCallValidationTest.groovy
----------------------------------------------------------------------
diff --git a/src/test/gls/syntax/MethodCallValidationTest.groovy b/src/test/gls/syntax/MethodCallValidationTest.groovy
index 9fe6d52..2bb5587 100644
--- a/src/test/gls/syntax/MethodCallValidationTest.groovy
+++ b/src/test/gls/syntax/MethodCallValidationTest.groovy
@@ -18,9 +18,17 @@
  */
 package gls.syntax
 
+import org.codehaus.groovy.control.CompilerConfiguration
+import org.codehaus.groovy.control.ParserVersion
+
 public class MethodCallValidationTest extends gls.CompilableTestSupport {
 
     void testDeclarationInMethodCall() {
+        if (ParserVersion.V_4 == CompilerConfiguration.DEFAULT.parserVersion) {
+            // FIXME GROOVY-8277
+            return
+        }
+
         shouldNotCompile """
             foo(String a)
         """

http://git-wip-us.apache.org/repos/asf/groovy/blob/517e7716/subprojects/groovy-console/build.gradle
----------------------------------------------------------------------
diff --git a/subprojects/groovy-console/build.gradle b/subprojects/groovy-console/build.gradle
index bc38c53..b9209ab 100644
--- a/subprojects/groovy-console/build.gradle
+++ b/subprojects/groovy-console/build.gradle
@@ -27,9 +27,7 @@ dependencies {
 }
 
 task console(type: JavaExec, dependsOn:classes) {
-    if (rootProject.hasProperty('useAntlr4')) {
-        jvmArgs += ["-Dgroovy.antlr4=true", "-Dgroovy.attach.groovydoc=true"]
-    }
+    jvmArgs += ["-Dgroovy.attach.groovydoc=true"]
 
     main = 'groovy.ui.Console'
     classpath = sourceSets.main.runtimeClasspath

http://git-wip-us.apache.org/repos/asf/groovy/blob/517e7716/subprojects/parser-antlr4/build.gradle
----------------------------------------------------------------------
diff --git a/subprojects/parser-antlr4/build.gradle b/subprojects/parser-antlr4/build.gradle
index a2a28a3..fc7239a 100644
--- a/subprojects/parser-antlr4/build.gradle
+++ b/subprojects/parser-antlr4/build.gradle
@@ -16,7 +16,6 @@
  *  specific language governing permissions and limitations
  *  under the License.
  */
-if (!rootProject.hasProperty('useAntlr4')) return
 
 apply plugin: 'antlr'
 
@@ -60,12 +59,6 @@ sourceSets.test.groovy.srcDirs += file("$srcTest/groovy");
 sourceSets.test.resources.srcDirs += file("$srcTest/resources");
 
 
-allprojects {
-    tasks.withType(GroovyCompile) {
-        groovyOptions.forkOptions.jvmArgs += ["-Dgroovy.antlr4=true"]
-    }
-}
-
 test {
     jvmArgs "-Dgroovy.attach.groovydoc=true", "-Dgroovy.antlr4.cache.threshold=100"
 }
\ No newline at end of file