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 2020/04/19 04:03:00 UTC

[groovy] branch danielsun/enable-indy-by-default updated (6315017 -> 5a88c89)

This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a change to branch danielsun/enable-indy-by-default
in repository https://gitbox.apache.org/repos/asf/groovy.git.


 discard 6315017  Enable indy by default
     add 9efa404  Revert "Trivial refactoring: Remove redundant type casting"
     new 5a88c89  GROOVY-9513: Enable indy by default

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (6315017)
            \
             N -- N -- N   refs/heads/danielsun/enable-indy-by-default (5a88c89)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/main/java/org/codehaus/groovy/runtime/InvokerHelper.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)


[groovy] 01/01: GROOVY-9513: Enable indy by default

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sunlan pushed a commit to branch danielsun/enable-indy-by-default
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 5a88c891c552f4627fb39a4b552c94a89e180a84
Author: Daniel Sun <su...@apache.org>
AuthorDate: Sun Apr 19 04:05:00 2020 +0800

    GROOVY-9513: Enable indy by default
---
 .github/workflows/gradle.yml                       | 24 -----------
 .travis.yml                                        | 17 +-------
 build.gradle                                       | 13 ------
 gradle/assemble.gradle                             | 21 ----------
 gradle/indy.gradle                                 | 25 -----------
 gradle/jacoco/jacoco.gradle                        | 48 +---------------------
 gradle/test.gradle                                 | 30 +-------------
 gradle/upload.gradle                               | 14 -------
 .../groovy/control/CompilerConfiguration.java      |  8 +++-
 9 files changed, 11 insertions(+), 189 deletions(-)

diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml
index fd6a4c5..6d3cc71 100644
--- a/.github/workflows/gradle.yml
+++ b/.github/workflows/gradle.yml
@@ -42,27 +42,3 @@ jobs:
         timeout-minutes: 60
         env:
           GRADLE_SCANS_ACCEPT: yes
-  testWithIndy:
-    strategy:
-      fail-fast: false
-      matrix:
-        os: [ubuntu-18.04]
-        java: [8.0.232, 11.0.6]
-    runs-on: ${{ matrix.os }}
-    steps:
-      - uses: actions/checkout@v1
-      - name: Set up JDK
-        uses: actions/setup-java@v1
-        with:
-          java-version: ${{ matrix.java }}
-      - name: Cache Gradle Repository
-        uses: actions/cache@v1
-        with:
-          path: ~/.gradle/caches
-          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
-          restore-keys: ${{ runner.os }}-gradle
-      - name: Test with Gradle
-        run: ./gradlew testWithIndy
-        timeout-minutes: 60
-        env:
-          GRADLE_SCANS_ACCEPT: yes
diff --git a/.travis.yml b/.travis.yml
index a2decd9..427d4ba 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -25,21 +25,6 @@ install:
 
 matrix:
   include:
-    - env: BC='legacy'
-      jdk: openjdk14
-    - env: BC='legacy'
-      jdk: openjdk13
-    - env: BC='legacy'
-      jdk: openjdk12
-    - env: BC='legacy'
-      jdk: openjdk11
-    - env: BC='legacy'
-      jdk: openjdk10
-    - env: BC='legacy'
-      jdk: oraclejdk9
-    - env: BC='legacy'
-      jdk: oraclejdk8
-
     - env: BC='indy'
       jdk: openjdk14
     - env: BC='indy'
@@ -63,7 +48,7 @@ before_script:
 
 script:
   - ./gradlew -version
-  - if [ "$BC" == "legacy" ]; then travis_wait 60 ./gradlew test; elif [ "$BC" == "sonar" ]; then travis_wait 60 ./gradlew sonarqube -Dsonar.login=$SONAR_LOGIN -Pcoverage=true -x testWithIndy; else travis_wait 60 ./gradlew testWithIndy; fi
+  - if [ "$BC" == "indy" ]; then travis_wait 60 ./gradlew test; elif [ "$BC" == "sonar" ]; then travis_wait 60 ./gradlew sonarqube -Dsonar.login=$SONAR_LOGIN -Pcoverage=true; fi
 
 # As recommended in:
 # https://docs.travis-ci.com/user/languages/java/#Caching
