Remote Ant Script Execution

OpenVMS Ant Tasks
OpenVMS-Specific Custom Tasks

      vmscc
      vmscxx
      vmslink
      vmsdcl
Build Script Example

Using Ant from a DCL Prompt

Ant is a Java and XML based build tool created by the Apache Software Foundation.
The NetBeans IDE has a built-in Ant support module. You can create, edit, and execute XML-based Ant scripts within the IDE. The Core IDE Help provides documentation about the Ant support module. For more information about Ant in general, see http://ant.apache.org and the Ant Manual at http://ant.apache.org/manual/index.html.

OpenVMS Ant Tasks

Using Ant involves defining a target and a set of tasks in an Ant build script. Ant provides a rich set of built-in tasks that can be executed in the user defined target, and can be extended by defining custom tasks.

HP has augmented the standard Ant tasks with some additional custom tasks that are useful for OpenVMS customers. You can remotely execute Ant's built-in tasks and the custom tasks shown in the following table.

Task Purpose
vmscc Execute the C compiler
vmscxx Execute the CXX compiler
vmslink Execute a link command
vmsdcl Execute a DCL command

  To execute an Ant script on the remote OpenVMS system

1.  Create an Ant script under the remote file system.

2.  Create a target using the tasks.

3.  In the NetBeans IDE, click the Filesystems tab.

4.  Select the remote system.

5.  Right click on the Ant script, which has an Ant icon next to it.

6.  Select the target using Remote Run Target action.

The Remote Execute action will execute the default Ant target, or use the Remote Toolbar.

 

   

    

 

OpenVMS-Specific Custom Tasks

vmscc

The vmscc task is a custom Ant task that invokes the C compiler on OpenVMS. It recursively scans the source directory and compiles the C sources. The source directory and the list of files to be compiled can be configured by the task's parameters. Only the files that have no corresponding object file, or where the object file is older than the source file, will be compiled.

The following table lists the attributes that the vmscc task accepts.

vmscc  Attribute
Description
Required
srcdir Root directory of the C sources Yes
includes Comma- or space-separated list of files (may be specified using wildcard patterns) that must be included; all C source files are included when omitted No
includesfile The name of a file that contains a list of files to include (may be specified using wildcard patterns) No
excludes Comma- or space-separated list of files (may be specified using wildcard patterns) that must be excluded; no files (except default excludes) are excluded when omitted No
excludesfile The name of a file that contains a list of files to exclude (may be specified using wildcard patterns) No
failonerror Indicates whether the build should stop if there are compilation errors; defaults to true No
listfiles If true, list the source files being handed off to the compiler No
cmd C compiler command to execute; defaults to cc No
qualifiers C compiler qualifiers such as /debug, /opt No
srcext C source file extensions; defaults to .cc, .c No
objext C object file extensions; default to .obj No
noon If true, errors during compilation of multiple files in one vmscc task will not cause the task to abort No

Examples for vmscc

The following target compiles all of the sources under the testcc directory using the /debug qualifier:

<target name="vmscc" >
<vmscc srcdir="testcc" qualifiers="/debug" />
</target>

The following target compiles all of the sources under the testcc/src1 and testcc/src2 directories, but skips the files under the testcc/obj directory:

<target name="vmscc" >
<vmscc srcdir="testcc" includes="src1/**, src2/**" excludes="obj/**" />
</target>

The following target compiles all of the sources under testcc with the extension .c and .cext. Files with .cobj extensions are considered as corresponding object files.

<target name="vmscc" >
<vmscc srcdir="testcc" srcext="c, cext" objext="cobj,"/>
</target>

The following target compiles all of the sources under testcc/subfolder using ccc as a compiler command.
The list of files to be compiled is displayed, and an Ant script build process does not stop even if the compilation fails.

<target name="vmscc" >
<vmscc cmd="ccc" listfiles="true" failonerror="true">
<src path="testcc"/>
<include name="subfolder/**"/>
</vmscc>
</target>

vmscxx

vmscxx is a custom Ant task that invokes the C++ compiler on OpenVMS. It recursively scans the source directory and compiles the C++ sources. The source directory and the list of files to be compiled can be configured by the task's parameters. Only files that have no corresponding object file or where the object file is older than the source file will be compiled.

The following the table of parameters that vmscxx task accepts.

