Latest version of this page, available in Luismi Pena's Home page; Author: java_lmp@yahoo.co.uk

idldepend - an ANT CORBA task

Description

idldepend is an ant task verifying the dependencies of a CORBA/IDL file.

It parses the file, verifying the Java files that must be generated, taking in account the modifications that can happen due to command line parameters. If any of the Java files is missing or is older than the source IDL specification, it launches the specified compiler, being correctly supported those coming with Orbacus, Orbix, Jacorb, OpenORB, IBM and Sun'JDK distributions.

To speed up the process and avoid parsing unnecesarily the same files continuously, it keeps the dependencies into intermediate files.

This task does not launch the Java compiler, that is, its output are Java files and not directly the final bytecode.

License and download

idldepend is delivered as it, without any responsabilities on the author. It is open source, it can be used or modified without any limitations.

This task has been on use since September 2001, and its first public release was in December 2002, with 24 public deliveries before reaching version 1.0. As idldepend is a wrapper around several IDL compilers, it needs to continuosly evolve, following the changes that those compilers implement.

If some bug is found or the behaviour is not exactly the shown by the compiler, please send me a mail (java_lmp@yahoo.co.uk) and I will promptly introduce the modifications. In any case, the task is distributed with source, and therefore you can make by your own any changes.

Following are the downloadable files.

Previous available versions:

In case of using the source code, you need to have Ant (to build the task) and JavaCC (only if modifying the grammars, to parse them). Please modify the ant script to define your own JavaCC home directory, and compile it just entering 'ant'.

Version and CORBA compliance

Current version, since the 12th December 2006, is 1.10. Initially built using Ant 1.4, the current version has been tested against Ant 1.6.5; please note that I do not regularly check if it works under other Ant versions (but I would be surprised if not).

idldepend is compliant with the IDL to Java mapping defined for CORBA 2.4. Support for the mapping 1.2 -CORBA 3.0 compliant- is not immediately foreseen: it will be introduced when a CORBA distribution with Java mapping finally supports it.

In particular, the following keywords are not supported:

Note that all these keywords have been added with CORBA 3.0, and, by now, I have not knowledge of any ORB with Java mapping supporting them.

idldepend supports the grammar defined by the OMG; it raises no warnings or errors even if the used compiler does not support some used features. For example, a valid IDL file could contain proper local interface definitions, which are not supported by the JDK compiler. idldepend will only warn about incorrect IDL constructs.

Task's Attributes

Attribute Description Required Default value
compiler jdk / orbacus / jacorb / jacorb2 / openorb / orbix / ibm
Specifies the compiler to use, which must be available on the classpath (jdk/jacorb/jacorb2/openorb/ibm) or in the path (orbacus/orbix2k):
  • jacorb2 (Jacorb2.x) is equivalent to jacorb, but it is required to handle different behaviours in the way they handle packages. See below the section on package and translate for further information
  • Note that the compilers for jacorb and openorb must be available from the classpath.
no jdk
callCompiler foreach / once / onceWithAll
Using foreach, the compiler is called each time that a file is verified to have been modified, while with once, it is called only once, with all the files. Please look at invoking the idl compiler for a deeper explanation.
no foreach
compilerPath Specifies the location of the idl compiler.
This is specially useful for orbacus / orbix, to avoid specifying explicitely the PATH to the compiler.
Note that if it is specified on the jdk / openORB ... compilers, the idl compiler is not invoked anymore through the classpath, but spawning a different process.
no -
file File: Specifies the file to be verified. This or the nested element fileset must be specified. no
-
targetdir File: target directory used on compiler's generation. no as base dir
dependsdir File: directory used to store the dependency's files. no as targetdir
side client / server / all / serverTIE / allTIE
It specifies the kind of generation to be performed: for client or server purposes, and generating TIE files or not
no allTIE
ami no / callback
It specifies whether to support AMI (asynchronous messaging interface). It support currently only the callback model (i.e., not the polling)
no no
checkall boolean: it checks all the files that must be generated, including those coming out from types defined in included files
Note: if a file is included inside some scope (for example, the include directive appears inside a module definition), some compilers will anyway generate the included types. Although this is a reasonable behaviour, other compilers, as Orbacus, will ignore those included types unless checkAll is set to true.
Idldepend mimics this behaviour, so, using Orbacus, it will dismiss the included types if checkAll is false.
no false
force boolean: if set, it does not perform any check, launching the compiler directly.
That is, no dependencies are verified, the idl files are not parsed, and this task is only used to invoke the compiler.
no false
failOnError boolean: if set, the idl compiler is not launched if the parser's task finds an error. no false
preprocess dismiss / store / storeFull / use / useFull
Specifies the action on the preprocessed file, as described in the section below.
no dismiss
verbose quiet / basic / debug
Specifies the task's verbosity level
no basic

Nested Elements