diff --git a/build.gradle b/build.gradle
index 4e0b819..e3d5ad1 100644
--- a/build.gradle
+++ b/build.gradle
@@ -64,7 +64,6 @@ ext.modules = {
 ext.isReleaseVersion = !groovyVersion.toLowerCase().endsWith("snapshot")
 
 apply from: 'gradle/bad-practices.gradle'
-//apply from: 'gradle/indy.gradle'
 apply from: 'gradle/publish.gradle'
 apply plugin: "com.github.jk1.dependency-license-report"
 
@@ -100,7 +99,6 @@ allprojects {
     }
 
     apply plugin: 'groovy'
-    apply from: "${rootProject.projectDir}/gradle/indy.gradle"
     apply from: "${rootProject.projectDir}/gradle/asciidoctor.gradle"
 
     tasks.withType(org.asciidoctor.gradle.AsciidoctorTask) {
@@ -329,17 +327,6 @@ allprojects {
         }
     }
 
-    if (rootProject.indyCapable()) {
-        task compileGroovyWithIndy(type: GroovyCompile) {
-            source = sourceSets.main.groovy
-            classpath = compileGroovy.classpath
-            sourceCompatibility = 1.8
-            targetCompatibility = 1.8
-            groovyOptions.optimizationOptions['indy'] = true
-            destinationDir = file("$buildDir/classes/indy")
-        }
-    }
-
     tasks.withType(GroovyCompile) {
         groovyOptions.forkOptions.jvmArgs += ["-Dgroovy.antlr4.cache.threshold=100"]
         groovyOptions.fork(memoryMaximumSize: groovycMain_mx)
diff --git a/gradle/assemble.gradle b/gradle/assemble.gradle
index 985529d..6fd28e7 100644
--- a/gradle/assemble.gradle
+++ b/gradle/assemble.gradle
@@ -173,18 +173,6 @@ allprojects {
             }
         }
     }
