mirror of
https://github.com/twiglet/cs2j.git
synced 2025-01-18 13:15:17 +01:00
Add CSharpTranslator to rustici/trunk branch. Synched to rev 13553
This commit is contained in:
parent
ff8ef87f54
commit
21851337c5
11
CSharpTranslator/antlr2/.project
Normal file
11
CSharpTranslator/antlr2/.project
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>CSharpTranslator</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
@ -4,11 +4,6 @@ Microsoft Visual Studio Solution File, Format Version 9.00
|
|||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Translator", "Translator\Translator.csproj", "{D33074E4-1525-4F22-A1DB-A7F30989D8FE}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Translator", "Translator\Translator.csproj", "{D33074E4-1525-4F22-A1DB-A7F30989D8FE}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8ECA4801-3F48-4FD1-91B4-4DFB567D913B}"
|
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{8ECA4801-3F48-4FD1-91B4-4DFB567D913B}"
|
||||||
ProjectSection(SolutionItems) = preProject
|
|
||||||
build.properties = build.properties
|
|
||||||
build.xml = build.xml
|
|
||||||
README.txt = README.txt
|
|
||||||
EndProjectSection
|
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
@ -1,28 +0,0 @@
|
|||||||
Welcome to CS2J, a C# to Java translator
|
|
||||||
|
|
||||||
In this directory you will find:
|
|
||||||
|
|
||||||
Translator: A C# project that can be built in Visual Studio 2005. It requires a version of Antlr that can generate C# to be on
|
|
||||||
your path. It builds to a command line application. Run it without arguments to see how to use it to translate C# projects to Java.
|
|
||||||
Although the project knows to use antlr to build the grammar files VS2005 has trouble with getting the dependencies straight. For
|
|
||||||
a trouble free development I suggest you run MSBuild directly in the project directory, e.g.:
|
|
||||||
|
|
||||||
kevin.glynn@D11624C1 ~/winhome/My Documents/Visual Studio 2005/Projects/Translator/Translator
|
|
||||||
$ /cygdrive/c/WINDOWS/Microsoft.NET/Framework/v2.0.50727/MSBuild.exe
|
|
||||||
|
|
||||||
works for me under cygwin.
|
|
||||||
|
|
||||||
In order that the -show<etc> options work you will need to add antlr.astframe.dll and antlr.runtime.dll (from the antlr distribution)
|
|
||||||
to your project references.
|
|
||||||
|
|
||||||
|
|
||||||
CS2JLibrary: These are the XML translation files for the .NET library. Copy them into your filesystem, this location will be passed
|
|
||||||
as your translator's -netdir argument.
|
|
||||||
|
|
||||||
CS2JLibrary: This is a Java project containing supporting code that will be required by the translated code to build and
|
|
||||||
run. Load it into a project in your Java environment and make your translated project depend on it.
|
|
||||||
|
|
||||||
|
|
||||||
Disclaimer: By the way, the translator doesn't quite work yet ....
|
|
||||||
|
|
||||||
Kevin (kevin.glynn@scorm.com)
|
|
30
CSharpTranslator/antlr2/Translator/.gitignore
vendored
30
CSharpTranslator/antlr2/Translator/.gitignore
vendored
@ -1,30 +0,0 @@
|
|||||||
CSharpEnvBuilder.cs
|
|
||||||
CSharpEnvBuilderTokenTypes.cs
|
|
||||||
CSharpEnvBuilderTokenTypes.txt
|
|
||||||
CSharpHooverTokenTypes.cs
|
|
||||||
CSharpHooverTokenTypes.txt
|
|
||||||
CSharpJavaTokenTypes.cs
|
|
||||||
CSharpJavaTokenTypes.txt
|
|
||||||
CSharpLexer.cs
|
|
||||||
CSharpLexerBase.cs
|
|
||||||
CSharpLexerBaseTokenTypes.cs
|
|
||||||
CSharpLexerBaseTokenTypes.txt
|
|
||||||
CSharpLexerTokenTypes.cs
|
|
||||||
CSharpLexerTokenTypes.txt
|
|
||||||
CSharpParser.cs
|
|
||||||
CSharpPreprocessTokenTypes.cs
|
|
||||||
CSharpPreprocessTokenTypes.txt
|
|
||||||
CSharpPreprocessorHooverLexer.cs
|
|
||||||
CSharpPreprocessorLexer.cs
|
|
||||||
CSharpTranslator.cs
|
|
||||||
CSharpTranslatorTokenTypes.cs
|
|
||||||
CSharpTranslatorTokenTypes.txt
|
|
||||||
JavaPrettyPrinter.cs
|
|
||||||
JavaPrettyPrinterTokenTypes.cs
|
|
||||||
JavaPrettyPrinterTokenTypes.txt
|
|
||||||
NetTranslator.cs
|
|
||||||
NetTranslatorTokenTypes.cs
|
|
||||||
NetTranslatorTokenTypes.txt
|
|
||||||
UnicodeLexerBase.cs
|
|
||||||
UnicodeLexerBaseTokenTypes.cs
|
|
||||||
UnicodeLexerBaseTokenTypes.txt
|
|
@ -114,11 +114,8 @@ namespace RusticiSoftware.Translator
|
|||||||
|
|
||||||
public void CopyPositionFrom(ASTNode other)
|
public void CopyPositionFrom(ASTNode other)
|
||||||
{
|
{
|
||||||
if (other != null) // it might be if we are recovering from a parse error
|
Line = other.Line;
|
||||||
{
|
Column = other.Column;
|
||||||
Line = other.Line;
|
|
||||||
Column = other.Column;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
|
@ -346,8 +346,7 @@ type!
|
|||||||
ASTNode starsBase = #[STARS, "STARS"];
|
ASTNode starsBase = #[STARS, "STARS"];
|
||||||
}
|
}
|
||||||
: (
|
: (
|
||||||
( p:predefinedTypeName { typeBase = #p; } |
|
( p:predefinedTypeName { typeBase = #p; } | q:qualifiedIdentifier { typeBase = #q; } ) // typeName
|
||||||
q:qualifiedIdentifier { typeBase = #q; } (LTHAN type (COMMA type)* GTHAN)? ) // typeName
|
|
||||||
(
|
(
|
||||||
s1:STAR // pointerType
|
s1:STAR // pointerType
|
||||||
{
|
{
|
||||||
@ -1098,7 +1097,7 @@ modifier
|
|||||||
//
|
//
|
||||||
|
|
||||||
classDeclaration! [AST attribs, AST modifiers]
|
classDeclaration! [AST attribs, AST modifiers]
|
||||||
: cl:CLASS id:identifier (LTHAN type (COMMA type)* GTHAN)? ba:classBase bo:classBody ( options { greedy = true; } : SEMI! )?
|
: cl:CLASS id:identifier ba:classBase bo:classBody ( options { greedy = true; } : SEMI! )?
|
||||||
{ ## = #( #cl, #attribs, #modifiers, #id, #ba, #bo ); }
|
{ ## = #( #cl, #attribs, #modifiers, #id, #ba, #bo ); }
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -1661,7 +1660,7 @@ delegateDeclaration! [AST attribs, AST modifiers]
|
|||||||
typ1:voidAsType { typ = #typ1; }
|
typ1:voidAsType { typ = #typ1; }
|
||||||
| typ2:type { typ = #typ2; }
|
| typ2:type { typ = #typ2; }
|
||||||
)
|
)
|
||||||
id:identifier (LTHAN type (COMMA type)* GTHAN)? OPEN_PAREN! ( fp:formalParameterList )? CLOSE_PAREN! SEMI!
|
id:identifier OPEN_PAREN! ( fp:formalParameterList )? CLOSE_PAREN! SEMI!
|
||||||
{ ## = #( #dlg, #attribs, #modifiers, #typ, #id, #fp ); }
|
{ ## = #( #dlg, #attribs, #modifiers, #typ, #id, #fp ); }
|
||||||
;
|
;
|
||||||
|
|
||||||
|
@ -1424,18 +1424,12 @@ staticConstructorBody [Object w]
|
|||||||
: body[w]
|
: body[w]
|
||||||
;
|
;
|
||||||
|
|
||||||
destructorDeclaration! [Object w]
|
destructorDeclaration [Object w]
|
||||||
: #( DTOR_DECL attributes[w] modifiers[w] identifier[w]
|
: #( DTOR_DECL attributes[w] modifiers[w] identifier[w]
|
||||||
b:destructorBody[w]
|
destructorBody[w]
|
||||||
)
|
)
|
||||||
{ ## = #( [METHOD_DECL],
|
|
||||||
#( [MODIFIERS], [PROTECTED, "protected"] ),
|
|
||||||
#( [TYPE], [VOID, "void"], #( [ARRAY_RANKS] ) ),
|
|
||||||
#( [IDENTIFIER, "finalize"]) ,
|
|
||||||
#( [FORMAL_PARAMETER_LIST] ), #( [THROWS, "throws"], [IDENTIFIER, "Throwable"] ),
|
|
||||||
astFactory.dupTree(#b) ); }
|
|
||||||
;
|
;
|
||||||
|
|
||||||
destructorBody [Object w]
|
destructorBody [Object w]
|
||||||
: body[w]
|
: body[w]
|
||||||
;
|
;
|
||||||
|
@ -36,8 +36,6 @@ options {
|
|||||||
private XmlTextWriter enumXmlWriter;
|
private XmlTextWriter enumXmlWriter;
|
||||||
private ArrayList enumMembers = new ArrayList();
|
private ArrayList enumMembers = new ArrayList();
|
||||||
|
|
||||||
private bool inClassModifiers = false; // Filter out static, this isn't the right place but pending rewrite this is quickest.
|
|
||||||
|
|
||||||
/** walk list of hidden tokens in order, printing them out */
|
/** walk list of hidden tokens in order, printing them out */
|
||||||
public void dumpHidden(TextWriter w, antlr.IHiddenStreamToken t) {
|
public void dumpHidden(TextWriter w, antlr.IHiddenStreamToken t) {
|
||||||
for ( ; t!=null ; t=filter.getHiddenAfter(t) ) {
|
for ( ; t!=null ; t=filter.getHiddenAfter(t) ) {
|
||||||
@ -279,8 +277,8 @@ importDefinition [TextWriter w]
|
|||||||
;
|
;
|
||||||
|
|
||||||
typeDefinition [TextWriter w]
|
typeDefinition [TextWriter w]
|
||||||
: #(cl:CLASS {inClassModifiers = true; }
|
: #(cl:CLASS
|
||||||
modifiers[w] {inClassModifiers = false; }
|
modifiers[w]
|
||||||
id:IDENTIFIER { Print(w, "class "); Print(w, #id, " "); }
|
id:IDENTIFIER { Print(w, "class "); Print(w, #id, " "); }
|
||||||
extendsClause[w]
|
extendsClause[w]
|
||||||
implementsClause[w] { PrintNL(w); Print(w, "{"); PrintNL(w); indentLevel++; }
|
implementsClause[w] { PrintNL(w); Print(w, "{"); PrintNL(w); indentLevel++; }
|
||||||
@ -368,7 +366,7 @@ modifier [TextWriter w]
|
|||||||
: mpr:"private" { Print(w, #mpr); }
|
: mpr:"private" { Print(w, #mpr); }
|
||||||
| mpu:"public" { Print(w, #mpu); }
|
| mpu:"public" { Print(w, #mpu); }
|
||||||
| mpt:"protected" { Print(w, #mpt); }
|
| mpt:"protected" { Print(w, #mpt); }
|
||||||
| mst:"static" { if (!inClassModifiers) {Print(w, #mst);} }
|
| mst:"static" { Print(w, #mst); }
|
||||||
| mtr:"transient" { Print(w, #mtr); }
|
| mtr:"transient" { Print(w, #mtr); }
|
||||||
| mfi:FINAL { Print(w, #mfi); }
|
| mfi:FINAL { Print(w, #mfi); }
|
||||||
| mab:ABSTRACT { Print(w, #mab); }
|
| mab:ABSTRACT { Print(w, #mab); }
|
||||||
@ -538,7 +536,7 @@ stat [TextWriter w]
|
|||||||
typeDefinition[w]
|
typeDefinition[w]
|
||||||
| variableDef[w] { Print(w, ";"); }
|
| variableDef[w] { Print(w, ";"); }
|
||||||
| #(EXPR_STMT expression[w]) { Print(w, ";"); }
|
| #(EXPR_STMT expression[w]) { Print(w, ";"); }
|
||||||
| #(LABEL_STMT id:IDENTIFIER { Print(w, #id, ": "); } stat[w])
|
| #(LABELED_STAT id:IDENTIFIER { Print(w, #id, ": "); } stat[w])
|
||||||
| #(lif:IF { Print(w, #lif, " ("); }
|
| #(lif:IF { Print(w, #lif, " ("); }
|
||||||
expression[w] { Print(w, ")"); PrintNL(w); }
|
expression[w] { Print(w, ")"); PrintNL(w); }
|
||||||
stat[w]
|
stat[w]
|
||||||
@ -565,9 +563,8 @@ stat [TextWriter w]
|
|||||||
stat[w] { Print(w, "while ("); }
|
stat[w] { Print(w, "while ("); }
|
||||||
expression[w] { Print(w, ");"); }
|
expression[w] { Print(w, ");"); }
|
||||||
)
|
)
|
||||||
| #(gt:"goto" { Print(w, "// TODO: CS2J: goto is not supported by Java."); PrintNL(w); Print(w, "continue "); } gid:IDENTIFIER { Print(w, #gid); Print(w, ";"); } )
|
| #(br:"break" { Print(w, #br); } ( { Print(w, " "); } IDENTIFIER)? { Print(w, ";"); } )
|
||||||
| #(br:"break" { Print(w, #br); } ( { Print(w, " "); } bid:IDENTIFIER { Print(w, #bid); } )? { Print(w, ";"); } )
|
| #(co:"continue" { Print(w, #co); } ( { Print(w, " "); } IDENTIFIER)? { Print(w, ";"); } )
|
||||||
| #(co:"continue" { Print(w, #co); } ( { Print(w, " "); } cid:IDENTIFIER { Print(w, #cid); } )? { Print(w, ";"); } )
|
|
||||||
| #(re:"return" { Print(w, #re); } ( { Print(w, " "); } expression[w])? { Print(w, ";"); } )
|
| #(re:"return" { Print(w, #re); } ( { Print(w, " "); } expression[w])? { Print(w, ";"); } )
|
||||||
| #(sw:"switch" { Print(w, #sw, " ("); }
|
| #(sw:"switch" { Print(w, #sw, " ("); }
|
||||||
expression[w] { Print(w, ")"); PrintNL(w); Print(w, "{"); indentLevel++; PrintNL(w); }
|
expression[w] { Print(w, ")"); PrintNL(w); Print(w, "{"); indentLevel++; PrintNL(w); }
|
||||||
@ -752,7 +749,7 @@ constant [TextWriter w]
|
|||||||
| st:STRING_LITERAL { Print(w, #st); }
|
| st:STRING_LITERAL { Print(w, #st); }
|
||||||
| fl:NUM_FLOAT { Print(w, #fl); }
|
| fl:NUM_FLOAT { Print(w, #fl); }
|
||||||
| db:DOUBLE_LITERAL { Print(w, #db); }
|
| db:DOUBLE_LITERAL { Print(w, #db); }
|
||||||
| flt:FLOAT_LITERAL { Print(w, #flt); }
|
| flr:FLOAT_LITERAL { Print(w, #flr); }
|
||||||
| lo:LONG_LITERAL { Print(w, #lo); Print(w, "L"); }
|
| lo:LONG_LITERAL { Print(w, #lo); Print(w, "L"); }
|
||||||
| ul:ULONG_LITERAL { Print(w, #ul); Print(w, "L"); }
|
| ul:ULONG_LITERAL { Print(w, #ul); Print(w, "L"); }
|
||||||
| de:DECIMAL_LITERAL { Print(w, #de, "/* Unsupported Decimal Literal */"); }
|
| de:DECIMAL_LITERAL { Print(w, #de, "/* Unsupported Decimal Literal */"); }
|
||||||
|
@ -206,7 +206,7 @@ namespace RusticiSoftware.Translator
|
|||||||
i++;
|
i++;
|
||||||
string[] argDirs = args[i].Split(';');
|
string[] argDirs = args[i].Split(';');
|
||||||
for (int j = 0; j < argDirs.Length; j++)
|
for (int j = 0; j < argDirs.Length; j++)
|
||||||
argDirs[j] = Path.GetFullPath(argDirs[j]).ToLower();
|
argDirs[j] = Path.GetFullPath(argDirs[j]);
|
||||||
netRoot.AddRange(argDirs);
|
netRoot.AddRange(argDirs);
|
||||||
}
|
}
|
||||||
else if (args[i].ToLower().Equals("-exnetdir") && i < (args.Length - 1))
|
else if (args[i].ToLower().Equals("-exnetdir") && i < (args.Length - 1))
|
||||||
@ -259,6 +259,20 @@ namespace RusticiSoftware.Translator
|
|||||||
|
|
||||||
Console.Out.WriteLine(String.Format("\nFound {0} .Net template files ({1} processed successfully)\n", numFilesProcessed, numFilesSuccessfullyProcessed));
|
Console.Out.WriteLine(String.Format("\nFound {0} .Net template files ({1} processed successfully)\n", numFilesProcessed, numFilesSuccessfullyProcessed));
|
||||||
|
|
||||||
|
// Sanity Checks
|
||||||
|
if (numFilesProcessed == 0)
|
||||||
|
{
|
||||||
|
Console.Error.WriteLine("Can't find any templates, aborting.");
|
||||||
|
Environment.Exit(1);
|
||||||
|
}
|
||||||
|
const double MIN_SUCCESS_RATIO = .9d;
|
||||||
|
if (((Double)numFilesSuccessfullyProcessed / (Double)numFilesProcessed) < MIN_SUCCESS_RATIO)
|
||||||
|
{
|
||||||
|
Console.Error.WriteLine("Success ratio below " + MIN_SUCCESS_RATIO + " aborting.");
|
||||||
|
Environment.Exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Load Application Class Signatures (i.e. generate templates)
|
// Load Application Class Signatures (i.e. generate templates)
|
||||||
if (appRoot.Count == 0)
|
if (appRoot.Count == 0)
|
||||||
// By default translation target is application root
|
// By default translation target is application root
|
||||||
|
@ -762,7 +762,7 @@ stat [object w]
|
|||||||
: typeDefinition[w]
|
: typeDefinition[w]
|
||||||
| variableDef[w, true]
|
| variableDef[w, true]
|
||||||
| #(EXPR_STMT expression[w])
|
| #(EXPR_STMT expression[w])
|
||||||
| #(LABEL_STMT IDENTIFIER stat[w])
|
| #(LABELED_STAT IDENTIFIER stat[w])
|
||||||
| #(IF
|
| #(IF
|
||||||
expression[w]
|
expression[w]
|
||||||
stat[w]
|
stat[w]
|
||||||
@ -829,7 +829,6 @@ stat [object w]
|
|||||||
stat[w]
|
stat[w]
|
||||||
expression[w]
|
expression[w]
|
||||||
)
|
)
|
||||||
| #("goto" IDENTIFIER )
|
|
||||||
| #("break" ( IDENTIFIER)? )
|
| #("break" ( IDENTIFIER)? )
|
||||||
| #("continue" ( IDENTIFIER)? )
|
| #("continue" ( IDENTIFIER)? )
|
||||||
| #("return" ( expression[w])? )
|
| #("return" ( expression[w])? )
|
||||||
@ -1259,7 +1258,7 @@ primaryExpression [object w]
|
|||||||
{
|
{
|
||||||
ASTNode kosherInp = #( [INVOCATION_EXPR], #e, #args);
|
ASTNode kosherInp = #( [INVOCATION_EXPR], #e, #args);
|
||||||
ASTNode retAST = null;
|
ASTNode retAST = null;
|
||||||
if (#e != null && #e.Type == IDENTIFIER && symtab[#e.getText()] == null)
|
if (#e.Type == IDENTIFIER && symtab[#e.getText()] == null)
|
||||||
{
|
{
|
||||||
// Is it a local method call?
|
// Is it a local method call?
|
||||||
ASTNode thisNode = #( [THIS, "DUMMYTHIS"] );
|
ASTNode thisNode = #( [THIS, "DUMMYTHIS"] );
|
||||||
@ -1267,7 +1266,7 @@ primaryExpression [object w]
|
|||||||
retAST = ResolveMethod( #( [INVOCATION_EXPR], #( [MEMBER_ACCESS_EXPR], thisNode, astFactory.dupTree(#e)),
|
retAST = ResolveMethod( #( [INVOCATION_EXPR], #( [MEMBER_ACCESS_EXPR], thisNode, astFactory.dupTree(#e)),
|
||||||
astFactory.dupTree(#args)) );
|
astFactory.dupTree(#args)) );
|
||||||
}
|
}
|
||||||
else if (#e != null && #e.Type == MEMBER_ACCESS_EXPR && #e.getFirstChild().getNextSibling().Type == IDENTIFIER)
|
else if (#e.Type == MEMBER_ACCESS_EXPR && #e.getFirstChild().getNextSibling().Type == IDENTIFIER)
|
||||||
{ // resolve method call
|
{ // resolve method call
|
||||||
retAST = ResolveMethod( kosherInp );
|
retAST = ResolveMethod( kosherInp );
|
||||||
}
|
}
|
||||||
|
@ -424,14 +424,7 @@ namespace RusticiSoftware.Translator
|
|||||||
FieldsD = new Hashtable();
|
FieldsD = new Hashtable();
|
||||||
foreach (FieldRepTemplate ft in template.Fields)
|
foreach (FieldRepTemplate ft in template.Fields)
|
||||||
{
|
{
|
||||||
try
|
FieldsD.Add(ft.Name, FieldRep.newInstance(ft, uPath));
|
||||||
{
|
|
||||||
FieldsD.Add(ft.Name, FieldRep.newInstance(ft, uPath));
|
|
||||||
}
|
|
||||||
catch (Exception x)
|
|
||||||
{
|
|
||||||
Console.Out.WriteLine("Ignore duplicate field (#iffery?)");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Casts = new CastRep[template.Casts.Length];
|
Casts = new CastRep[template.Casts.Length];
|
||||||
for (int i = 0; i < template.Casts.Length; i++)
|
for (int i = 0; i < template.Casts.Length; i++)
|
||||||
|
@ -25,16 +25,32 @@ cs2jtx.build.dir=${build.dir}/cs2jtx
|
|||||||
cs2jtx.exe= ${cs2jtx.bin.dir}/Translator.exe
|
cs2jtx.exe= ${cs2jtx.bin.dir}/Translator.exe
|
||||||
#cs2jtx.exe= ${basedir}/../bin/Translator.exe
|
#cs2jtx.exe= ${basedir}/../bin/Translator.exe
|
||||||
|
|
||||||
# by default, sibling directory to Translator
|
|
||||||
cs2j.dir=${basedir}/../../CS2JLibrary/NetTranslations
|
#whichbranch=AmazonBranch
|
||||||
cheats.dir=${basedir}/../../Cheats
|
whichbranch=TrunkBranch
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Sources, by default these are sibling directories of this script
|
||||||
|
#cs2j.dir=${basedir}/../../AmazonBranch/CS2JLibrary
|
||||||
|
#cheats.dir=${basedir}/../AmazonBranch/Cheats
|
||||||
|
|
||||||
|
cs2j.dir=${basedir}/../../${whichbranch}/CS2JLibrary
|
||||||
|
cheats.dir=${basedir}/../${whichbranch}/Cheats
|
||||||
|
|
||||||
# Directories to build into, against
|
# Directories to build into, against
|
||||||
|
cs.app.name=ScormEngineNetTrunk
|
||||||
|
#cs.app.name=Amazonsimpledb4thed
|
||||||
|
#cs.app.dir=${user.home}/My Documents/gitrepos/${cs.app.name}/src/app/ScormEngine.Core
|
||||||
|
cs.app.dir=${user.home}/My Documents/Visual Studio 2005/Projects/${cs.app.name}/src/app/ScormEngine.Core
|
||||||
|
|
||||||
# If no cs.app.dir set make it equal to cs.tx.dir
|
# Set cs.tx.project if you want to translate a subset of the application
|
||||||
cs.app.dir=${cs.tx.dir}
|
#cs.tx.project=ScormEngine.Core/Logic
|
||||||
|
cs.tx.project=Logic
|
||||||
|
cs.tx.dir=${cs.app.dir}/${cs.tx.project}
|
||||||
|
|
||||||
# Object of the translation, by default in the build area
|
# Object of the translation, by default in the build area
|
||||||
java.output.dir=${build.dir}/javaproject/src
|
#java.output.dir=${user.home}/My Documents/AmazonBranch/RusticiSoftware.ScormContentPlayer.Logic/src
|
||||||
|
java.output.dir=${user.home}/My Documents/${whichbranch}/RusticiSoftware.ScormContentPlayer.Logic/src
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,74 +1,20 @@
|
|||||||
<?xml-stylesheet type="text/xsl" href="file://C:\ant\etc\antex\antprettybuild\antprettybuild-3.1.1.xsl"?>
|
<?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">
|
<project name="cs2jTranslator" default="" basedir="." xmlns:dn="antlib:org.apache.ant.dotnet">
|
||||||
|
|
||||||
<description>
|
<description>
|
||||||
This script builds the cs2j translator and translates C# code
|
This script builds the cs2j translator and translates C# code
|
||||||
</description>
|
</description>
|
||||||
|
|
||||||
|
<property file="${user.home}/${ant.project.name}.build.properties" />
|
||||||
|
<property file="${user.home}/build.properties" />
|
||||||
|
<property file="build.properties" />
|
||||||
|
|
||||||
<property name="builder.ant.lib" value="${basedir}/lib"/>
|
|
||||||
<!-- load the ant-dotnet task, see http://ant.apache.org/antlibs/dotnet/index.html -->
|
<!-- 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" />
|
<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"/>
|
<!-- We could have left this in the msbuild script fed to buildTranslator, but it is clearer in Ant :) -->
|
||||||
<target name="launch-full" depends="launch-full-form,run" description="Graphical Launch with all options"/>
|
<target name="antlrTranslator" depends="init">
|
||||||
|
|
||||||
<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">
|
<antlr target="${cs2jtx.src.dir}/UnicodeLexerBase.g">
|
||||||
<classpath> <pathelement location="${builder.ant.lib}/antlr.jar"/> </classpath>
|
<classpath> <pathelement location="${builder.ant.lib}/antlr.jar"/> </classpath>
|
||||||
</antlr>
|
</antlr>
|
||||||
@ -109,7 +55,7 @@ ork\v2.0.50727\System.dll /reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.507
|
|||||||
/target:exe
|
/target:exe
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<target name="buildTranslator" depends="antlrTranslator" description="Builds CSharp to Java Translator" unless="is.run.cancelled">
|
<target name="buildTranslator" depends="antlrTranslator" description="Builds CSharp to Java Translator">
|
||||||
<mkdir dir="${cs2jtx.bin.dir}/"/>
|
<mkdir dir="${cs2jtx.bin.dir}/"/>
|
||||||
<dn:msbuild>
|
<dn:msbuild>
|
||||||
<dn:build>
|
<dn:build>
|
||||||
@ -184,10 +130,9 @@ Settings\kevin.glynn\eclipsews\RusticiSoftware.ScormUntethered.Logic\src"
|
|||||||
"c:\Documents and Settings\kevin.glynn\My Documents\Cheats"
|
"c:\Documents and Settings\kevin.glynn\My Documents\Cheats"
|
||||||
"c:\docume~1\kevin~1.gly\locals~1\temp\tmpk6_pcn\UntetheredLogic" -->
|
"c:\docume~1\kevin~1.gly\locals~1\temp\tmpk6_pcn\UntetheredLogic" -->
|
||||||
|
|
||||||
<target name="translateCS2J" depends="init" description="run translator" unless="is.run.cancelled">
|
<target name="translateCS2J" depends="init" description="run translator">
|
||||||
<dn:dotnetexec executable="${cs2jtx.exe}">
|
<dn:dotnetexec executable="${cs2jtx.exe}">
|
||||||
<arg value="-version"/>
|
<arg value="-version"/>
|
||||||
<arg value="-v"/>
|
|
||||||
<arg value="-dumpxml"/>
|
<arg value="-dumpxml"/>
|
||||||
<arg value="-xmldir"/>
|
<arg value="-xmldir"/>
|
||||||
<arg file="${cs2jtx.build.dir}/xmls"/>
|
<arg file="${cs2jtx.build.dir}/xmls"/>
|
||||||
@ -207,16 +152,18 @@ Settings\kevin.glynn\eclipsews\RusticiSoftware.ScormUntethered.Logic\src"
|
|||||||
</dn:dotnetexec>
|
</dn:dotnetexec>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="dumpProperties" depends="init" description="output all set properties, a useful sanity check">
|
<target name="echoTranslateCS2J" depends="" description="echo run translator command line">
|
||||||
|
<echo>
|
||||||
|
"${cs2jtx.exe} -dumpxml -odir ${java.output.dir} -netdir ${cs2j.dir} -appdir ${cs.app.dir} -cheatdir ${cheats.dir} ${cs.tx.dir}"
|
||||||
|
</echo>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="dumpProperties" description="output all set properties, a useful sanity check">
|
||||||
<echoproperties />
|
<echoproperties />
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="init" depends="" unless="is.run.cancelled">
|
<target name="init" depends="">
|
||||||
<property file="${user.home}/${ant.project.name}.build.properties" />
|
<mkdir dir="${cs2jtx.build.dir}" />
|
||||||
<property file="${user.home}/build.properties" />
|
|
||||||
<property file="build.properties" />
|
|
||||||
|
|
||||||
<mkdir dir="${cs2jtx.build.dir}" />
|
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
<target name="clean" depends="" description="clean out build area">
|
<target name="clean" depends="" description="clean out build area">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user