diff --git a/src/etc/testcases/taskdefs/optional/dotnet.xml b/src/etc/testcases/taskdefs/optional/dotnet.xml index eaf58b2c1..497d8a825 100644 --- a/src/etc/testcases/taskdefs/optional/dotnet.xml +++ b/src/etc/testcases/taskdefs/optional/dotnet.xml @@ -67,20 +67,35 @@ destFile="${testCSC.exe}" targetType="exe" > - No app ${testCSC.exe} created + - - + + + + + + + No app ${testCSC.exe} created + + + + - diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java index 2749531aa..60751659f 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/CSharp.java @@ -199,6 +199,7 @@ public class CSharp extends DotnetCompile { */ public CSharp() { + clear(); } /** @@ -213,7 +214,7 @@ public class CSharp extends DotnetCompile { unsafe = false; noconfig = false; definitions = null; - + setExecutable("csc"); } @@ -426,13 +427,6 @@ public class CSharp extends DotnetCompile { return ";"; } - /** - * compiler is 'csc' - * @return - */ - public String getCompilerExeName() { - return "csc"; - } /** * extension is '.cs' diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetBaseMatchingTask.java b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetBaseMatchingTask.java index 2331d74d7..c04930863 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetBaseMatchingTask.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/DotnetBaseMatchingTask.java @@ -137,7 +137,7 @@ public class DotnetBaseMatchingTask extends MatchingTask { = getSrcDir() != null || filesets.size() == 0; if (scanImplicitFileset) { //scan for an implicit fileset if there was a srcdir set - //or there was no srcDir set but the @ + //or there was no srcDir set but there was no contained classes if (getSrcDir() == null) { //if there is no src dir here, set it setSrcDir(getProject().resolveFile(".")); 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 c3f9cbc09..3ec8a2f1c 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 @@ -154,6 +154,12 @@ public abstract class DotnetCompile */ protected Vector resources = new Vector(); + /** + * executable + */ + + protected String executable; + /** * Fix .NET reference inclusion. .NET is really dumb in how it handles * inclusion. You have to list every 'assembly' -read DLL that is imported. @@ -790,6 +796,26 @@ public abstract class DotnetCompile resources.add(resource); } + /** + * what is the executable? + * @return + */ + protected String getExecutable() { + return executable; + } + + /** + * set the name of the program, overriding the defaults. + * Can be used to set the full path to a program, or to switch + * to an alternate implementation of the command, such as the Mono or Rotor + * versions -provided they use the same command line arguments as the + * .NET framework edition + * @param executable + */ + public void setExecutable(String executable) { + this.executable = executable; + } + /** * test for a string containing something useful * @@ -809,6 +835,9 @@ public abstract class DotnetCompile if (outputFile != null && outputFile.isDirectory()) { throw new BuildException("destFile cannot be a directory"); } + if(getExecutable()==null) { + throw new BuildException("There is no executable defined for this task"); + } } /** @@ -862,12 +891,6 @@ public abstract class DotnetCompile */ public abstract String getReferenceDelimiter(); - /** - * Get the name of the compiler executable. - * @return The name of the compiler executable. - */ - public abstract String getCompilerExeName() ; - /** * Get the extension of filenames to compile. * @return The string extension of files to compile. @@ -963,7 +986,7 @@ public abstract class DotnetCompile * @return a command prefilled with the exe name and task name */ protected NetCommand createNetCommand() { - NetCommand command = new NetCommand(this, getTaskName(), getCompilerExeName()); + NetCommand command = new NetCommand(this, getTaskName(), getExecutable()); return command; } diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/JSharp.java b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/JSharp.java index 41bc02f48..7a2056d74 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/JSharp.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/JSharp.java @@ -84,7 +84,11 @@ public class JSharp extends DotnetCompile { */ boolean secureScoping = false; + public JSharp() { + setExecutable("vjc"); + } + public void setBaseAddress(String baseAddress) { this.baseAddress = baseAddress; } @@ -116,13 +120,7 @@ public class JSharp extends DotnetCompile { return ";"; } - /** - * Get the name of the compiler executable. - * @return The name of the compiler executable. - */ - public String getCompilerExeName() { - return "vjc"; - } + /** * Get the extension of filenames to compile. diff --git a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/VisualBasicCompile.java b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/VisualBasicCompile.java index 2ed48ac4b..5ef995211 100644 --- a/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/VisualBasicCompile.java +++ b/src/main/org/apache/tools/ant/taskdefs/optional/dotnet/VisualBasicCompile.java @@ -107,7 +107,7 @@ public class VisualBasicCompile extends DotnetCompile { * Constructor for VisualBasicCompile. */ public VisualBasicCompile() { - super(); + clear(); } /** @@ -121,6 +121,7 @@ public class VisualBasicCompile extends DotnetCompile { optionExplicit = false; optionStrict = false; removeIntChecks = false; + setExecutable("vbc"); } /** @@ -349,14 +350,6 @@ public class VisualBasicCompile extends DotnetCompile { return resource.getVbStyleParameter(); } - /** - * Get the name of the compiler executable. - * @return The name of the compiler executable. - */ - public String getCompilerExeName() { - return "vbc"; - } - /** * validation code * @throws BuildException if validation failed diff --git a/src/testcases/org/apache/tools/ant/taskdefs/optional/DotnetTest.java b/src/testcases/org/apache/tools/ant/taskdefs/optional/DotnetTest.java index af5b76274..c48d6160b 100644 --- a/src/testcases/org/apache/tools/ant/taskdefs/optional/DotnetTest.java +++ b/src/testcases/org/apache/tools/ant/taskdefs/optional/DotnetTest.java @@ -106,6 +106,14 @@ public class DotnetTest extends BuildFileTest { } + /** + * A unit test for JUnit + */ + public void testCSCintrinsicFileset() throws Exception { + executeTarget("testCSCintrinsicFileset"); + } + + /** * A unit test for JUnit */