From 6c0ec57e6edd302cf26317ee29b31c641db80738 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Mon, 14 Mar 2005 11:46:01 +0000 Subject: [PATCH] split extraoptions in , PR 23599 git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277937 13f79535-47bb-0310-9956-ffa450edef68 --- WHATSNEW | 3 +++ .../taskdefs/optional/dotnet/DotnetCompile.java | 15 +++++++++++++-- .../ant/taskdefs/optional/dotnet/NetCommand.java | 14 ++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/WHATSNEW b/WHATSNEW index 548309eff..069f434cc 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -264,6 +264,9 @@ Other changes: * with a single command should now work with unusal login dialogs without special read/write pairs. Bugzilla Report 26632. +* 's extraoptions can now contain multiple arguments. + Bugzilla Report 23599. + Fixed bugs: ----------- diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetCompile.java b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetCompile.java index 2f40e5110..de8aa2242 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetCompile.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetCompile.java @@ -1,5 +1,5 @@ /* - * Copyright 2001-2004 The Apache Software Foundation + * Copyright 2001-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,6 +35,7 @@ import java.util.Hashtable; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.Project; +import org.apache.tools.ant.types.Commandline; import org.apache.tools.ant.types.Path; import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.EnumeratedAttribute; @@ -469,6 +470,16 @@ public abstract class DotnetCompile } } + /** + * get any extra options or null for no argument needed, split + * them if they represent multiple options. + * + * @return The ExtraOptions Parameter to CSC + */ + protected String[] getExtraOptionsParameters() { + String extra = getExtraOptionsParameter(); + return extra == null ? null : Commandline.translateCommandline(extra); + } /** * Set the destination directory of files to be compiled. @@ -831,7 +842,7 @@ public abstract class DotnetCompile command.addArgument(getAdditionalModulesParameter()); command.addArgument(getDebugParameter()); command.addArgument(getDefinitionsParameter()); - command.addArgument(getExtraOptionsParameter()); + command.addArguments(getExtraOptionsParameters()); command.addArgument(getMainClassParameter()); command.addArgument(getOptimizeParameter()); command.addArgument(getDestFileParameter()); diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java index f93b293d6..fb360f7f9 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/NetCommand.java @@ -201,6 +201,20 @@ public class NetCommand { } } + /** + * add an argument to a command line; do nothing if the arg is null or + * empty string + * + *@param argument The feature to be added to the Argument attribute + */ + public void addArguments(String[] arguments) { + if (arguments != null && arguments.length != 0) { + for (int i = 0; i < arguments.length; i++) { + addArgument(arguments[i]); + } + } + } + /** * concatenate two strings together and add them as a single argument, * but only if argument2 is non-null and non-zero length