This is an automated email from the ASF dual-hosted git repository.
emilles pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/groovy.git
The following commit(s) were added to refs/heads/master by this push:
new a49438560b GROOVY-11666: add test case
a49438560b is described below
commit a49438560b56e97e83b19bef653bbad118f7c02d
Author: Eric Milles <[email protected]>
AuthorDate: Thu Jul 17 14:02:38 2025 -0500
GROOVY-11666: add test case
---
.../main/java/org/codehaus/groovy/ant/Groovyc.java | 90 +++++++++-------------
.../org/codehaus/groovy/ant/GroovycTest.xml | 78 +++++++++++--------
.../org/codehaus/groovy/ant/GroovycTest3.groovy | 26 +++++++
.../codehaus/groovy/ant/GroovycTest3Peer.groovy | 25 ++++++
.../org/codehaus/groovy/ant/GroovycTest.java | 26 +++++--
5 files changed, 154 insertions(+), 91 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 af5aaafb14..ae21dccf40 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
@@ -175,7 +175,7 @@ import java.util.StringTokenizer;
*/
public class Groovyc extends MatchingTask {
- private static final File[] EMPTY_FILE_ARRAY = new File[0];
+ private static final File[] EMPTY_FILE_ARRAY = {};
private final LoggingHelper log = new LoggingHelper(this);
@@ -303,8 +303,8 @@ public class Groovyc extends MatchingTask {
*
* @param version the bytecode compatibility level
*/
- public void setTargetBytecode(final String version) {
- this.targetBytecode = version;
+ public void setTargetBytecode(String version) {
+ targetBytecode = version;
}
/**
@@ -313,7 +313,7 @@ public class Groovyc extends MatchingTask {
* @return bytecode compatibility level. Can be one of the values in
{@link CompilerConfiguration#ALLOWED_JDKS}.
*/
public String getTargetBytecode() {
- return this.targetBytecode;
+ return targetBytecode;
}
/**
@@ -878,9 +878,8 @@ public class Groovyc extends MatchingTask {
}
compile();
- if (updatedProperty != null
- && taskSuccess
- && compileList.length != 0) {
+
+ if (taskSuccess && compileList.length > 0 && updatedProperty != null) {
getProject().setNewProperty(updatedProperty, "true");
}
}
@@ -902,21 +901,17 @@ public class Groovyc extends MatchingTask {
* @param files An array of filenames
*/
protected void scanDir(File srcDir, File destDir, String[] files) {
- GlobPatternMapper m = new GlobPatternMapper();
- SourceFileScanner sfs = new SourceFileScanner(this);
- File[] newFiles;
+ var gpm = new GlobPatternMapper();
+ var sfs = new SourceFileScanner(this);
for (String extension : getScriptExtensions()) {
- m.setFrom("*." + extension);
- m.setTo("*.class");
- newFiles = sfs.restrictAsFiles(files, srcDir, destDir, m);
- addToCompileList(newFiles);
+ gpm.setFrom("*." + extension);
+ gpm.setTo("*.class");
+ addToCompileList(sfs.restrictAsFiles(files, srcDir, destDir, gpm));
}
-
if (jointCompilation) {
- m.setFrom("*.java");
- m.setTo("*.class");
- newFiles = sfs.restrictAsFiles(files, srcDir, destDir, m);
- addToCompileList(newFiles);
+ gpm.setFrom("*.java");
+ gpm.setTo("*.class");
+ addToCompileList(sfs.restrictAsFiles(files, srcDir, destDir, gpm));
}
}
@@ -935,26 +930,20 @@ public class Groovyc extends MatchingTask {
* @return the list of files as an array
*/
public File[] getFileList() {
- return Arrays.copyOf(compileList, compileList.length);
+ return compileList.clone();
}
protected void checkParameters() throws BuildException {
- if (src == null) {
- throw new BuildException("srcdir attribute must be set!",
getLocation());
- }
- if (src.isEmpty()) {
+ if (src == null || src.isEmpty()) {
throw new BuildException("srcdir attribute must be set!",
getLocation());
}
if (destDir != null && !destDir.isDirectory()) {
- throw new BuildException("destination directory \""
- + destDir
- + "\" does not exist or is not a directory",
- getLocation());
+ throw new BuildException("destination directory \"" + destDir +
"\" does not exist or is not a directory", getLocation());
}
if (encoding != null && !Charset.isSupported(encoding)) {
- throw new BuildException("encoding \"" + encoding + "\" not
supported.");
+ throw new BuildException("encoding \"" + encoding + "\" not
supported.", getLocation());
}
}
@@ -1014,21 +1003,17 @@ public class Groovyc extends MatchingTask {
for (Map.Entry<String, Object> e : rc.getAttributeMap().entrySet()) {
String key = e.getKey();
- if ("depend".equals(key)
- || "encoding".equals(key)
- || "extdirs".equals(key)
- || "nativeheaderdir".equals(key)
- || "release".equals(key)
- || "source".equals(key)
- || "target".equals(key)) {
- switch (key) {
- case "nativeheaderdir":
- key = "h";
- break;
- case "release":
- key = "-" + key; // to get "--" when passed to javac
- break;
- default:
+ if (key.equals("depend")
+ || key.equals("encoding")
+ || key.equals("extdirs")
+ || key.equals("nativeheaderdir")
+ || key.equals("release")
+ || key.equals("source")
+ || key.equals("target")) {
+ if (key.equals("nativeheaderdir")) {
+ key = "h";
+ } else if (key.equals("release")) {
+ key = "-" + key; // to get "--" when passed to javac
}
// map "depend", "encoding", etc. to "-Jkey=val"
jointOptions.add("-J" + key + "=" +
getProject().replaceProperties(e.getValue().toString()));
@@ -1052,7 +1037,7 @@ public class Groovyc extends MatchingTask {
// map "modulepath" or "modulepathref" to "-J-module-path="
jointOptions.add("-J-module-path=" +
javac.getModulepath());
}
- } else if (!key.contains("debug") && !"deprecation".equals(key) &&
!"nowarn".equals(key) && !"verbose".equals(key)) {
+ } else if (!key.contains("debug") && !key.equals("deprecation") &&
!key.equals("nowarn") && !key.equals("verbose")) {
log.warn("The option " + key + " cannot be set on the
contained <javac> element. The option will be ignored.");
}
// TODO: defaultexcludes, excludes(file)?, includes(file)?,
includeDestClasses, tempdir
@@ -1061,10 +1046,10 @@ public class Groovyc extends MatchingTask {
// Ant's <javac> supports nested <compilerarg value=""> elements (there
// can be multiple of them) for additional options to be passed to
javac.
for (RuntimeConfigurable childrc : Collections.list(rc.getChildren()))
{
- if ("compilerarg".equals(childrc.getElementTag())) {
+ if (childrc.getElementTag().equals("compilerarg")) {
for (Map.Entry<String, Object> e :
childrc.getAttributeMap().entrySet()) {
String key = e.getKey();
- if ("value".equals(key)) {
+ if (key.equals("value")) {
String value =
getProject().replaceProperties(e.getValue().toString());
StringTokenizer st = new StringTokenizer(value, " ");
while (st.hasMoreTokens()) {
@@ -1124,7 +1109,7 @@ public class Groovyc extends MatchingTask {
cc.setTargetBytecode(targetBytecode); // GROOVY-10278: nearest
valid value
commandLineList.add("-Dgroovy.target.bytecode=" +
cc.getTargetBytecode());
}
- if (!"*.groovy".equals(getScriptExtension())) {
+ if (!getScriptExtension().equals("*.groovy")) {
String tmpExtension = getScriptExtension();
if (tmpExtension.startsWith("*."))
tmpExtension = tmpExtension.substring(1);
@@ -1177,7 +1162,7 @@ public class Groovyc extends MatchingTask {
* @param classpath
*/
private void doNormalCommandLineList(List<String> commandLineList,
List<String> jointOptions, Path classpath) {
- if (!fork) {
+ if (!fork && !classpath.isEmpty()) {
commandLineList.add("--classpath");
commandLineList.add(classpath.toString());
}
@@ -1286,8 +1271,7 @@ public class Groovyc extends MatchingTask {
// hand crank it so we can add our own compiler configuration
try {
FileSystemCompiler.CompilationOptions options = new
FileSystemCompiler.CompilationOptions();
- CommandLine parser = FileSystemCompiler.configureParser(options);
- parser.parseArgs(commandLine);
+ FileSystemCompiler.configureParser(options).parseArgs(commandLine);
configuration = options.toCompilerConfiguration();
configuration.setScriptExtensions(getScriptExtensions());
String tmpExtension = getScriptExtension();
@@ -1298,7 +1282,7 @@ public class Groovyc extends MatchingTask {
configuration.setTargetBytecode(targetBytecode);
}
- // Load the file name list
+ // load the file name list
String[] fileNames = options.generateFileNames();
boolean fileNameErrors = (fileNames == null ||
!FileSystemCompiler.validateFiles(fileNames));
if (!fileNameErrors) {
@@ -1436,7 +1420,7 @@ public class Groovyc extends MatchingTask {
}
}
- @SuppressWarnings("removal") // TODO a future Groovy version should
perform the operation not as a privileged action
+ @SuppressWarnings("removal") // TODO: a future Groovy version should
perform the operation not as a privileged action
GroovyClassLoader groovyLoader =
java.security.AccessController.doPrivileged((PrivilegedAction<GroovyClassLoader>)
() ->
new GroovyClassLoader(loader, configuration));
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 450003f999..1461b83cb7 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
@@ -22,7 +22,7 @@
<project name="Test Groovyc Task">
- <property name="srcPath" location="."/>
+ <property name="srcPath" location="../../../.."/><!-- aka test-resources
-->
<property name="destPath"
location="${user.dir}/build/classes/groovy/test"/>
<path id="groovyMaterials">
@@ -37,65 +37,65 @@
<presetdef name="compile-joint">
<groovyc srcdir="${srcPath}" destdir="${destPath}">
- <javac debug="true" release="8"/>
+ <javac debug="true" release="11"/>
</groovyc>
</presetdef>
<target name="GroovycTest1_NoFork_NoClasspath">
- <compile-plain includes="GroovycTest1.groovy"/>
+ <compile-plain includes="**/GroovycTest1.groovy"/>
<java classname="org.codehaus.groovy.ant.GroovycTest1"/>
</target>
<target name="GroovycTest1_NoFork_WithGroovyClasspath">
- <compile-plain includes="GroovycTest1.groovy"
classpathref="groovyMaterials"/>
+ <compile-plain includes="**/GroovycTest1.groovy"
classpathref="groovyMaterials"/>
<java classname="org.codehaus.groovy.ant.GroovycTest1"/>
</target>
<target name="GroovycTest1_NoFork_WithJavaClasspath">
- <compile-plain includes="GroovycTest1.groovy"/>
+ <compile-plain includes="**/GroovycTest1.groovy"/>
<java classname="org.codehaus.groovy.ant.GroovycTest1"
classpathref="groovyMaterials"/>
</target>
<target name="GroovycTest1_NoFork_WithBothClasspath">
- <compile-plain includes="GroovycTest1.groovy"
classpathref="groovyMaterials"/>
+ <compile-plain includes="**/GroovycTest1.groovy"
classpathref="groovyMaterials"/>
<java classname="org.codehaus.groovy.ant.GroovycTest1"
classpathref="groovyMaterials"/>
</target>
<target name="GroovycTest1_ForkGroovy_NoClasspath">
- <compile-plain includes="GroovycTest1.groovy" fork="true"/>
+ <compile-plain includes="**/GroovycTest1.groovy" fork="true"/>
<java classname="org.codehaus.groovy.ant.GroovycTest1"/>
</target>
<target name="GroovycTest1_ForkGroovy_WithGroovyClasspath">
- <compile-plain includes="GroovycTest1.groovy"
classpathref="groovyMaterials" fork="true"/>
+ <compile-plain includes="**/GroovycTest1.groovy"
classpathref="groovyMaterials" fork="true"/>
<java classname="org.codehaus.groovy.ant.GroovycTest1"/>
</target>
<target name="GroovycTest1_ForkGroovy_WithJavaClasspath">
- <compile-plain includes="GroovycTest1.groovy" fork="true"/>
+ <compile-plain includes="**/GroovycTest1.groovy" fork="true"/>
<java classname="org.codehaus.groovy.ant.GroovycTest1"
classpathref="groovyMaterials"/>
</target>
<target name="GroovycTest1_ForkGroovy_WithBothClasspath">
- <compile-plain includes="GroovycTest1.groovy"
classpathref="groovyMaterials" fork="true"/>
+ <compile-plain includes="**/GroovycTest1.groovy"
classpathref="groovyMaterials" fork="true"/>
<java classname="org.codehaus.groovy.ant.GroovycTest1"
classpathref="groovyMaterials"/>
</target>
<target name="GroovycTest1_Joint_NoFork_NoClasspath">
- <compile-joint includes="GroovycTest1.groovy,GroovyTest2.java"/>
+ <compile-joint includes="**/GroovycTest1.groovy,**/GroovyTest2.java"/>
<java classname="org.codehaus.groovy.ant.GroovycTest1"/>
<java classname="org.codehaus.groovy.ant.GroovycTest2"/>
</target>
<target name="GroovycTest1_Joint_NoFork_WithGroovyClasspath">
- <compile-joint includes="GroovycTest1.groovy,GroovycTest2.java"
classpathref="groovyMaterials"/>
+ <compile-joint includes="**/GroovycTest1.groovy,**/GroovycTest2.java"
classpathref="groovyMaterials"/>
<java classname="org.codehaus.groovy.ant.GroovycTest1"/>
<java classname="org.codehaus.groovy.ant.GroovycTest2"/>
</target>
<target name="Groovyc_Joint_NoFork_NestedCompilerArg_WithGroovyClasspath">
- <compile-joint includes="IncorrectGenericsUsage.java"
classpathref="groovyMaterials">
+ <compile-joint includes="**/IncorrectGenericsUsage.java"
classpathref="groovyMaterials">
<javac>
<compilerarg value="-Xlint"/>
</javac>
@@ -103,67 +103,67 @@
</target>
<target name="GroovycTest1_Joint_NoFork_WithJavaClasspath">
- <compile-joint includes="GroovycTest1.groovy,GroovycTest2.java"/>
+ <compile-joint includes="**/GroovycTest1.groovy,**/GroovycTest2.java"/>
<java classname="org.codehaus.groovy.ant.GroovycTest1"
classpathref="groovyMaterials"/>
<java classname="org.codehaus.groovy.ant.GroovycTest2"
classpathref="groovyMaterials"/>
</target>
<target name="GroovycTest1_Joint_NoFork_WithBothClasspath">
- <compile-joint includes="GroovycTest1.groovy,GroovycTest2.java"
classpathref="groovyMaterials"/>
+ <compile-joint includes="**/GroovycTest1.groovy,**/GroovycTest2.java"
classpathref="groovyMaterials"/>
<java classname="org.codehaus.groovy.ant.GroovycTest1"
classpathref="groovyMaterials"/>
<java classname="org.codehaus.groovy.ant.GroovycTest2"
classpathref="groovyMaterials"/>
</target>
<target name="GroovycTest1_Joint_ForkGroovy_NoClasspath">
- <compile-joint includes="GroovycTest1.groovy,GroovycTest2.java"
fork="true"/>
+ <compile-joint includes="**/GroovycTest1.groovy,**/GroovycTest2.java"
fork="true"/>
<java classname="org.codehaus.groovy.ant.GroovycTest1"/>
<java classname="org.codehaus.groovy.ant.GroovycTest2"/>
</target>
<target name="GroovycTest1_Joint_ForkGroovy_WithGroovyClasspath">
- <compile-joint includes="GroovycTest1.groovy,GroovycTest2.java"
fork="true" classpathref="groovyMaterials"/>
+ <compile-joint includes="**/GroovycTest1.groovy,**/GroovycTest2.java"
fork="true" classpathref="groovyMaterials"/>
<java classname="org.codehaus.groovy.ant.GroovycTest1"/>
<java classname="org.codehaus.groovy.ant.GroovycTest2"/>
</target>
<target name="GroovycTest1_Joint_ForkGroovy_WithJavaClasspath">
- <compile-joint includes="GroovycTest1.groovy,GroovycTest2.java"
fork="true"/>
+ <compile-joint includes="**/GroovycTest1.groovy,**/GroovycTest2.java"
fork="true"/>
<java classname="org.codehaus.groovy.ant.GroovycTest1"
classpathref="groovyMaterials"/>
<java classname="org.codehaus.groovy.ant.GroovycTest2"
classpathref="groovyMaterials"/>
</target>
<target name="GroovycTest1_Joint_ForkGroovy_WithBothClasspath">
- <compile-joint includes="GroovycTest1.groovy,GroovycTest2.java"
fork="true" classpathref="groovyMaterials"/>
+ <compile-joint includes="**/GroovycTest1.groovy,**/GroovycTest2.java"
fork="true" classpathref="groovyMaterials"/>
<java classname="org.codehaus.groovy.ant.GroovycTest1"
classpathref="groovyMaterials"/>
<java classname="org.codehaus.groovy.ant.GroovycTest2"
classpathref="groovyMaterials"/>
</target>
<target name="GroovycTest1_ForkGroovy_NoClasspath_WithJavaHome">
- <compile-plain includes="GroovycTest1.groovy" fork="true"
javahome="${alt.java.home}"/>
+ <compile-plain includes="**/GroovycTest1.groovy" fork="true"
javahome="${alt.java.home}"/>
<java classname="org.codehaus.groovy.ant.GroovycTest1"/>
</target>
<target name="GroovycTest1_ForkGroovy_WithGroovyClasspath_WithJavaHome">
- <compile-plain includes="GroovycTest1.groovy"
classpathref="groovyMaterials" fork="true" javahome="${alt.java.home}"/>
+ <compile-plain includes="**/GroovycTest1.groovy"
classpathref="groovyMaterials" fork="true" javahome="${alt.java.home}"/>
<java classname="org.codehaus.groovy.ant.GroovycTest1"/>
</target>
<target name="GroovycTest1_ForkGroovy_WithJavaClasspath_WithJavaHome">
- <compile-plain includes="GroovycTest1.groovy" fork="true"
javahome="${alt.java.home}"/>
+ <compile-plain includes="**/GroovycTest1.groovy" fork="true"
javahome="${alt.java.home}"/>
<java classname="org.codehaus.groovy.ant.GroovycTest1"
classpathref="groovyMaterials"/>
</target>
<target name="GroovycTest1_ForkGroovy_WithBothClasspath_WithJavaHome">
- <compile-plain includes="GroovycTest1.groovy"
classpathref="groovyMaterials" fork="true" javahome="${alt.java.home}"/>
+ <compile-plain includes="**/GroovycTest1.groovy"
classpathref="groovyMaterials" fork="true" javahome="${alt.java.home}"/>
<java classname="org.codehaus.groovy.ant.GroovycTest1"
classpathref="groovyMaterials"/>
</target>
<target name="GroovycTest1_ForkGroovy_NoClasspath_Fail">
- <compile-plain includes="GroovyTestBad1.groovy" fork="true"/>
+ <compile-plain includes="**/GroovyTestBad1.groovy" fork="true"/>
</target>
<target name="noForkNoAntRuntime">
- <compile-plain includes="GroovycTest1.groovy" fork="false"
includeAntRuntime="false"/>
+ <compile-plain includes="**/GroovycTest1.groovy" fork="false"
includeAntRuntime="false"/>
</target>
<!-- GROOVY-9197 -->
@@ -173,7 +173,7 @@
<fileset file="commons-lang3-3.17.0.jar"/>
</path>
- <compile-joint fork="true" includeantruntime="false"
includes="MakesExternalReference.java">
+ <compile-joint fork="true" includeantruntime="false"
includes="**/MakesExternalReference.java">
<classpath refid="the.classpath"/>
</compile-joint>
@@ -182,7 +182,7 @@
<!-- GROOVY-11573 -->
<target name="jointForkedCompilation_ParameterMetadataCheck">
- <compile-joint fork="true" configscript="params.groovy"
includes="ParameterMetadataCheck.java"/>
+ <compile-joint fork="true" configscript="params.groovy"
includes="**/ParameterMetadataCheck.java"/>
<java classname="org.codehaus.groovy.ant.ParameterMetadataCheck"/>
</target>
@@ -191,21 +191,39 @@
<groovyc destdir="${destPath}" fork="true">
<src>
<fileset dir="${srcPath}">
- <include name="GroovycTest*.*"/>
- <exclude name="GroovycTest.xml"/>
- <exclude name="GroovycTest2.java"/>
+ <include name="**/GroovycTest*.*"/>
+ <exclude name="**/GroovycTest.xml"/>
+ <exclude name="**/GroovycTest2.java"/>
</fileset>
</src>
</groovyc>
<java classname="org.codehaus.groovy.ant.GroovycTest1"/>
</target>
+ <!-- GROOVY-11666 -->
+ <target name="incrementalCompilation">
+ <compile-plain includes="**/GroovycTest3*.groovy"/>
+
+ <local name="boo"/>
+ <compile-plain includes="**/GroovycTest3.groovy"
updatedProperty="boo"/>
+ <fail if="boo" message="GroovycTest3.groovy was re-compiled"/>
+
+ <touch file="GroovycTest3.groovy"/>
+
+ <local name="yay"/>
+ <compile-plain includes="**/GroovycTest3.groovy"
updatedProperty="yay"/>
+ <fail unless="yay" message="GroovycTest3.groovy was not re-compiled"/>
+
+ <java classname="org.codehaus.groovy.ant.GroovycTest3"/>
+ </target>
+
<target name="clean">
<delete quiet="true">
<fileset dir="${destPath}/org/codehaus/groovy/ant">
<include name="*_Result.txt"/>
<include name="GroovycTest1*.class"/>
<include name="GroovycTest2*.class"/>
+ <include name="GroovycTest3*.class"/>
<include name="IncorrectGenericsUsage.class"/>
<include name="MakesExternalReference.class"/>
<include name="ParameterMetadataCheck.class"/>
diff --git
a/subprojects/groovy-ant/src/test-resources/org/codehaus/groovy/ant/GroovycTest3.groovy
b/subprojects/groovy-ant/src/test-resources/org/codehaus/groovy/ant/GroovycTest3.groovy
new file mode 100644
index 0000000000..486a47c8fd
--- /dev/null
+++
b/subprojects/groovy-ant/src/test-resources/org/codehaus/groovy/ant/GroovycTest3.groovy
@@ -0,0 +1,26 @@
+/*
+ * 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.
+ */
+package org.codehaus.groovy.ant
+
+class GroovycTest3 {
+ static main(args) {
+ def file = new
File("build/classes/groovy/test/${getCanonicalName().replace('.','/')}_Result.txt")
+ file.write(new GroovycTest3Peer().OK)
+ }
+}
diff --git
a/subprojects/groovy-ant/src/test-resources/org/codehaus/groovy/ant/GroovycTest3Peer.groovy
b/subprojects/groovy-ant/src/test-resources/org/codehaus/groovy/ant/GroovycTest3Peer.groovy
new file mode 100644
index 0000000000..66e30d0386
--- /dev/null
+++
b/subprojects/groovy-ant/src/test-resources/org/codehaus/groovy/ant/GroovycTest3Peer.groovy
@@ -0,0 +1,25 @@
+/*
+ * 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.
+ */
+package org.codehaus.groovy.ant
+
+import groovy.transform.PackageScope
+
+class GroovycTest3Peer {
+ @PackageScope String OK = 'OK.'
+}
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 4ef68b2151..2919249ed7 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
@@ -22,6 +22,7 @@ import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.ProjectHelper;
import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import java.io.ByteArrayOutputStream;
@@ -39,6 +40,7 @@ import static groovy.test.GroovyAssert.isAtLeastJdk;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
+import static org.junit.jupiter.api.Assumptions.assumeFalse;
/**
* Unit tests for the {@link Groovyc} ant task.
@@ -192,25 +194,25 @@ final class GroovycTest {
@Test
void testGroovycTest1_NoFork_NoClasspath() {
- if (isAtLeastJdk("18.0")) return; // GROOVY-10479
+ assumeFalse(isAtLeastJdk("18.0")); // GROOVY-10479
ensureExecutes("GroovycTest1_NoFork_NoClasspath");
}
@Test
void testGroovycTest1_NoFork_WithGroovyClasspath() {
- if (isAtLeastJdk("18.0")) return; // GROOVY-10479
+ assumeFalse(isAtLeastJdk("18.0")); // GROOVY-10479
ensureExecutes("GroovycTest1_NoFork_WithGroovyClasspath");
}
@Test
void testGroovycTest1_NoFork_WithJavaClasspath() {
- if (isAtLeastJdk("18.0")) return; // GROOVY-10479
+ assumeFalse(isAtLeastJdk("18.0")); // GROOVY-10479
ensureExecutes("GroovycTest1_NoFork_WithJavaClasspath");
}
@Test
void testGroovycTest1_NoFork_WithBothClasspath() {
- if (isAtLeastJdk("18.0")) return; // GROOVY-10479
+ assumeFalse(isAtLeastJdk("18.0")); // GROOVY-10479
ensureExecutes("GroovycTest1_NoFork_WithBothClasspath");
}
@@ -236,13 +238,13 @@ final class GroovycTest {
@Test
void testGroovycTest1_Joint_NoFork_NoClasspath() {
- if (isAtLeastJdk("18.0")) return; // GROOVY-10479
+ assumeFalse(isAtLeastJdk("18.0")); // GROOVY-10479
ensureExecutes("GroovycTest1_Joint_NoFork_NoClasspath");
}
@Test
void testGroovycTest1_Joint_NoFork_WithGroovyClasspath() {
- if (isAtLeastJdk("18.0")) return; // GROOVY-10479
+ assumeFalse(isAtLeastJdk("18.0")); // GROOVY-10479
ensureExecutes("GroovycTest1_Joint_NoFork_WithGroovyClasspath");
}
@@ -271,13 +273,13 @@ final class GroovycTest {
@Test
void testGroovycTest1_Joint_NoFork_WithJavaClasspath() {
- if (isAtLeastJdk("18.0")) return; // GROOVY-10479
+ assumeFalse(isAtLeastJdk("18.0")); // GROOVY-10479
ensureExecutes("GroovycTest1_Joint_NoFork_WithJavaClasspath");
}
@Test
void testGroovycTest1_Joint_NoFork_WithBothClasspath() {
- if (isAtLeastJdk("18.0")) return; // GROOVY-10479
+ assumeFalse(isAtLeastJdk("18.0")); // GROOVY-10479
ensureExecutes("GroovycTest1_Joint_NoFork_WithBothClasspath");
}
@@ -357,4 +359,12 @@ final class GroovycTest {
ensureExecutes("plainForkedCompilation_NestingSrcElementCheck");
ensureNotPresent("GroovycTest2");
}
+
+ // GROOVY-11666
+ @Disabled @Test
+ void testRestrictionForIncrementalCompilation() {
+ ensureNotPresent("GroovycTest3");
+ project.executeTarget("incrementalCompilation");
+ ensureResultOK("GroovycTest3");
+ }
}