You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by bo...@apache.org on 2009/04/09 15:34:35 UTC

svn commit: r763647 - in /ant/antlibs/dotnet/trunk: changes.xml docs/wix.html src/main/org/apache/ant/dotnet/wix/WixTask.java

Author: bodewig
Date: Thu Apr  9 13:34:35 2009
New Revision: 763647

URL: http://svn.apache.org/viewvc?rev=763647&view=rev
Log:
allow users to specifiy additional arguments to candle and light.  PR 46968

Modified:
    ant/antlibs/dotnet/trunk/changes.xml
    ant/antlibs/dotnet/trunk/docs/wix.html
    ant/antlibs/dotnet/trunk/src/main/org/apache/ant/dotnet/wix/WixTask.java

Modified: ant/antlibs/dotnet/trunk/changes.xml
URL: http://svn.apache.org/viewvc/ant/antlibs/dotnet/trunk/changes.xml?rev=763647&r1=763646&r2=763647&view=diff
==============================================================================
--- ant/antlibs/dotnet/trunk/changes.xml (original)
+++ ant/antlibs/dotnet/trunk/changes.xml Thu Apr  9 13:34:35 2009
@@ -38,6 +38,10 @@
     </properties>
 
     <release version="SVN trunk" date="unpublished">
+      <action type="update" issue="46968">
+        The wix task has new nested elements that allow users to send
+        addtional command line arguments to candle and light.
+      </action>
       <action type="fix">
         The include and exclude arguments to NUnit were broken (they
         had a leading ",").

Modified: ant/antlibs/dotnet/trunk/docs/wix.html
URL: http://svn.apache.org/viewvc/ant/antlibs/dotnet/trunk/docs/wix.html?rev=763647&r1=763646&r2=763647&view=diff
==============================================================================
--- ant/antlibs/dotnet/trunk/docs/wix.html (original)
+++ ant/antlibs/dotnet/trunk/docs/wix.html Thu Apr  9 13:34:35 2009
@@ -8,7 +8,7 @@
   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
@@ -101,13 +101,36 @@
     are newer than the expected target, the task won't do
     anything.</p>
 
-    <h4>candleParameters</h4>
+    <h4>candleParameter</h4>
 
     <p>Specifies preprocessor parameters for candle</p>
 
-    <p><code>candleParameters</code> has two required attributes.
+    <p><code>candleParameter</code> has two required attributes.
     name and value that specify name and value of a parameter.</p>
 
+    <h4>candleArg</h4>
+
+    <p>Specifies additional arguments for candle</p>
+
+    <p><code>candleArg</code> is
+      a <a href="http://ant.apache.org/manual/using.html#arg">command
+        line argument</a>.</p>
+
+    <h4>lightParameter</h4>
+
+    <p>Specifies parameters for light</p>
+
+    <p><code>lightParameter</code> has two required attributes.
+    name and value that specify name and value of a parameter.</p>
+
+    <h4>lightArg</h4>
+
+    <p>Specifies additional arguments for light</p>
+
+    <p><code>lightArg</code> is
+      a <a href="http://ant.apache.org/manual/using.html#arg">command
+        line argument</a>.</p>
+
     <h3>Examples</h3>
 
     <p>Create <code>product.wixobj</code> from <code>product.wxs</code>:</p>
@@ -212,4 +235,4 @@
     <code>product.msi</code> is newer than all files, the task won't
     do anything.</p>
   </body>
-</html>
\ No newline at end of file
+</html>

Modified: ant/antlibs/dotnet/trunk/src/main/org/apache/ant/dotnet/wix/WixTask.java
URL: http://svn.apache.org/viewvc/ant/antlibs/dotnet/trunk/src/main/org/apache/ant/dotnet/wix/WixTask.java?rev=763647&r1=763646&r2=763647&view=diff
==============================================================================
--- ant/antlibs/dotnet/trunk/src/main/org/apache/ant/dotnet/wix/WixTask.java (original)
+++ ant/antlibs/dotnet/trunk/src/main/org/apache/ant/dotnet/wix/WixTask.java Thu Apr  9 13:34:35 2009
@@ -23,6 +23,7 @@
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.DirectoryScanner;
 import org.apache.tools.ant.Task;
+import org.apache.tools.ant.types.Commandline;
 import org.apache.tools.ant.types.EnumeratedAttribute;
 import org.apache.tools.ant.types.FileSet;
 
@@ -84,9 +85,24 @@
     private File wixobjDestDir = null;
 
     /**
+     * addtional command line arguments for candle.
+     */
+    private Commandline candleCmdl = new Commandline();
+
+    /**
      * list of parameters for the preprocessor.
      */
-    private ArrayList parameters = new ArrayList();
+    private ArrayList candleParameters = new ArrayList();
+
+    /**
+     * addtional command line arguments for light.
+     */
+    private Commandline lightCmdl = new Commandline();
+
+    /**
+     * list of parameters for the "compiler".
+     */
+    private ArrayList lightParameters = new ArrayList();
 
     public WixTask() {
         super();
@@ -172,7 +188,32 @@
      * A parameter to pass to candle.exe.
      */
     public final void addCandleParameter(AbstractBuildTask.Property t) {
-        parameters.add(t);
+        candleParameters.add(t);
+    }
+
+    /**
+     * A parameter to pass to light.exe.
+     */
+    public final void addLightParameter(AbstractBuildTask.Property t) {
+        lightParameters.add(t);
+    }
+
+    /**
+     * Adds a command-line argument for light.exe.
+     *
+     * @return new command line argument created.
+     */
+    public Commandline.Argument createLightArg() {
+        return lightCmdl.createArgument();
+    }
+
+    /**
+     * Adds a command-line argument for candle.exe.
+     *
+     * @return new command line argument created.
+     */
+    public Commandline.Argument createCandleArg() {
+        return candleCmdl.createArgument();
     }
 
     public void execute() {
@@ -270,14 +311,16 @@
      * Run candle passing all files of the collection on the command line.
      */
     private void runCandle(Collection s) {
-        run(wixExecutable("candle.exe"), s, null, wixobjDestDir, parameters);
+        run(wixExecutable("candle.exe"), s, null, wixobjDestDir,
+            candleParameters, candleCmdl);
     }
 
     /**
      * Run light passing all files of the collection on the command line.
      */
     private void runLight(Collection s) {
-        run(wixExecutable("light.exe"), s, target, null, Collections.EMPTY_LIST);
+        run(wixExecutable("light.exe"), s, target, null,
+            lightParameters, lightCmdl);
     }
 
     /**
@@ -294,7 +337,7 @@
      * on the command line - potentially adding an /out parameter.
      */
     private void run(String executable, Collection s, File target,
-                     File runInDir, Collection params) {
+                     File runInDir, Collection params, Commandline cmdl) {
         DotNetExecTask exec = DotNetExecTask.getTask(this, vm, 
                                                      executable, null);
         if (runInDir != null) {
@@ -315,13 +358,17 @@
             exec.createArg().setValue("/out");
             exec.createArg().setValue(target.getAbsolutePath());
         }
-        
+
         iter = params.iterator();
         while (iter.hasNext()) {
             AbstractBuildTask.Property p =
                 (AbstractBuildTask.Property) iter.next();
             exec.createArg().setValue("-d" + p.getName() + "=" + p.getValue());
         }
+        String[] extraArgs = cmdl.getArguments();
+        for (int i = 0; i < extraArgs.length; i++) {
+            exec.createArg().setValue(extraArgs[i]);
+        }
 
         exec.execute();
     }