Element Description
fileset Fileset: files to be compiled. This element is optional, but if the attribute file is not specified, there must be at least a fileset element.
include Path: specifies the paths to be used when looking for included files on the IDL files.
define Macro definition, defined with the following attributes:
Attribute Description Required
name macro name yes
value macro value no
undefine Macro undefinition, defined with the following attributes:
Attribute Description Required
name macro name yes
package Modifier used to change the final package for the generated Java files, prepending a given prefix. Additional information is shown below.
Following are the attributes of this element:
Attribute Description
module String:The module on which the package prefix will be applied. Every type belonging to this module is included inside the package given. When specified, the attribute prefix must be specified as well.
prefix String:The package prefix to apply.
auto boolean: if set, it includes every file into a package whose name is taken the prefix defined in the idl dile. It is only valid with orbacus and openorb.
translate Modifier used to change the final package for the generated Java files, modifying the standard package per module generation. Additional information is shown below.
Following are the attributes of this element (both are mandatory):
Attribute Description
module String: The module to translate.
package String: The package on which the previous module is translated
classpath Sets the classpath to use to launch the IDL compiler. A whole description of this element is given in the ant manual, on the Path-like Structures
path Sets the path to use when the IDL compiler is executed as an external program. This applies only to orbacus and orbix compilers; if the compilerPath is specified, it affects to all the compilers.
If it is used with jdk or jacorb and the compilerPath is not specified, a warning is raised.
A whole description of this element is given in the ant manual, on the Path-like Structures
arg Argument: additional argument to supply to the compiler. Note that if this argument modifies the name of the files being generated, force should be set to true, as this task will not be able to calculate correctly the dependencies
Example: <arg value="-Gdsi">

Example

<?xml version="1.0"?>
<project name="Sensei" default="main" basedir=".">
  <taskdef name="idlcheck" classname="idldepend.IDLCheckerTask"/>

    <target name="idl">
      <idlcheck compiler="jdk" force="false" checkAll="false"
        verbose="basic"
        targetDir="output" dependsDir="dependencies">
      <fileset dir=".">
        <include name="*.idl"/>
      </fileset>
      <include>
        <pathelement path=".."/>
      </include>
      <package module="example" prefix="UNO"/>
      <translate module="CORBA_HP" package="CORBA_HP.v2"/>
      <translate module="IfacePackage" package="Interf"/>
    </idlcheck>
  </target>

    <target name="main" depends="idl">
     <javac srcdir="output" includes="**/*.java"/>
   </target>

</project>

Behaviour

Using the preprocessor

idldepend can store the preprocessed file (the IDL file after the C preprocessor parses it), and even use it to generate the Java files. This feature is very valuable for those IDL compilers that lack a full-featured preprocessor (Jacorb has problems with basic macros, and the jdk compiler has as well problems with basic preprocessing functionality, like macros defined across several lines).

This functionality is specified with the attribute preprocess, which can have the following values:

Using package and translate

These modifiers affect to the packages under which the final Java files are generated. For example: package moduleA prefixA.prefixB converts the file moduleA/moduleB/file.java into prefixA/prefixB/moduleB/file.java The result of these modifications is not fully specified. idldepend just performs the translations made by the specific compiler, and each compiler behaves quite different.

For example, when translate is used on the jdk compiler, it only affects to top-level modules, while under jacorb it modifies any given module; and this modifier is not applicable for orbacus.

Following is a brief description of its behaviour. In case of doubt, check directly the compiler:

Invoking the IDL compiler

A number of attributes and nested elements control how the IDL compiler will be invoked from idldepend. Of course, every single attribute or element modifies the way the IDL compiler is called, adding or modifying the parameters passed to it; this section refers to which compiler is invoked and how the idl files are passed.

Which compiler is invoked is specified via the attributes compiler and compilerPath, and nested elements classpath and path. How the idl files are passed to the compiler is handled via the callCompiler attribute. From these, only this last attribute requires a deeper explanation:

The callCompiler functionality has been introduced to deal with the OpenORB compiler, though it could be useful with other compilers as well. The OpenORB compiler contains currently a bug: if file a.idl includes the file b.idl and both are passed at once to the idl compiler, OpenORB will not generate the code for the types found in b.idl if it is passed in the command line after a.idl.
To work around this bug, idldepend will reorder the idl files, passing first those without dependencies to the others (currently, there are no mechanisms to disable this reordering)

Translation of compiler arguments

Below is listed the translation of compiler arguments into the task parameters for the supported compilers.

The lists are given following the compiler order. When a parameter is not supported, is explicitely writen. Note that the args parameter in the task allows to specify any other parameter, but in that case the task can become useless. When a parameter is not directly supported but it can still be specified using the args parameter without any problem, it is as well explicitely writen.

JDK (as to 1.4.0) and IBM JDK (3.0)

compiler argument task parameter
-d <symbol> define name=<symbol>
-emitAll checkAll=true
-f<side> side=<side>
Note that the side's names match what is expected by JDK (client, server...)
-i <include path> include
-keep Not supported
-noWarn verbose="quiet" or "basic"
-oldImpBase Not supported
-pkgPrefix <t> <prefix> package module=<t> prefix=<prefix>
-pkgTranslate <t> <pkg> translate module=<t> package=<pkg>
-skeletonName Not supported
-td <dir> targetDir=<dir>
-tieName Not supported
-v, -verbose verbose="debug"
-version Not supported

