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:34:19 UTC

(groovy) branch GROOVY_3_0_X updated (8577625dec -> 7d399ba9c3)

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

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


    from 8577625dec GROOVY-11642: include annotations and modifiers in inner class offset
     new 2af2a57615 GROOVY-11607: `groovyc`: fileset lists files
     new 7d399ba9c3 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) 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_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git

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

    GROOVY-11607: `groovyc`: fileset lists files
    
    3_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 bb291910a4..d18a34cae7 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;
@@ -1260,8 +1261,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 6488074ba2..32e258bdf6 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 934cf80bef..6e2f1554ca 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
@@ -313,4 +313,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
+    }
 }


(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_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git

commit 7d399ba9c34aeddd69d4aacd727663013816a53c
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
    
    3_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 d18a34cae7..ab7494125d 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
@@ -1262,7 +1262,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;
     }
 
@@ -1322,7 +1322,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) {
@@ -1330,10 +1330,7 @@ public class Groovyc extends MatchingTask {
             }
 
             if (failOnError) {
-                log.error(message);
                 throw new BuildException("Compilation Failed", t, getLocation());
-            } else {
-                log.error(message);
             }
         }
     }