Browse Source

make <ilasm> work on Mono

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@276733 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 21 years ago
parent
commit
4c30dd5d53
2 changed files with 40 additions and 3 deletions
  1. +20
    -2
      src/etc/testcases/taskdefs/optional/dotnet.xml
  2. +20
    -1
      src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java

+ 20
- 2
src/etc/testcases/taskdefs/optional/dotnet.xml View File

@@ -272,7 +272,12 @@
</exec> </exec>
</target> </target>


<target name="testILASM" depends="validate_ilasm" if="ilasm.found">
<target name="testILASM"
depends="testILASM-Mono,testILASM-MS"
if="ilasm.found"/>

<target name="ilasm" depends="validate_ilasm"
if="ilasm.found">
<property name="testILASM.exe" <property name="testILASM.exe"
location="${build.dir}/ExampleIlasm.exe" /> location="${build.dir}/ExampleIlasm.exe" />
<ilasm <ilasm
@@ -283,9 +288,22 @@
</ilasm> </ilasm>
<available property="ilasm.created" file="${testILASM.exe}"/> <available property="ilasm.created" file="${testILASM.exe}"/>
<fail unless="ilasm.created">No app ${testILASM.exe} created</fail> <fail unless="ilasm.created">No app ${testILASM.exe} created</fail>
<exec executable="${testILASM.exe}" failonerror="true" />
</target> </target>


<target name="testILASM-MS" depends="ilasm"
if="ilasm.found" unless="mono.ilasm.found">
<exec executable="${testILASM.exe}"
failonerror="true"/>
</target>

<target name="testILASM-Mono" depends="ilasm"
if="mono.ilasm.found">
<exec executable="${mono.executable}"
failonerror="true">
<arg value="${testILASM.exe}"/>
</exec>
</target>

<!-- not including this in the test as it creates an exe in the src dir --> <!-- not including this in the test as it creates an exe in the src dir -->


<target name="testIlasmNoDestFile" depends="validate_ilasm"> <target name="testIlasmNoDestFile" depends="validate_ilasm">


+ 20
- 1
src/main/org/apache/tools/ant/taskdefs/optional/dotnet/Ilasm.java View File

@@ -28,6 +28,7 @@ import java.util.Vector;


import org.apache.tools.ant.BuildException; import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project; import org.apache.tools.ant.Project;
import org.apache.tools.ant.taskdefs.condition.Os;
import org.apache.tools.ant.types.EnumeratedAttribute; import org.apache.tools.ant.types.EnumeratedAttribute;
import org.apache.tools.ant.types.FileSet; import org.apache.tools.ant.types.FileSet;


@@ -130,6 +131,10 @@ public class Ilasm
*/ */
protected Vector referenceFilesets = new Vector(); protected Vector referenceFilesets = new Vector();


/**
* @since Ant 1.7
*/
private boolean isMono = !Os.isFamily("windows");


/** /**
* constructor inits everything and set up the search pattern * constructor inits everything and set up the search pattern
@@ -262,7 +267,10 @@ public class Ilasm
*@return the appropriate string from the state of the listing flag *@return the appropriate string from the state of the listing flag
*/ */
protected String getListingParameter() { protected String getListingParameter() {
return listing ? "/listing" : "/nolisting";
if (!isMono) {
return listing ? "/listing" : "/nolisting";
}
return null;
} }




@@ -429,6 +437,17 @@ public class Ilasm
this.targetType = targetType.getValue(); this.targetType = targetType.getValue();
} }


/**
* Explicitly override the Mono auto-detection.
*
* <p>Defaults to false on Windows and true on any other platform.</p>
*
* @since Ant 1.7
*/
public void setMono(boolean b) {
isMono = b;
}

/** /**
* This is the execution entry point. Build a list of files and call ilasm * This is the execution entry point. Build a list of files and call ilasm
* on each of them. * on each of them.


Loading…
Cancel
Save