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)" ToolPath="$(Antlr4ToolLocation)"
JavaVendor="$(Antlr4JavaVendor)" JavaVendor="$(Antlr4JavaVendor)"
JavaInstallation="$(Antlr4JavaInstallation)" JavaInstallation="$(Antlr4JavaInstallation)"
JavaExecutable="$(Antlr4JavaExecutable)"
BuildTaskPath="$(Antlr4BuildTaskLocation)" BuildTaskPath="$(Antlr4BuildTaskLocation)"
OutputPath="$(IntermediateOutputPath)" OutputPath="$(IntermediateOutputPath)"
TargetLanguage="%(Antlr4.TargetLanguage)" TargetLanguage="%(Antlr4.TargetLanguage)"

View File

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

View File

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

View File

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