vmscxx Attribute
Description
Required
srcdir Root directory of the C++ sources Yes
includes Comma- or space-separated list of files (may be specified using wildcard patterns) that must be included; all C++ source files are included when omitted No
includesfile The name of a file that contains a list of files to include (may be specified using wildcard patterns) No
excludes Comma- or space-separated list of files (may be specified using wildcard patterns) that must be excluded; no files (except default excludes) are excluded when omitted No
excludesfile The name of a file that contains a list of files to exclude (may be specified using wildcard patterns) No
failonerror Indicates whether the build should stop if there are compilation errors; defaults to true No
listfiles If true, list the source files being handed off to the compiler No
cmd C++ compiler command to execute; defaults to ccx No
qualifiers C++ compiler qualifiers such as /debug, /opt No
srcext List of C++ source file extensions; defaults to .cxx, .cpp No
objext List of C++ object file extensions; defaults to .obj No
noon If true, errors during compilation of multiple files in one vmscxx task will not cause the task to abort No

Examples for vmscxx

The following task compiles all of the sources under the testcxx directory with the qualifier /debug.

<target name="vmscxx" >
< vmscxx srcdir="testcxx" qualifiers="/debug" />
</target>

The following task compiles all of the sources under the testcxx/src1 and testcxx/src2 directories, but skips the files under the testcxx/obj directory

<target name=" vmscxx " >
< vmscxx srcdir=" testcxx" includes="src1/**, src2/**" excludes="obj/**" />
</target>

The following task compiles all of the sources under the testcxx directory with the extension .cxx and .cxxext. Files with objext extensions are considered as corresponding object files.

<target name=" vmscxx" >
< vmscxx srcdir=" testcxx" srcext="cxx, cxxext" objext="objext"/>
</target>

The following task compiles all of the sources under testcxx/subfolder using cpp as a compiler command. The list of files to be compiled is displayed, and the Ant script build does not stop even if the compilation fails.

<target name=" vmscxx " >
< vmscxx cmd="cpp" listfiles="true" failonerror="true">
<src path=" testcxx"/>
<include name="subfolder/**"/>
</ vmscxx >
</target>

vmslink

vmslink is a custom Ant task that invokes the Linker Utility on OpenVMS. It recursively scans the source directory and links the object files. The source directory and the list of files to be compiled can be configured by the task's parameters.

The following the table of parameters that vmslink task accepts.

vmslink Attribute
Description
Required
srcdir Root directory of the object files (only a single root directory is allowed) Yes
containsmain The name of the file that contains the main function. This object file will be listed first in the link command No
includes Comma or space-separated list of object files (may be specified using wildcard patterns) that must be included; all object files are included when omitted No
includesfile The name of a file that contains a list of object files to include (may be specified using wildcard patterns) No
excludes Comma- or space-separated list of files (may be specified using wildcard patterns) that must be excluded; no files (except default excludes) are excluded when omitted No
excludesfile The name of a file that contains a list of files to exclude (may be specified using wildcard patterns) No
failonerror Indicates whether the build should stop if there are linker errors; defaults to true No
executable Creates an executable with the given file name. The file name must be an OpenVMS file specification. Default directory is the parent directory of the Ant build script file No
qualifiers Linker qualifiers such as /map or /debug No
objext List of object file extensions; defaults to .obj No
optionsfile Comma-separated list of files that are added to the link command line as the value for the /option qualifier No
useCXXlink When true, use the CXXLink command rather than the default link command No

Examples for vmslink

The following task invokes the linker with /debug as a parameter linking all of the files ending with .obj under the testcc directory and producing the executable disk$:[user]prog.exe.

<target name="vmslink">
<vmslink srcdir="testcc" qualifiers="/debug" objext="obj" executable="disk$:[user]prog.exe"/>
</target>

The following task invokes the linker to link all of the object files under the testcc/src1 and testcc/src2 directories, but skips the files under the testcc/ext directory.

<target name=" vmslink" >
< vmslink srcdir=" testcc" includes="src1/**, src2/**" excludes="ext/**" />
</target>

The following task invokes the linker to link all of the object files under testcc/subfolder. The list of files to be linked is displayed, and the Ant script build process does not stop even if the link fails.

<target name=" vmslink" >
< vmslink listfiles="true" failonerror="true">
<src path=" testcc"/>
<include name="subfolder/**"/>
</ vmslink >
</target>

vmsdcl

vmsdcl is a custom Ant task that sends the specified command string to the DCLcommand interpreter for execution.

The following the table of parameters that vmsdcl task accepts.

vmsdcl Attribute
Description
Required
cmdstring DCL command string to execute Yes
failonerror Indicates whether the build should stop if there is an error detected; defaults to true No

Examples for vmsdcl

The following example invokes the DCL command $ show process

<target name="vmsdcl">
<vmsdcl cmdstring="show process" />
</target>

The following example invokes the DCL command $ setupenv with an argument that is specified by the user at runtime via the Ant input task. The input task requests input and places it into the user-defined property build.version. That property is then used on the DCL command line.

<target name="setup_my_env">
<input
message="Enter build version:"
addproperty="build.version"
/>
<vmsdcl cmdstring="setupenv ${build.version}" />
</target>

Build Script Example

The following example shows an entire build script.