You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by em...@apache.org on 2025/05/14 13:25:32 UTC

(groovy) branch GROOVY_4_0_X updated (230b1217a4 -> e612f01ec9)

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

emilles pushed a change to branch GROOVY_4_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git


    from 230b1217a4 GROOVY-11642: include annotations and modifiers in inner class offset
     new a6a854434f GROOVY-11607: `groovyc`: fileset lists files
     new e612f01ec9 GROOVY-11658: `groovyc`: log command-line arguments at verbose level

The 2 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:
 .../main/java/org/codehaus/groovy/ant/Groovyc.java | 29 +++++++++++-----------
 .../org/codehaus/groovy/ant/GroovycTest.xml        | 14 +++++++++++
 .../org/codehaus/groovy/ant/GroovycTest.java       |  6 +++++
 3 files changed, 34 insertions(+), 15 deletions(-)


(groovy) 02/02: GROOVY-11658: `groovyc`: log command-line arguments at verbose level

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

emilles pushed a commit to branch GROOVY_4_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit e612f01ec971c3198a99f07cbc5841e7c2671063
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Wed May 14 08:25:15 2025 -0500

    GROOVY-11658: `groovyc`: log command-line arguments at verbose level
    
    4_0_X backport
---
 .../groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java  | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java b/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java
index 92edea2b60..9aeb747db9 100644
--- a/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java
+++ b/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java
@@ -1259,7 +1259,7 @@ public class Groovyc extends MatchingTask {
 
     private String[] makeCommandLine(List<String> commandLineList) {
         String[] commandLine = commandLineList.toArray(EMPTY_STRING_ARRAY);
-        log.info("Compilation arguments:\n" + String.join("\n", commandLine));
+        log.verbose("Compilation arguments:\n" + String.join("\n", commandLine)); // GROOVY-11658
         return commandLine;
     }
 
@@ -1319,7 +1319,7 @@ public class Groovyc extends MatchingTask {
             }
             Writer writer = new StringBuilderWriter();
             new ErrorReporter(t, false).write(new PrintWriter(writer));
-            String message = writer.toString();
+            log.error(writer.toString());
 
             taskSuccess = false;
             if (errorProperty != null) {
@@ -1327,10 +1327,7 @@ public class Groovyc extends MatchingTask {
             }
 
             if (failOnError) {
-                log.error(message);
                 throw new BuildException("Compilation Failed", t, getLocation());
-            } else {
-                log.error(message);
             }
         }
     }


(groovy) 01/02: GROOVY-11607: `groovyc`: fileset lists files

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

emilles pushed a commit to branch GROOVY_4_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit a6a854434fb36257905ab846181ec62c96f9b10e
Author: Eric Milles <er...@thomsonreuters.com>
AuthorDate: Sat Apr 12 11:05:54 2025 -0500

    GROOVY-11607: `groovyc`: fileset lists files
    
    4_0_X backport
---
 .../main/java/org/codehaus/groovy/ant/Groovyc.java | 24 ++++++++++++----------
 .../org/codehaus/groovy/ant/GroovycTest.xml        | 14 +++++++++++++
 .../org/codehaus/groovy/ant/GroovycTest.java       |  6 ++++++
 3 files changed, 33 insertions(+), 11 deletions(-)

diff --git a/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java b/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java
index 1254b7e6da..92edea2b60 100644
--- a/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java
+++ b/subprojects/groovy-ant/src/main/java/org/codehaus/groovy/ant/Groovyc.java
@@ -37,7 +37,6 @@ import org.codehaus.groovy.GroovyBugError;
 import org.codehaus.groovy.control.CompilationUnit;
 import org.codehaus.groovy.control.CompilerConfiguration;
 import org.codehaus.groovy.control.SourceExtensionHandler;
-import org.codehaus.groovy.runtime.DefaultGroovyMethods;
 import org.codehaus.groovy.runtime.DefaultGroovyStaticMethods;
 import org.codehaus.groovy.tools.ErrorReporter;
 import org.codehaus.groovy.tools.FileSystemCompiler;
