You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by cr...@apache.org on 2007/12/11 23:06:54 UTC
svn commit: r603377 -
/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptTask.java
Author: crogers
Date: Tue Dec 11 14:06:48 2007
New Revision: 603377
URL: http://svn.apache.org/viewvc?rev=603377&view=rev
Log:
BEEHIVE-1210 - Add an option to the Beehive AptTask to allow a user to define an AP factory or factory path to override the usual discovery process.
Modified:
beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptTask.java
Modified: beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptTask.java
URL: http://svn.apache.org/viewvc/beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptTask.java?rev=603377&r1=603376&r2=603377&view=diff
==============================================================================
--- beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptTask.java (original)
+++ beehive/trunk/controls/src/runtime/org/apache/beehive/controls/runtime/generator/AptTask.java Tue Dec 11 14:06:48 2007
@@ -100,6 +100,14 @@
_compileByExt = compileByExt;
}
+ public void setFactory(String factory) {
+ _factory = factory;
+ }
+
+ public void setFactorypath(String factorypath) {
+ _factorypath = factorypath;
+ }
+
/**
* Override the implementation of scanDir, to look for additional files based upon any
* specified source extensions
@@ -205,30 +213,24 @@
}
}
- //
// Select the executable (apt) and set fork = true
- //
setExecutable("apt");
setFork(true);
- //
// Specify the code generation output directory to APT
- //
Commandline.Argument arg = createCompilerArg();
arg.setValue("-s");
arg = createCompilerArg();
arg.setFile(_genDir);
- //add the -nocompile flag if set to true
+ // Add the -nocompile flag if set to true
if(_nocompile)
{
Commandline.Argument ncarg = createCompilerArg();
ncarg.setValue("-nocompile");
}
- //
// Add processor options.
- //
for (Object i : _processorOptions)
{
Commandline.Argument optionArg = createCompilerArg();
@@ -238,8 +240,46 @@
checkParameters();
resetFileLists();
- // Iterate through the list of input extensions, matching/dependency checking based
- // upon the input list.
+ //
+ // Allow user to define apt specific options for the name of an
+ // annotation processor (AP) factory to use or the factory path
+ // for finding the AP factories. This allows apt to bypass the
+ // default discovery process or specify where to find AP factories.
+ //
+ // This can help resolve build issues users may experience when
+ // multiple annotation processors conflict. For example,...
+ // A project may contain JAX-RPC 1.1 Web Services annotations.
+ // Starting with JDK1.6, JDK bundles the JAX-WS 2.0 AP in its
+ // tool jar. JAX-RPC and JAX-WS use the same JSR 181 annotations
+ // but the JAX-WS 2.0 AP doesn't support the earlier JAX-RPC use
+ // of the RPC/ENCODED soapbinding annotation on an endpoint.
+ // A user running the build through the Beehive AptTask and using
+ // Java 6, would see APT fail on JAX-RPC services thinking they are
+ // invalid JAX-WS services.
+ //
+ // In this example, using the -factorypath option does not disable the
+ // built-in annotation processor because tools.jar is always in APT's
+ // class path. However, exposing the option to use a specific factory
+ // can solve this problem. There can only be one factory name when
+ // invoking APT, so a user of this task may want to pass a wrapper
+ // factory that is an aggregated annotation processor factory.
+ //
+ if (_factorypath != null && _factorypath.trim().length() > 0) {
+ Commandline.Argument factoryArg = createCompilerArg();
+ factoryArg.setValue("-factorypath");
+ factoryArg = createCompilerArg();
+ factoryArg.setValue(_factorypath);
+ }
+
+ if (_factory != null && _factory.trim().length() > 0) {
+ Commandline.Argument factoryArg = createCompilerArg();
+ factoryArg.setValue("-factory");
+ factoryArg = createCompilerArg();
+ factoryArg.setValue(_factory);
+ }
+
+ // Iterate through the list of input extensions, matching/dependency
+ // checking based upon the input list.
for (int j = 0; j < _srcExts.size(); j++)
{
String ext = (String)_srcExts.get(j);
@@ -311,4 +351,6 @@
protected File _genDir;
protected Vector/*<String>*/ _srcExts = new Vector/*<String>*/();
protected Vector/*<String>*/ _processorOptions = new Vector/*<String>*/();
+ protected String _factory = null;
+ protected String _factorypath = null;
}