Orbacus (as to 4.1.0)

compiler argument task parameter
-h, --help Not supported
-v, --version Not supported
-e, --cpp Not supported (use args instead)
-d, --debug verbose="debug"
-DNAME define name=NAME
-DNAME=DEF define name=NAME value=DEF
-UNAME undefine name=NAME
-IDIR include
-E Not supported
--no-skeletons side=client
--no-comments Not supported (use args instead)
--tie side=serverTIE or side=allTIE
--clone Not supported (use args instead)
--all checkAll=true
--impl Not supported
--impl-tie Not supported
--package PKG package prefix=PKG
--prefix-package PRE PKG package module=PRE prefix=PKG
--auto-package package auto=true
--output-dir DIR targetDIR=DIR
--file-list FILE Not supported (use args instead)
--with-interceptor-args Not supported (use args instead)
--no-local-copy Not supported (use args instead)
--case-sensitive Not supported

Jacorb (as to 1.4.1 and 2.3)

compiler argument task parameter
-syntax Not supported
-noskel side=client
-nostub side=server or side=serverTIE
-Idir include
-sloppy_forward Not supported (use args instead)
-sloppy_names Not supported
-Dx define name=x
-Dx=y define name=x value=y
-Ux undefine name=x
-p pack package prefix=pack (version 1.x)
-i2jpackage :package package prefix=package (version 2.x, compiler set to jacorb2)
-i2jpackage x:a.b.c translate module=x package=a.b.c
-i2jpackagefile Not supported (use args instead)
-i Not supported (use args instead)
-ir Not supported (use args instead)
-global_import Not supported (use args instead)
-d dir targetDIR=dir
-W 4 -verbose=debug
-all checkAll=true
-v|version Not supported
-h|help Not supported
-backend Not supported (use args instead)
-jdk14 Not supported (use args instead)
-nofinal Not supported (use args instead)
-ami_callback ami=callback
-ami_polling Not supported (use args instead)

OpenORB (as to 1.3 and 1.4)

compiler argument task parameter
-release Not supported
-d directory name targetDIR=directory name
-package package_name package prefix=package_name
-I include
-D define
-nostub side=server or side=serverTIE
-nolocalstub Not supported (use args instead)
-noskeleton side=client
-notie side=client or side=server or side=all
-boa Not supported
-dynamic Not supported
-portablehelper Not supported (use args instead)
-all checkAll=true
-noprefix Should not be any prefix auto=yes
-noreverseprefix Not supported
-native Not supported
-quiet verbose=quiet
-silence verbose=quiet
-verbose verbose=debug
-jdk1.4 Not supported (use args instead)
-invokeMethod Not supported (use args instead)
-minTableSize Not supported (use args instead)
-XgenerateValueFactory Not supported (use args instead)
-XgenerateValueImpl Not supported (use args instead)

Orbix (2000)

Please note that for this compiler, only the directly supported arguments are specified.
If no present in the table but still required, the args task attribute can be used.

In addition, if an argument is added via arg and this argument must be embedded in jbase or jpoa, like is the case for arguments starting by -P, -O, -G, -M, -J, -V, -F, the addition is handled automatically by idldepend, i.e., it is not required to add explicitely jbase or jpoa.

compiler argument task parameter
-jbase side=client
-jpoa side=server
-Idir include
-Dx define name=x
-Dx=y define name=x value=y
-Ux undefine name=x
-P pack package prefix=pack
-Px=y package module=x package=y
-Odir targetDIR=dir
-w -verbose=quiet
-v -verbose=debug

Additional notes

Troubleshooting

In case of errors, the fastest way to verify what is happening is to make idldepend verbose, using the attribute verbose=debug.

History changes

Version 1.10

12th December 2006
Changed the behaviour of checkAll.
If a file is included inside some scope (for example, the include directive appears inside a module definition), some compilers will generate the included types, whenever checkAll is set or not.
Although this is a reasonable behaviour, other compilers, as Orbacus, will ignore those included types unless checkAll is set to true.
idldepend mimics this behaviour, so, using Orbacus, it will dismiss the included types if checkAll is false.
Version 1.0

9th November 2006
Supported more than one fileset as input. Thanks to Esmond Pitt for providing thesolution.
Specialized output depending on the used compiler. In special, this solves an issue with JDK when the option serverTIE is used.
As summary, idldepend tries now to mimic the behaviour of the compiler, even if the compiler does not comply with the standard Java Mapping.
JavaCC 4.0 used
Revamped the documentation
Previous versions
The updates done on previous versions are not part anymore of the documentation. Please visit the old documentation if you have any interest on it
Thanks to everybody who submitted bugs. In special, thanks to those who also submitted code corrections: Brian Wallis, Jeff Downs, Guillaume Codina, Andreas Ebbert and Duane Griffin.

Bugs and Limitations