@@ -870,17 +869,19 @@ public class Groovyc extends MatchingTask {
 
         if (javac != null) jointCompilation = true;
 
-        // scan source directories and dest directory to build up
-        // compile lists
-        String[] list = src.list();
-        for (String filename : list) {
+        // scan source directories and dest directory to build up compile lists
+        for (String filename : src.list()) {
             File file = getProject().resolveFile(filename);
             if (!file.exists()) {
                 throw new BuildException("srcdir \"" + file.getPath() + "\" does not exist!", getLocation());
             }
-            DirectoryScanner ds = this.getDirectoryScanner(file);
-            String[] files = ds.getIncludedFiles();
-            scanDir(file, destDir != null ? destDir : file, files);
+            if (file.isDirectory()) {
+                DirectoryScanner ds = getDirectoryScanner(file);
+                scanDir(file, destDir != null ? destDir : file, ds.getIncludedFiles());
+            } else { // GROOVY-11607: fileset lists files
+                compileList = Arrays.copyOf(compileList, compileList.length + 1);
+                compileList[compileList.length - 1] = file;
+            }
         }
 
         compile();
@@ -892,7 +893,7 @@ public class Groovyc extends MatchingTask {
     }
 
     /**
-     * Clear the list of files to be compiled and copied.
+     * Clears the list of files to be compiled and copied.
      */
     protected void resetFileLists() {
         compileList = EMPTY_FILE_ARRAY;
@@ -1257,8 +1258,9 @@ public class Groovyc extends MatchingTask {
     }
 
     private String[] makeCommandLine(List<String> commandLineList) {
-        log.info("Compilation arguments:\n" + DefaultGroovyMethods.join((Iterable<String>) commandLineList, "\n"));
-        return commandLineList.toArray(EMPTY_STRING_ARRAY);
+        String[] commandLine = commandLineList.toArray(EMPTY_STRING_ARRAY);
+        log.info("Compilation arguments:\n" + String.join("\n", commandLine));
+        return commandLine;
     }
 
     private void runForked(String[] commandLine) {
diff --git a/subprojects/groovy-ant/src/test-resources/org/codehaus/groovy/ant/GroovycTest.xml b/subprojects/groovy-ant/src/test-resources/org/codehaus/groovy/ant/GroovycTest.xml
index d70cb5ab0e..b5fb7011f8 100644
--- a/subprojects/groovy-ant/src/test-resources/org/codehaus/groovy/ant/GroovycTest.xml
+++ b/subprojects/groovy-ant/src/test-resources/org/codehaus/groovy/ant/GroovycTest.xml
@@ -186,6 +186,20 @@
         <java classname="org.codehaus.groovy.ant.ParameterMetadataCheck"/>
     </target>
 
+    <!-- GROOVY-11607 -->
+    <target name="plainForkedCompilation_NestingSrcElementCheck">
+        <groovyc destdir="${destPath}" fork="true">
+            <src>
+                <fileset dir="${srcPath}">
+                    <include name="GroovycTest*.*"/>
+                    <exclude name="GroovycTest.xml"/>
+                    <exclude name="GroovycTest2.java"/>
+                </fileset>
+            </src>
+        </groovyc>
+        <java classname="org.codehaus.groovy.ant.GroovycTest1"/>
+    </target>
+
     <target name="clean">
         <delete quiet="true">
             <fileset dir="${destPath}/org/codehaus/groovy/ant">
diff --git a/subprojects/groovy-ant/src/test/groovy/org/codehaus/groovy/ant/GroovycTest.java b/subprojects/groovy-ant/src/test/groovy/org/codehaus/groovy/ant/GroovycTest.java
index 8e0afd00cd..5714c711d9 100644
--- a/subprojects/groovy-ant/src/test/groovy/org/codehaus/groovy/ant/GroovycTest.java
+++ b/subprojects/groovy-ant/src/test/groovy/org/codehaus/groovy/ant/GroovycTest.java
@@ -322,4 +322,10 @@ public class GroovycTest extends GroovyTestCase {
         Method   m = c.getDeclaredMethod("main", String[].class);
         assertEquals("args", m.getParameters()[0].getName());
     }
+
+    // GROOVY-11607
+    public void testPlainForkedCompilation_NestingSrcElementCheck() {
+        ensureExecutes("plainForkedCompilation_NestingSrcElementCheck");
+        ensureNotPresent("GroovycTest2"); // excluded from src > fileset
+    }
 }