Skip to content

Commit

Permalink
Merge pull request #45 from sharwell/fix-32
Browse files Browse the repository at this point in the history
Add the ability to explicitly specify the path to the Java executable
  • Loading branch information
sharwell committed Apr 28, 2014
2 parents 3194fa0 + d63a9e3 commit 6789bd6
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
1 change: 1 addition & 0 deletions runtime/CSharp/Antlr4BuildTasks/Antlr4.v3.5.targets
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
ToolPath="$(Antlr4ToolLocation)"
JavaVendor="$(Antlr4JavaVendor)"
JavaInstallation="$(Antlr4JavaInstallation)"
JavaExecutable="$(Antlr4JavaExecutable)"
BuildTaskPath="$(Antlr4BuildTaskLocation)"
OutputPath="$(IntermediateOutputPath)"
TargetLanguage="%(Antlr4.TargetLanguage)"
Expand Down
1 change: 1 addition & 0 deletions runtime/CSharp/Antlr4BuildTasks/Antlr4.v4.0.targets
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
ToolPath="$(Antlr4ToolLocation)"
JavaVendor="$(Antlr4JavaVendor)"
JavaInstallation="$(Antlr4JavaInstallation)"
JavaExecutable="$(Antlr4JavaExecutable)"
BuildTaskPath="$(Antlr4BuildTaskLocation)"
OutputPath="$(IntermediateOutputPath)"
TargetLanguage="%(Antlr4.TargetLanguage)"
Expand Down
7 changes: 7 additions & 0 deletions runtime/CSharp/Antlr4BuildTasks/Antlr4ClassGenerationTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@ public string JavaInstallation
set;
}

public string JavaExecutable
{
get;
set;
}

[Output]
public ITaskItem[] GeneratedCodeFiles
{
Expand Down Expand Up @@ -332,6 +338,7 @@ private AntlrClassGenerationTaskInternal CreateBuildTaskWrapper(AppDomain domain
wrapper.AbstractGrammar = AbstractGrammar;
wrapper.JavaVendor = JavaVendor;
wrapper.JavaInstallation = JavaInstallation;
wrapper.JavaExecutable = JavaExecutable;
return wrapper;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,12 @@ public string JavaInstallation
set;
}

public string JavaExecutable
{
get;
set;
}

public IList<string> SourceCodeFiles
{
get
Expand Down Expand Up @@ -239,8 +245,16 @@ public bool Execute()
{
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");
Expand Down

0 comments on commit 6789bd6

Please sign in to comment.