-    if (rootProject.indyCapable()) {
-        task jarWithIndy(type: Jar) {
-            dependsOn compileGroovyWithIndy
-            archiveClassifier = 'indy'
-            archiveAppendix = 'raw'
-            from sourceSets.main.java.outputDir
-            from sourceSets.main.groovy.outputDir
-            from compileGroovyWithIndy.destinationDir
-            from "${project.buildDir}/resources/main"
-        }
-        producedJars << jarWithIndy
-    }
     producedJars.each { arch ->
         arch.metaInf {
             from("$projectDir/licenses/LICENSE-JARJAR")
@@ -289,9 +277,6 @@ allprojects {
 }
 
 def producedJars = [jar]
-if (rootProject.indyCapable()) {
-    producedJars << jarWithIndy
-}
 
 producedJars.each {
     it.dependsOn('dgmConverter')
@@ -390,12 +375,6 @@ ext.distSpec = copySpec {
         from project(':groovy-jaxb').configurations.jaxb
         from project(':groovy-jaxb').configurations.jaxbRuntime
     }
-    if (!rootProject.hasProperty('skipIndy')) {
-        into('indy') {
-            from jarjarWithIndy
-            from modules()*.jarjarWithIndy
-        }
-    }
     if (!rootProject.hasProperty('skipGrooid')) {
         into('grooid') {
             from { new File(jar.archivePath.parent, "${jar.baseName}-${jar.version}-grooid.jar") }
diff --git a/gradle/indy.gradle b/gradle/indy.gradle
deleted file mode 100644
index f2262c1..0000000
--- a/gradle/indy.gradle
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- *  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.
- */
-
-// This file contains support tools for the Gradle build
-// with regards to invoke dynamic support (indy)
-
-rootProject.ext.indyCapable = {
-    !rootProject.hasProperty('skipIndy')
-}
diff --git a/gradle/jacoco/jacoco.gradle b/gradle/jacoco/jacoco.gradle
index ed9237d..21f2ff0 100644
--- a/gradle/jacoco/jacoco.gradle
+++ b/gradle/jacoco/jacoco.gradle
@@ -28,7 +28,7 @@ if (rootProject.hasProperty('coverage') && Boolean.valueOf(rootProject.getProper
 
         project.afterEvaluate {
             tasks.withType(JacocoReport) {
-                if (name != 'jacocoAllReport' && name != 'jacocoAllIndyReport') {
+                if (name != 'jacocoAllReport') {
                     sourceDirectories.from = sourceDirectories.from + files(project.sourceSets.main.allGroovy.srcDirs)
 //                    classDirectories += files(project.sourceSets.main.output)
                 }
@@ -37,7 +37,6 @@ if (rootProject.hasProperty('coverage') && Boolean.valueOf(rootProject.getProper
     }
 
     // To avoid "Can't add different class with same name" fatal error
-    // due to different classes generated when using Indy, create two reports
     // No need to include Java class directories since Groovy one includes those classes
 
     task jacocoMerge(type: JacocoMerge) {
@@ -46,22 +45,7 @@ if (rootProject.hasProperty('coverage') && Boolean.valueOf(rootProject.getProper
         allprojects {
             project.plugins.withType(JavaPlugin) {
                 project.tasks.withType(Test) { task ->
-                    if (sourceSets.test.allSource.srcDirs.any { it.exists() } && !task.name.contains('Indy')) {
-                        executionData(task)
-                    }
-                }
-            }
-        }
-
-        executionData = files(executionData).filter { f -> f.exists() }
-    }
-
-    task jacocoMergeIndy(type: JacocoMerge) {
-        destinationFile = file("$buildDir/jacoco/jacoco-all-indy.exec")
-        allprojects {
-            project.plugins.withType(JavaPlugin) {
-                project.tasks.withType(Test) { task ->
-                    if (sourceSets.test.allSource.srcDirs.any { it.exists() } && task.name.contains('Indy')) {
+                    if (sourceSets.test.allSource.srcDirs.any { it.exists() }) {
                         executionData(task)
                     }
                 }
@@ -92,34 +76,6 @@ if (rootProject.hasProperty('coverage') && Boolean.valueOf(rootProject.getProper
         }
     }
 
-    task jacocoAllIndyReport(type: JacocoReport, dependsOn: 'jacocoMergeIndy') {
-        executionData jacocoMergeIndy.destinationFile
-        reports {
-            xml {
-                enabled true
-            }
-            html {
-                enabled true
-            }
-        }
-
-        allprojects {
-            project.plugins.withType(JavaPlugin) {
-                def sd = sourceDirectories.from ?: files()
-                def cd = classDirectories.from ?: files()
-                sourceDirectories.from = sd + files(project.sourceSets.main.allGroovy.srcDirs, project.sourceSets.main.allJava.srcDirs)
-                classDirectories.from = cd + files(compileGroovyWithIndy.destinationDir)
-            }
-        }
-    }
-
     check.dependsOn jacocoAllReport
-    if (!rootProject.hasProperty('skipIndy')) {
-        check.dependsOn jacocoAllIndyReport
-    }
-
     tasks.sonarqube.dependsOn jacocoAllReport
-    if (!rootProject.hasProperty('skipIndy')) {
-        tasks.sonarqube.dependsOn jacocoAllIndyReport
-    }
 }
diff --git a/gradle/test.gradle b/gradle/test.gradle
index 8a9a1ef..1d0f874 100644
--- a/gradle/test.gradle
+++ b/gradle/test.gradle
@@ -45,27 +45,6 @@ allprojects {
         }
     }
 
-    // create an Indy test suite
-    if (rootProject.indyCapable()) {
-        def dependencies = configurations.testRuntime.incoming.dependencies.findAll {
-            it.name.startsWith('groovy')
-        }.collect {
-            it.name
-        }
-        task testWithIndy(type: Test) {
-            systemProperties 'groovy.target.indy': true
-            dependsOn 'jarWithIndy'
-            dependencies.each { dependsOn "${it}:jarWithIndy" }
-            classpath = classpath - files(jar.archivePath, *dependencies.collect { project(it).jar }) +
-                    files({ [jarWithIndy.archivePath, *dependencies.collect { project(it).jarWithIndy }] })
-        }
-        task testAll {
-            description = "Runs both the normal and indy test suites"
-            dependsOn test, testWithIndy
-        }
-        check.dependsOn testWithIndy
-    }
-
     sourceSets {
         test {
             groovy {
@@ -117,13 +96,8 @@ def buildExcludeFilter(boolean legacyTestSuite) {
         excludes << 'groovy/grape/'
     }
 
-    if (legacyTestSuite) {
-        // indy tests will only be executed in indy test suite
-        excludes += ['indy', 'Indy']
-    } else {
-        // tests not passing with indy : investigation required!
-        excludes += ['Log4j2Test', 'ASTTransformationCustomizerTest']
-    }
+    // tests not passing with indy : investigation required!
+    excludes += ['Log4j2Test', 'ASTTransformationCustomizerTest']
 
     return { f ->
         excludes.any { f.file =~ it }
diff --git a/gradle/upload.gradle b/gradle/upload.gradle
index ca5cb9a..83ffd7e 100644
--- a/gradle/upload.gradle
+++ b/gradle/upload.gradle
@@ -111,13 +111,7 @@ allprojects {
 
         [uploadArchives, install]*.with {
             dependsOn([grooidjar, jarjar, sourceJar, javadocJar, groovydocJar])
-            if (rootProject.indyCapable()) {
-                dependsOn jarjarWithIndy
-            }
             doFirst {
-                if (rootProject.indyCapable()) {
-                    project.artifacts.add('archives', jarjarWithIndy.outputFile)
-                }
                 def grooidJarFile = rootProject.ext.deriveFile(jarjar.outputFile, 'grooid')
                 if (grooidJarFile.exists()) {
                     project.artifacts.add('archives', grooidJarFile)
@@ -133,10 +127,6 @@ allprojects {
                 signArchiveTask(sourceJar)
                 signArchiveTask(javadocJar)
                 signArchiveTask(groovydocJar)
-                def indyJar = rootProject.ext.deriveFile(jarjar.outputFile, 'indy')
-                if (indyJar.exists()) {
-                    signWithClassifier('indy', indyJar)
-                }
                 def grooidJarFile = rootProject.ext.deriveFile(jarjar.outputFile, 'grooid')
                 if (grooidJarFile.exists()) {
                     signWithClassifier('grooid', grooidJarFile)
@@ -150,10 +140,6 @@ allprojects {
 // we don't want them in the root project so add them as artifacts with a modified name
 // we'll exclude the original artifacts during publication with an exclude pattern
 def configureAdditionalArtifacts = {
-    if (!rootProject.indyCapable()) {
-        throw new GradleException("Indy must be enabled to upload archives")
-    }
-
     project.artifacts.add('archives', distBin) { name = 'groovy-binary' }
     project.artifacts.add('archives', sourceAllJar) { name = 'groovy-all' }
     project.artifacts.add('archives', javadocAllJar) { name = 'groovy-all' }
diff --git a/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java b/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java
index bb08c63..6422184 100644
--- a/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java
+++ b/src/main/java/org/codehaus/groovy/control/CompilerConfiguration.java
@@ -436,13 +436,17 @@ public class CompilerConfiguration {
         defaultScriptExtension = getSystemPropertySafe("groovy.default.scriptExtension", ".groovy");
 
         optimizationOptions = new HashMap<>(4);
-        handleOptimizationOption(optimizationOptions, INVOKEDYNAMIC, "groovy.target.indy");
+        handleOptimizationOption(optimizationOptions, INVOKEDYNAMIC, "groovy.target.indy", "true");
         handleOptimizationOption(optimizationOptions, GROOVYDOC, "groovy.attach.groovydoc");
         handleOptimizationOption(optimizationOptions, RUNTIME_GROOVYDOC, "groovy.attach.runtime.groovydoc");
     }
 
     private void handleOptimizationOption(final Map<String, Boolean> options, final String optionName, final String sysOptionName) {
-        String propValue = getSystemPropertySafe(sysOptionName);
+        handleOptimizationOption(options, optionName, sysOptionName, null);
+    }
+
+    private void handleOptimizationOption(final Map<String, Boolean> options, final String optionName, final String sysOptionName, String def) {
+        String propValue = getSystemPropertySafe(sysOptionName, def);
         boolean optionEnabled = propValue == null
                 ? (DEFAULT != null && Boolean.TRUE.equals(DEFAULT.getOptimizationOptions().get(optionName)))
                 : Boolean.parseBoolean(propValue);