You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@groovy.apache.org by pa...@apache.org on 2020/03/21 10:13:47 UTC
[groovy] 02/02: split groovyc Ant task doco into separate file
This is an automated email from the ASF dual-hosted git repository.
paulk pushed a commit to branch GROOVY_3_0_X
in repository https://gitbox.apache.org/repos/asf/groovy.git
commit 5e4283b3c8a58af42a44e40a5ce1d538ad38ca22
Author: Paul King <pa...@asert.com.au>
AuthorDate: Sat Mar 21 20:09:38 2020 +1000
split groovyc Ant task doco into separate file
---
src/spec/doc/tools-groovyc.adoc | 190 +------------------
.../groovy-ant/src/spec/doc/groovyc-ant-task.adoc | 204 +++++++++++++++++++++
2 files changed, 207 insertions(+), 187 deletions(-)
diff --git a/src/spec/doc/tools-groovyc.adoc b/src/spec/doc/tools-groovyc.adoc
index 6d81049..6193db6 100644
--- a/src/spec/doc/tools-groovyc.adoc
+++ b/src/spec/doc/tools-groovyc.adoc
@@ -61,192 +61,8 @@ a number of command line switches:
== Ant task
-[[ThegroovycAntTask-groovyc]]
-`<groovyc>`
-~~~~~~~~~~~
-
-[[ThegroovycAntTask-Description]]
-Description
-^^^^^^^^^^^
-
-Compiles Groovy source files and, if joint compilation option is used, Java source files.
-
-[[ThegroovycAntTask-Requiredtaskdef]]
-Required taskdef
-^^^^^^^^^^^^^^^^
-
-Assuming the groovy jars are in _groovy.libs_, you will need to declare this task
-at some point in the `build.xml` prior to the `groovyc` task being invoked.
-
-[source,xml]
------------------------------------------------------------------------
-<taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc">
- <classpath>
- <fileset file="${groovy.libs}/groovy-ant-VERSION.jar"/>
- <fileset file="${groovy.libs}/groovy-VERSION.jar"/>
- </classpath>
-</taskdef>
------------------------------------------------------------------------
-
-[[ThegroovycAntTask-groovycAttributes]]
-<groovyc> Attributes
-^^^^^^^^^^^^^^^^^^^^
-
-[cols="<,<,<",options="header,footer"]
-|=======================================================================
-|Attribute |Description |Required
-
-|srcdir |Location of the Groovy (and possibly Java) source files. |Yes
-
-|destdir |Location to store the class files. |Yes
-
-|classpath |The classpath to use. |No
-
-|classpathref |The classpath to use given as a path references. |No
-
-|sourcepath |The sourcepath to use. |No
-
-|sourcepathref |The sourcepath to use given as a path reference. |No
-
-|encoding |Encoding of source files. |No
-
-|verbose |Asks the compiler for verbose output; defaults to no. |No
-
-|includeAntRuntime |Whether to include the Ant run-time libraries in the
-classpath; defaults to yes. |No
-
-|includeJavaRuntime |Whether to include the default run-time libraries
-from the executing VM in the classpath; defaults to no. |No
-
-|includeDestClasses |This property controls whether to include the destination
-classes directory in the classpath given to the compiler. The default value is "true". |No
-
-|fork |Whether to execute groovyc using a spawned instance of the JVM;
-defaults to no. |No
-
-|memoryInitialSize |The initial size of the memory for the underlying
-VM, if using fork mode; ignored otherwise. Defaults to the standard VM
-memory setting. (Examples: 83886080, 81920k, or 80m) |No
-
-|memoryMaximumSize |The maximum size of the memory for the underlying
-VM, if using fork mode; ignored otherwise. Defaults to the standard VM
-memory setting. (Examples: 83886080, 81920k, or 80m) |No
-
-|failonerror |Indicates whether compilation errors will fail the build;
-defaults to true. |No
-
-|proceed |Inverse alias for _failonerror_. |No
-
-|listfiles |Indicates whether the source files to be compiled will be
-listed; defaults to no. |No
-
-|stacktrace |if true each compile error message will contain a
-stacktrace |No
-
-|indy |Enable compilation with the ``invoke dynamic'' support when using
-Groovy 2.0 and beyond and running on JDK 7 |No
-
-|scriptBaseClass |Sets the base class for Groovy scripts |No
-
-|stubdir |Set the stub directory into which the Java source stub files should be generated.
-The directory need not exist and will not be deleted automatically - though its contents
-will be cleared unless 'keepStubs' is true. Ignored when forked. |No
-
-|keepStubs |Set the keepStubs flag. Defaults to false. Set to true for debugging.
-Ignored when forked. |No
-
-|forceLookupUnnamedFiles |The Groovyc Ant task is frequently used in the context of a build system
-that knows the complete list of source files to be compiled. In such a
-context, it is wasteful for the Groovy compiler to go searching the
-classpath when looking for source files and hence by default the
-Groovyc Ant task calls the compiler in a special mode with such searching
-turned off. If you wish the compiler to search for source files then
-you need to set this flag to true. Defaults to false. |No
-
-|configscript |Set the configuration file used to customize the compilation configuration. |No
-
-|parameters |Generates metadata for reflection on method parameter names on JDK 8 and above.
-Defaults to false. |No
-
-|previewFeatures |Enables the JEP preview features on JDK 12 and above.
-Defaults to false. |No
-
-|targetBytecode |Sets the bytecode compatibility level. |No
-
-|javahome |Sets the `java.home` value to use, default is the current JDK's home. |No
-
-|executable |Sets the name of the java executable to use when invoking the compiler in forked mode,
-ignored otherwise. |No
-
-|scriptExtension |Set the extension to use when searching for Groovy source files.
-Accepts extensions in the form *.groovy, .groovy or groovy. |No
-
-|updatedProperty |The property to set on compilation success. This property will not be set if
-the compilation fails, or if there are no files to compile. |No
-
-|errorProperty |The property to set on compilation failure. This property will be set if
-the compilation fails. |No
-
-|=======================================================================
-
-*Example:*
-
-[source,xml]
------------------------------------------------------------------------
-<path id="classpath.main">
- <fileset dir="${groovy.libs}" includes="*.jar" excludes="groovy-ant-*.jar"/>
- ...
-</path>
-<groovyc srcdir="${dir.sources}" destdir="${dir.classes}" classpathref="classpath.main"
- fork="true" includeantruntime="false" configscript="config.groovy" targetBytecode="1.8"/>
------------------------------------------------------------------------
-
-
-[[ThegroovycAntTask-groovycNestedElements]]
-<groovyc> Nested Elements
-^^^^^^^^^^^^^^^^^^^^^^^^^
-
-[cols="<,<,<,<",options="header,footer"]
-|==========================================================
-|element |kind |Required |Replaces Attribute
-|src |a path structure |Yes (unless srcdir is used) |srcdir
-|classpath |a path structure |No |classpath or classpathref
-|javac |javac task |No |N/A
-|==========================================================
-
-*Notes:*
-
-* For path structures see for example
-http://ant.apache.org/manual/using.html#path
-* For usages of the `javac` task see
-https://ant.apache.org/manual/Tasks/javac.html
-* The nested `javac` task behaves more or less as documented for the top-level
-`javac` task. `srcdir`, `destdir`, `classpath`, `encoding` and `parameters`
-for the nested `javac` task are taken from the enclosing `groovyc` task. If
-these attributes are specified then they are added, they do not replace. In fact,
-you should not attempt to overwrite the destination. Other attributes and nested
-elements are unaffected, for example `fork`, `memoryMaximumSize`, etc. may be
-used freely.
-
-[[ThegroovycAntTask-JointCompilation]]
-Joint Compilation
-^^^^^^^^^^^^^^^^^
-
-Joint compilation is enabled by using an embedded `javac` element, as shown in the following example:
-
-[source,xml]
------------------------------------------------------------------------
-<groovyc srcdir="${testSourceDirectory}" destdir="${testClassesDirectory}" targetBytecode="1.8">
- <classpath>
- <pathelement path="${mainClassesDirectory}"/>
- <pathelement path="${testClassesDirectory}"/>
- <path refid="testPath"/>
- </classpath>
- <javac debug="true" source="1.8" target="1.8" />
-</groovyc>
------------------------------------------------------------------------
-
-More details about joint compilation can be found in the <<section-jointcompilation,joint compilation>> section.
+See the <<groovyc-ant-task.adoc#ThegroovycAntTask-groovyc,groovyc Ant task>> documentation.
+It allows the Groovy compiler to be invoked from http://ant.apache.org/[Apache Ant].
[[Gant]]
== Gant
@@ -433,7 +249,7 @@ for the Ant task.
It is important to know that if you don't enable joint compilation and try to compile
Java source files with the Groovy compiler, the Java source files will be compiled as
if they were Groovy sources. In some situations, this might work since most of the Java
-syntax is compatible with Groovy, but semantics would be different.
+syntax is compatible with Groovy, but there are a number of places where semantics could be different.
[[section-android]]
== Android support
diff --git a/subprojects/groovy-ant/src/spec/doc/groovyc-ant-task.adoc b/subprojects/groovy-ant/src/spec/doc/groovyc-ant-task.adoc
new file mode 100644
index 0000000..d157d5f
--- /dev/null
+++ b/subprojects/groovy-ant/src/spec/doc/groovyc-ant-task.adoc
@@ -0,0 +1,204 @@
+//////////////////////////////////////////
+
+ 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.
+
+//////////////////////////////////////////
+
+= The <groovyc> Ant Task
+
+[[ThegroovycAntTask-groovyc]]
+== `<groovyc>`
+
+[[ThegroovycAntTask-Description]]
+=== Description
+
+Compiles Groovy source files and, if joint compilation option is used, Java source files from http://ant.apache.org/[Apache Ant].
+
+[[ThegroovycAntTask-Requiredtaskdef]]
+=== Required taskdef
+
+Assuming the groovy jars are in _groovy.libs_, you will need to declare this task
+at some point in the `build.xml` prior to the `groovyc` task being invoked.
+Consider also adding any additional Groovy module jars, libraries and potentially transitive dependencies you might be using.
+
+[source,xml]
+-----------------------------------------------------------------------
+<taskdef name="groovyc" classname="org.codehaus.groovy.ant.Groovyc">
+ <classpath>
+ <fileset file="${groovy.libs}/groovy-ant-VERSION.jar"/>
+ <fileset file="${groovy.libs}/groovy-VERSION.jar"/>
+ </classpath>
+</taskdef>
+-----------------------------------------------------------------------
+
+[[ThegroovycAntTask-groovycAttributes]]
+=== <groovyc> Attributes
+
+[cols="<,<,<",options="header,footer"]
+|=======================================================================
+|Attribute |Description |Required
+
+|srcdir |Location of the Groovy (and possibly Java) source files. |Yes
+
+|destdir |Location to store the class files. |Yes
+
+|classpath |The classpath to use. |No
+
+|classpathref |The classpath to use given as a path references. |No
+
+|sourcepath |The sourcepath to use. |No
+
+|sourcepathref |The sourcepath to use given as a path reference. |No
+
+|encoding |Encoding of source files. |No
+
+|verbose |Asks the compiler for verbose output; defaults to no. |No
+
+|includeAntRuntime |Whether to include the Ant run-time libraries in the
+classpath; defaults to yes. |No
+
+|includeJavaRuntime |Whether to include the default run-time libraries
+from the executing VM in the classpath; defaults to no. |No
+
+|includeDestClasses |This property controls whether to include the destination
+classes directory in the classpath given to the compiler. The default value is "true". |No
+
+|fork |Whether to execute groovyc using a spawned instance of the JVM;
+defaults to no. |No
+
+|memoryInitialSize |The initial size of the memory for the underlying
+VM, if using fork mode; ignored otherwise. Defaults to the standard VM
+memory setting. (Examples: 83886080, 81920k, or 80m) |No
+
+|memoryMaximumSize |The maximum size of the memory for the underlying
+VM, if using fork mode; ignored otherwise. Defaults to the standard VM
+memory setting. (Examples: 83886080, 81920k, or 80m) |No
+
+|failonerror |Indicates whether compilation errors will fail the build;
+defaults to true. |No
+
+|proceed |Inverse alias for _failonerror_. |No
+
+|listfiles |Indicates whether the source files to be compiled will be
+listed; defaults to no. |No
+
+|stacktrace |if true each compile error message will contain a
+stacktrace |No
+
+|indy |Enable compilation with the ``invoke dynamic'' support when using
+Groovy 2.0 and beyond and running on JDK 7 |No
+
+|scriptBaseClass |Sets the base class for Groovy scripts |No
+
+|stubdir |Set the stub directory into which the Java source stub files should be generated.
+The directory need not exist and will not be deleted automatically - though its contents
+will be cleared unless 'keepStubs' is true. Ignored when forked. |No
+
+|keepStubs |Set the keepStubs flag. Defaults to false. Set to true for debugging.
+Ignored when forked. |No
+
+|forceLookupUnnamedFiles |The Groovyc Ant task is frequently used in the context of a build system
+that knows the complete list of source files to be compiled. In such a
+context, it is wasteful for the Groovy compiler to go searching the
+classpath when looking for source files and hence by default the
+Groovyc Ant task calls the compiler in a special mode with such searching
+turned off. If you wish the compiler to search for source files then
+you need to set this flag to true. Defaults to false. |No
+
+|configscript |Set the configuration file used to customize the compilation configuration. |No
+
+|parameters |Generates metadata for reflection on method parameter names on JDK 8 and above.
+Defaults to false. |No
+
+|previewFeatures |Enables the JEP preview features on JDK 12 and above.
+Defaults to false. |No
+
+|targetBytecode |Sets the bytecode compatibility level. |No
+
+|javahome |Sets the `java.home` value to use, default is the current JDK's home. |No
+
+|executable |Sets the name of the java executable to use when invoking the compiler in forked mode,
+ignored otherwise. |No
+
+|scriptExtension |Set the extension to use when searching for Groovy source files.
+Accepts extensions in the form *.groovy, .groovy or groovy. |No
+
+|updatedProperty |The property to set on compilation success. This property will not be set if
+the compilation fails, or if there are no files to compile. |No
+
+|errorProperty |The property to set on compilation failure. This property will be set if
+the compilation fails. |No
+
+|=======================================================================
+
+*Example:*
+
+[source,xml]
+-----------------------------------------------------------------------
+<path id="classpath.main">
+ <fileset dir="${groovy.libs}" includes="*.jar" excludes="groovy-ant-*.jar"/>
+ ...
+</path>
+<groovyc srcdir="${dir.sources}" destdir="${dir.classes}" classpathref="classpath.main"
+ fork="true" includeantruntime="false" configscript="config.groovy" targetBytecode="1.8"/>
+-----------------------------------------------------------------------
+
+
+[[ThegroovycAntTask-groovycNestedElements]]
+=== <groovyc> Nested Elements
+
+[cols="<,<,<,<",options="header,footer"]
+|==========================================================
+|element |kind |Required |Replaces Attribute
+|src |a path structure |Yes (unless srcdir is used) |srcdir
+|classpath |a path structure |No |classpath or classpathref
+|javac |javac task |No |N/A
+|==========================================================
+
+*Notes:*
+
+* For path structures see for example
+http://ant.apache.org/manual/using.html#path
+* For usages of the `javac` task see
+https://ant.apache.org/manual/Tasks/javac.html
+* The nested `javac` task behaves more or less as documented for the top-level
+`javac` task. `srcdir`, `destdir`, `classpath`, `encoding` and `parameters`
+for the nested `javac` task are taken from the enclosing `groovyc` task. If
+these attributes are specified then they are added, they do not replace. In fact,
+you should not attempt to overwrite the destination. Other attributes and nested
+elements are unaffected, for example `fork`, `memoryMaximumSize`, etc. may be
+used freely.
+
+[[ThegroovycAntTask-JointCompilation]]
+=== Joint Compilation
+
+Joint compilation is enabled by using an embedded `javac` element, as shown in the following example:
+
+[source,xml]
+-----------------------------------------------------------------------
+<groovyc srcdir="${testSourceDirectory}" destdir="${testClassesDirectory}" targetBytecode="1.8">
+ <classpath>
+ <pathelement path="${mainClassesDirectory}"/>
+ <pathelement path="${testClassesDirectory}"/>
+ <path refid="testPath"/>
+ </classpath>
+ <javac debug="true" source="1.8" target="1.8" />
+</groovyc>
+-----------------------------------------------------------------------
+
+More details about joint compilation can be found in the <<tools-groovyc.adoc#section-jointcompilation,joint compilation>> section.