1
0
mirror of https://github.com/twiglet/cs2j.git synced 2025-01-18 13:15:17 +01:00
2010-09-20 13:01:50 -05:00

266 lines
14 KiB
XML

<?xml-stylesheet type="text/xsl" href="file://C:\ant\etc\antex\antprettybuild\antprettybuild-3.1.1.xsl"?>
<project name="cs2jTranslator" default="launch" basedir="." xmlns:dn="antlib:org.apache.ant.dotnet">
<description>
This script builds the cs2j translator and translates C# code
</description>
<property name="builder.ant.lib" value="${basedir}/lib"/>
<!-- load the ant-dotnet task, see http://ant.apache.org/antlibs/dotnet/index.html -->
<taskdef uri="antlib:org.apache.ant.dotnet" resource="org/apache/ant/dotnet/antlib.xml" classpath="${builder.ant.lib}/ant-dotnet-1.0.jar" />
<!-- Load AntForm tasks -->
<taskdef name="antform" classname="com.sardak.antform.AntForm" classpath="${builder.ant.lib}/antform.jar"/>
<taskdef name="antmenu" classname="com.sardak.antform.AntMenu" classpath="${builder.ant.lib}/antform.jar"/>
<target name="launch" depends="launch-form,run" description="Simple Graphical Launch"/>
<target name="launch-full" depends="launch-full-form,run" description="Graphical Launch with all options"/>
<target name="launch-form">
<property file="${basedir}/launch-simple.properties" />
<antform title="C# to Java Translation" save="${basedir}/launch-simple.properties">
<label>Configure the source and target locations for your translation:</label>
<fileSelectionProperty label="C# Translation Root : " property="cs.tx.dir" directoryChooser="true" />
<fileSelectionProperty label="Java output directory : " property="java.output.dir" directoryChooser="true" />
<separator />
<controlbar>
<button label="Cancel" type="cancel" target="cancel" newproject="false"/>
<button label="Reset" type="reset" />
<button label="OK" type="ok" focus="true" newproject="false"/>
</controlbar>
</antform>
</target>
<target name="launch-full-form">
<property file="${basedir}/launch-full.properties" />
<antform title="C# to Java Translation" save="${basedir}/launch-full.properties">
<label>Configure the source and target locations for your translation:</label>
<fileSelectionProperty label="C# Application Root : " property="cs.app.dir" directoryChooser="true" />
<fileSelectionProperty label="C# Translation Root : " property="cs.tx.dir" directoryChooser="true" />
<fileSelectionProperty label="Java output directory : " property="java.output.dir" directoryChooser="true" />
<fileSelectionProperty label="CS2J Translation Files : " property="cs2j.dir" directoryChooser="true" />
<separator />
<!-- <label>Enter the locations of the branches you want to translate from / to</label>
<textProperty label="ScormEngineNet branch : " property="csharp.project.full" />
<textProperty label="ScormEngineJava branch : " property="java.project.full" />
<separator />
<booleanProperty label="Commit Java code after translation " property="is.commit.javacode" />
<booleanProperty label="Refresh and Rebuild cs2j executable " property="is.rebuild.cs2j" />
-->
<controlbar>
<button label="Cancel" type="cancel" target="cancel" newproject="false"/>
<button label="Reset" type="reset" />
<button label="OK" type="ok" focus="true" newproject="false"/>
</controlbar>
</antform>
</target>
<target name="cancel">
<echo message="Translation cancelled by user" />
<property name="is.run.cancelled" value="true" />
</target>
<target name="ok">
</target>
<target name="run" depends="init,translateCS2J" unless="is.run.cancelled">
</target>
<!-- We could have left this in the msbuild script fed to buildTranslator, but it is clearer in Ant :) -->
<target name="antlrTranslator" depends="init" unless="is.run.cancelled">
<antlr target="${cs2jtx.src.dir}/UnicodeLexerBase.g">
<classpath> <pathelement location="${builder.ant.lib}/antlr.jar"/> </classpath>
</antlr>
<antlr target="${cs2jtx.src.dir}/CSharpLexerBase.g" glib="${cs2jtx.src.dir}/UnicodeLexerBase.g">
<classpath> <pathelement location="${builder.ant.lib}/antlr.jar"/> </classpath>
</antlr>
<antlr target="${cs2jtx.src.dir}/CSharpLexer.g" glib="${cs2jtx.src.dir}/UnicodeLexerBase.g;${cs2jtx.src.dir}/CSharpLexerBase.g">
<classpath> <pathelement location="${builder.ant.lib}/antlr.jar"/> </classpath>
</antlr>
<antlr target="${cs2jtx.src.dir}/CSharpPreprocessorLexer.g" glib="${cs2jtx.src.dir}/UnicodeLexerBase.g;${cs2jtx.src.dir}/CSharpLexerBase.g">
<classpath> <pathelement location="${builder.ant.lib}/antlr.jar"/> </classpath>
</antlr>
<antlr target="${cs2jtx.src.dir}/CSharpPreprocessorHooverLexer.g" glib="${cs2jtx.src.dir}/UnicodeLexerBase.g;${cs2jtx.src.dir}/CSharpLexerBase.g">
<classpath> <pathelement location="${builder.ant.lib}/antlr.jar"/> </classpath>
</antlr>
<antlr target="${cs2jtx.src.dir}/CSharpParser.g">
<classpath> <pathelement location="${builder.ant.lib}/antlr.jar"/> </classpath>
</antlr>
<antlr target="${cs2jtx.src.dir}/CSharpEnvBuilder.g">
<classpath> <pathelement location="${builder.ant.lib}/antlr.jar"/> </classpath>
</antlr>
<antlr target="${cs2jtx.src.dir}/CSharpTranslator.g">
<classpath id="antlrjar"> <pathelement location="${builder.ant.lib}/antlr.jar"/> </classpath>
</antlr>
<antlr target="${cs2jtx.src.dir}/NetTranslator.g">
<classpath id="antlrjar"> <pathelement location="${builder.ant.lib}/antlr.jar"/> </classpath>
</antlr>
<antlr target="${cs2jtx.src.dir}/JavaPrettyPrinter.g">
<classpath id="antlrjar"> <pathelement location="${builder.ant.lib}/antlr.jar"/> </classpath>
</antlr>
</target>
<!-- C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Csc.exe /noconfig /nowarn:1701,1702 /errorreport:prompt /warn:4 /defin
e:DEBUG;TRACE /reference:C:\cygwin\antlr\build\lib\antlr.astframe.dll /reference:C:\cygwin\antlr\build\lib\antlr.runtime
.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\WINDOWS\Microsoft.NET\Framew
ork\v2.0.50727\System.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll /reference:C
:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /debug+ /debug:full /optimize- /out:obj\Debug\Translator.exe
/target:exe
-->
<target name="buildTranslator" depends="antlrTranslator" description="Builds CSharp to Java Translator" unless="is.run.cancelled">
<mkdir dir="${cs2jtx.bin.dir}/"/>
<dn:msbuild>
<dn:build>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="Build">
<!-- I am just mimicing the standard build options used by VS2005 here -->
<Csc Sources="@(Compile)" References="@(Reference)" TargetType="exe"
OutputAssembly="${cs2jtx.bin.dir}/Translator.exe"
Optimize="false"
DebugType="full"
DisabledWarnings="1701,1702"
EmitDebugInformation="true"
ErrorReport="prompt"
NoConfig="true"
Warninglevel="4" />
</Target>
<ItemGroup>
<Reference Include="${antlr.dll.dir}/antlr.astframe.dll" />
<Reference Include="${antlr.dll.dir}/antlr.runtime.dll" />
<Reference Include="${windows.dotnet.dir}/System.dll" />
<Reference Include="${windows.dotnet.dir}/System.Data.dll" />
<Reference Include="${windows.dotnet.dir}/System.Windows.Forms.dll" />
<Reference Include="${windows.dotnet.dir}/System.Xml.dll" />
</ItemGroup>
<ItemGroup>
<Compile Include="${cs2jtx.src.dir}\ASTNode.cs" />
<Compile Include="${cs2jtx.src.dir}\ASTNodeFactory.cs" />
<Compile Include="${cs2jtx.src.dir}\CodeMaskEnums.cs" />
<Compile Include="${cs2jtx.src.dir}\CSharpEnvBuilder.cs" />
<Compile Include="${cs2jtx.src.dir}\DirectoryHT.cs" />
<Compile Include="${cs2jtx.src.dir}\SigEnv.cs" />
<Compile Include="${cs2jtx.src.dir}\TranslationTemplate.cs" />
<Compile Include="${cs2jtx.src.dir}\TypeTable.cs" />
<Compile Include="${cs2jtx.src.dir}\NetTranslatorBase.cs" />
<Compile Include="${cs2jtx.src.dir}\CSharpHooverTokenTypes.cs" />
<Compile Include="${cs2jtx.src.dir}\CSharpJavaTokenTypes.cs" />
<Compile Include="${cs2jtx.src.dir}\CSharpLexer.cs" />
<Compile Include="${cs2jtx.src.dir}\CSharpLexerBase.cs" />
<Compile Include="${cs2jtx.src.dir}\CSharpLexerBaseTokenTypes.cs" />
<Compile Include="${cs2jtx.src.dir}\CSharpLexerTokenTypes.cs" />
<Compile Include="${cs2jtx.src.dir}\CSharpParser.cs" />
<Compile Include="${cs2jtx.src.dir}\CSharpPreprocessorHooverLexer.cs" />
<Compile Include="${cs2jtx.src.dir}\CSharpPreprocessorLexer.cs" />
<Compile Include="${cs2jtx.src.dir}\CSharpPreprocessTokenTypes.cs" />
<Compile Include="${cs2jtx.src.dir}\CustomHiddenStreamToken.cs" />
<Compile Include="${cs2jtx.src.dir}\CSharpTranslator.cs" />
<Compile Include="${cs2jtx.src.dir}\Exception.cs" />
<Compile Include="${cs2jtx.src.dir}\JavaPrettyPrinter.cs" />
<Compile Include="${cs2jtx.src.dir}\JavaTreeParser.cs" />
<Compile Include="${cs2jtx.src.dir}\Main.cs" />
<Compile Include="${cs2jtx.src.dir}\NetTranslator.cs" />
<Compile Include="${cs2jtx.src.dir}\Properties\AssemblyInfo.cs" />
<Compile Include="${cs2jtx.src.dir}\Set.cs" />
<Compile Include="${cs2jtx.src.dir}\SymbolTable.cs" />
<Compile Include="${cs2jtx.src.dir}\TypeRep.cs" />
<Compile Include="${cs2jtx.src.dir}\UnicodeLexerBase.cs" />
<Compile Include="${cs2jtx.src.dir}\UnicodeLexerBaseTokenTypes.cs" />
</ItemGroup>
</Project>
</dn:build>
</dn:msbuild>
<copy file="${antlr.dll.dir}/antlr.astframe.dll" todir="${cs2jtx.bin.dir}"/>
<copy file="${antlr.dll.dir}/antlr.runtime.dll" todir="${cs2jtx.bin.dir}"/>
</target>
<!-- "C:\Documents and Settings\kevin.glynn\My Documents\Visual Studio
2005\Projects\Translator\Translator\bin\Debug\Translator.exe" -dumpxml
-odir "C:\Documents and
Settings\kevin.glynn\eclipsews\RusticiSoftware.ScormUntethered.Logic\src"
-netdir "c:\Documents and Settings\kevin.glynn\eclipsews\CS2JLibrary"
-appdir "c:\docume~1\kevin~1.gly\locals~1\temp\tmpk6_pcn" -cheatdir
"c:\Documents and Settings\kevin.glynn\My Documents\Cheats"
"c:\docume~1\kevin~1.gly\locals~1\temp\tmpk6_pcn\UntetheredLogic" -->
<target name="translateCS2J" depends="init" description="run translator" unless="is.run.cancelled">
<dn:dotnetexec executable="${cs2jtx.exe}">
<arg value="-version"/>
<arg value="-v"/>
<arg value="-dumpxml"/>
<arg value="-xmldir"/>
<arg file="${cs2jtx.build.dir}/xmls"/>
<arg value="-dumpenums"/>
<arg file="${cs2jtx.build.dir}/enums.xml"/>
<arg value="-cheatdir"/>
<arg file="${cheats.dir}"/>
<arg value="-netdir"/>
<arg file="${cs2j.dir}"/>
<arg value="-exnetdir"/>
<arg file="${cs2j.dir}/build.xml"/>
<arg value="-appdir"/>
<arg file="${cs.app.dir}"/>
<arg value="-odir"/>
<arg file="${java.output.dir}"/>
<arg file="${cs.tx.dir}" />
</dn:dotnetexec>
</target>
<target name="dumpProperties" depends="init" description="output all set properties, a useful sanity check">
<echoproperties />
</target>
<target name="init" depends="" unless="is.run.cancelled">
<property file="${user.home}/${ant.project.name}.build.properties" />
<property file="${user.home}/build.properties" />
<property file="build.properties" />
<mkdir dir="${cs2jtx.build.dir}" />
</target>
<target name="clean" depends="init" description="clean out build area">
<!-- create dir if it doesn't exist, so delete only fails if there is a real problem -->
<mkdir dir="${build.dir}"/>
<delete failonerror="true" dir="${build.dir}" />
<mkdir dir="${cs2jtx.build.dir}"/>
<delete failonerror="true" dir="${cs2jtx.build.dir}" />
</target>
<target name="dist" depends="buildTranslator" description="Make a distribution of cs2j">
<fail message="You must set the distribution version number (cs2j.dist.version)" unless="cs2j.dist.version" />
<fail message="You must set the directory containing documentation (cs2j.doc.dir)" unless="cs2j.doc.dir" />
<delete failonerror="false" dir="${build.dir}/cs2j" />
<mkdir dir="${build.dir}/cs2j" />
<mkdir dir="${cs2j.dist.dir}" />
<echo message="do dist :) ${cs2jtx.exe}" />
<property name="cs2j.pack.dir" value="${build.dir}/cs2j/pack/cs2j_${cs2j.dist.version}/" />
<!-- cs2j executable -->
<copy todir="${cs2j.pack.dir}/Bin/">
<fileset dir="${cs2jtx.bin.dir}" excludes="*.vshost.exe*"/>
</copy>
<copy todir="${cs2j.pack.dir}/lib/">
<fileset dir="./lib" excludes="antlr.jar"/>
</copy>
<copy todir="${cs2j.pack.dir}">
<fileset dir="${cs2j.doc.dir}" />
</copy>
<copy todir="${cs2j.pack.dir}" file="./build.xml" />
<copy todir="${cs2j.pack.dir}" file="./dist/build.properties" />
<copy todir="${cs2j.pack.dir}/CS2JLibrary">
<fileset dir="${cs2j.proj.dir}">
<include name="src/**/*" />
<include name="LICENSE" />
<include name="NOTICE" />
<include name="build.*" />
<include name=".project" />
<include name=".classpath" />
<include name="lib/*" />
<include name="NetTranslations/**/*" />
</fileset>
</copy>
<zip destfile="${cs2j.dist.dir}/cs2j_${cs2j.dist.version}.zip" basedir="${cs2j.pack.dir}/../" />
</target>
</project>