Merge pull request #45 from sharwell/fix-32

Add the ability to explicitly specify the path to the Java executable
This commit is contained in:
Sam Harwell 2014-04-28 07:02:15 -05:00
commit 6789bd6cbc
4 changed files with 25 additions and 2 deletions

View File

@ -138,6 +138,7 @@
ToolPath="$(Antlr4ToolLocation)"
JavaVendor="$(Antlr4JavaVendor)"
JavaInstallation="$(Antlr4JavaInstallation)"
JavaExecutable="$(Antlr4JavaExecutable)"
BuildTaskPath="$(Antlr4BuildTaskLocation)"
OutputPath="$(IntermediateOutputPath)"
TargetLanguage="%(Antlr4.TargetLanguage)"

View File

@ -133,6 +133,7 @@
ToolPath="$(Antlr4ToolLocation)"
JavaVendor="$(Antlr4JavaVendor)"
JavaInstallation="$(Antlr4JavaInstallation)"
JavaExecutable="$(Antlr4JavaExecutable)"
BuildTaskPath="$(Antlr4BuildTaskLocation)"
OutputPath="$(IntermediateOutputPath)"
TargetLanguage="%(Antlr4.TargetLanguage)"

View File

@ -163,6 +163,12 @@ namespace Antlr4.Build.Tasks
set;
}
public string JavaExecutable
{
get;
set;
}
[Output]
public ITaskItem[] GeneratedCodeFiles
{
@ -332,6 +338,7 @@ namespace Antlr4.Build.Tasks
wrapper.AbstractGrammar = AbstractGrammar;
wrapper.JavaVendor = JavaVendor;
wrapper.JavaInstallation = JavaInstallation;
wrapper.JavaExecutable = JavaExecutable;
return wrapper;
}

View File

@ -130,6 +130,12 @@ namespace Antlr4.Build.Tasks
set;
}
public string JavaExecutable
{
get;
set;
}
public IList<string> SourceCodeFiles
{
get
@ -239,8 +245,16 @@ namespace Antlr4.Build.Tasks
{
try
{
string javaHome = JavaHome;
string java = Path.Combine(Path.Combine(javaHome, "bin"), "java.exe");
string java;
if (!string.IsNullOrEmpty(JavaExecutable))
{
java = JavaExecutable;
}
else
{
string javaHome = JavaHome;
java = Path.Combine(Path.Combine(javaHome, "bin"), "java.exe");
}
List<string> arguments = new List<string>();
arguments.Add("-cp");