Cannot handle spaces in project path
Thanks for all your hard work on these Antlr repositories. I am not sure if this is a problem with Antlr4Templates, or Antlr4BuildTasks.
I used Antlr4Templates, specifically the antlr4 template, to create a new project in a new directory. This built fine.
Then I opened the project in Visual Studio and upgraded the nuget package Antlr4BuildTasks to version 9.2.0. Now the project does not build. I have spaces in the project path, and this seems to cause the problem: when processing "Visual Studio Projects" it is breaking up the path at "Studio":
Starting Antlr4 Build Tasks. (TaskId:55)
Placing generated files in IntermediateOutputPath D:\Frank\Visual Studio Projects\DASH\NGAW2\AntlrTest\obj\Debug\net6.0\ (TaskId:55)
AntOutDir is "D:\Frank\Visual Studio Projects\DASH\NGAW2\AntlrTest\obj\Debug\net6.0\" (TaskId:55)
JavaExec is "D:/Frank/Visual Studio Projects/DASH/NGAW2/AntlrTest/obj/Debug/net6.0/Java/jre/bin/java.exe" (TaskId:55)
Antlr4BuildTasks identified that you are looking for version 4.9.3 of the Antlr4 tool jar. (TaskId:55)
Paths to search for Antlr4 jar, in order, are: file:///D:\Frank\Visual Studio Projects\DASH\NGAW2\AntlrTest\obj\Debug\net6.0\;https://repo1.maven.org/maven2/org/antlr/antlr4/4.9.3/;https://repo1.maven.org/maven2/org/antlr/antlr4/4.9.2/;https://repo1.maven.org/maven2/org/antlr/antlr4/4.9.1/;https://repo1.maven.org/maven2/org/antlr/antlr4/4.9/;https://repo1.maven.org/maven2/org/antlr/antlr4/4.8-1/;https://repo1.maven.org/maven2/org/antlr/antlr4/4.8/;https://repo1.maven.org/maven2/org/antlr/antlr4/4.7.2/;https://repo1.maven.org/maven2/org/antlr/antlr4/4.7.1/;https://repo1.maven.org/maven2/org/antlr/antlr4/4.7/;https://repo1.maven.org/maven2/org/antlr/antlr4/4.6/;https://repo1.maven.org/maven2/org/antlr/antlr4/4.5.3/;https://repo1.maven.org/maven2/org/antlr/antlr4/4.5.2-1/;https://repo1.maven.org/maven2/org/antlr/antlr4/4.5.2/;https://repo1.maven.org/maven2/org/antlr/antlr4/4.5.1-1/;https://repo1.maven.org/maven2/org/antlr/antlr4/4.5.1/;https://repo1.maven.org/maven2/org/antlr/antlr4/4.5/;https://repo1.maven.org/maven2/org/antlr/antlr4/4.3/;https://repo1.maven.org/maven2/org/antlr/antlr4/4.2.2/;https://repo1.maven.org/maven2/org/antlr/antlr4/4.2.1/;https://repo1.maven.org/maven2/org/antlr/antlr4/4.2/;https://repo1.maven.org/maven2/org/antlr/antlr4/4.1/;https://repo1.maven.org/maven2/org/antlr/antlr4/4.0/ (TaskId:55)
path is file:///D:\Frank\Visual Studio Projects\DASH\NGAW2\AntlrTest\obj\Debug\net6.0\ (TaskId:55)
Probing file:///D:\Frank\Visual Studio Projects\DASH\NGAW2\AntlrTest\obj\Debug\net6.0\antlr4-4.9.3-complete.jar (TaskId:55)
Local path D:\Frank\Visual Studio Projects\DASH\NGAW2\AntlrTest\obj\Debug\net6.0\antlr4-4.9.3-complete.jar (TaskId:55)
Found. (TaskId:55)
ToolPath is "D:\Frank\Visual Studio Projects\DASH\NGAW2\AntlrTest\obj\Debug\net6.0\antlr4-4.9.3-complete.jar" (TaskId:55)
Executing command: "D:/Frank/Visual Studio Projects/DASH/NGAW2/AntlrTest/obj/Debug/net6.0/Java/jre/bin/java.exe" -cp "D:\Frank\Visual Studio Projects\DASH\NGAW2\AntlrTest\obj\Debug\net6.0\antlr4-4.9.3-complete.jar" org.antlr.v4.Tool -depend -o "D:\Frank\Visual Studio Projects\DASH\NGAW2\AntlrTest\obj\Debug\net6.0\" -encoding UTF-8 -listener -visitor -package AntlrTest -Dlanguage=CSharp "D:\Frank\Visual Studio Projects\DASH\NGAW2\AntlrTest\Arithmetic.g4" (TaskId:55)
14:58:01.187 2:6>C:\Users\frank\.nuget\packages\antlr4buildtasks\9.2.0\build\Antlr4BuildTasks.targets(131,3): error ANT02: error(7): cannot find or open file: Studio [D:\Frank\Visual Studio Projects\DASH\NGAW2\AntlrTest\AntlrTest.csproj]
14:58:01.187 2:6>C:\Users\frank\.nuget\packages\antlr4buildtasks\9.2.0\build\Antlr4BuildTasks.targets(131,3): error ANT02: error(7): cannot find or open file: Projects\DASH\NGAW2\AntlrTest\Arithmetic.g4 [D:\Frank\Visual Studio Projects\DASH\NGAW2\AntlrTest\AntlrTest.csproj]
Finished executing Antlr jar command. (TaskId:55)
The generated file list contains 0 items. (TaskId:55)
14:58:01.187 2:6>C:\Users\frank\.nuget\packages\antlr4buildtasks\9.2.0\build\Antlr4BuildTasks.targets(131,3): error ANT02: The Antlr4 tool failed. [D:\Frank\Visual Studio Projects\DASH\NGAW2\AntlrTest\AntlrTest.csproj]
Done executing task "RunAntlrTool" -- FAILED. (TaskId:55)
14:58:01.188 2:6>Done building target "Antlr4Compile" in project "AntlrTest.csproj" -- FAILED.: (TargetId:64)
For whatever reason, it's trying to run java.exe, and it has a hard time finding D:\Frank\Visual Studio Projects\DASH\NGAW2\AntlrTest\Arithmetic.g4, which is rather surprising because I have double quotes surrounding everything in the Process.Start() call. I'll fix it tonight or tomorrow. It's not a problem with the Antlr4Templates.
Thank you for point this error out. There were a number of problems fixed. I released 9.3 of Antlr4BuildTasks, and an updated set of templates in 1.4 of Antlr4Templates. --Ken
Hello, Thanks again. Are you planning on pushing 1.4 of Antlr4Templates soon? I didn't see that in the commits yet.
Sorry, I didn't check the changes in. Done. I made a release 1.4 of the templates here: https://www.nuget.org/packages/Antlr4Templates/1.4.0
The names of the console apps have changed. There is now a Java application template as well. So, the standard "combined" Antlr grammar (which has both lexer and parser rules in one file) is named "csharp-combined". Other templates are "csharp-split", "java-combined" and "java-split". I changed the names because I plan to add templates for the other Antlr targets. Note, it only creates an app for the Arithmetic.g4 grammar.
Everything seems to work now, with a new project. There are some minor issues with the templates, you probably know about. Simply things that code analysis will point out. And the default namespace. Thanks again. Antlr is my favorite parser generator, so I am happy to see other people working on C# based tools. The template produced program is very good to get started.