antlr4cs icon indicating copy to clipboard operation
antlr4cs copied to clipboard

Can't generate result if build configuration contains space in it

Open boydc2014 opened this issue 5 years ago • 4 comments

Everything works great if i use Debug|AnyCpu or Release|AnyCpu, but a certain build configuration let's say "Debug - nuget packages|Anycpu" won't generate any output in obj/Debug - nuget packages folder.

Eventually I found the pattern is, as long as the build configuration name contains space in it, it won't generate output as expected, otherwise it's ok.

'My Config' won't work, and 'MyConfig' works.

Version: antlr4cs 4.6.2 Env: Win10, VS2017 15.7

boydc2014 avatar Mar 18 '19 15:03 boydc2014

Met the same issue too

Danieladu avatar Mar 19 '19 01:03 Danieladu

@sharwell i'm willing to fix it if you can help direct me where to locate the specific code\script

boydc2014 avatar Mar 19 '19 02:03 boydc2014

The issue probably lies in this file:

https://github.com/tunnelvisionlabs/antlr4cs/blob/master/runtime/CSharp/Antlr4BuildTasks/Antlr4ClassGenerationTaskInternal.cs

However, the best way to help might be updating the three DotnetValidation* tests in https://github.com/tunnelvisionlabs/antlr4cs/tree/master/build to have spaces in the paths. This would give integration test coverage to each of the three major ways code can be generated by the tool during builds.

sharwell avatar Mar 19 '19 02:03 sharwell

Actually, having the space in the build configuration name is not really the issue. The issue is that it has to put quotes around the output folder in the java command when there are spaces in the build configuration. I was able to verify this by running the java command in a command window that I was able to retrieve from the Visual Studio build log when setting the logging to Diagnostic. I had a temp folder named obj\Temp and when I used that output folder without quotes, it wrote the Antlr generated files to that folder. But, when I ran the same command, but with quotes around "obj\Temp", as shown here, the output files were not created. I hope this sheds some light on where the problem lies in the source code. It seems that when the command line arguments are processed, it is not checking for quotes around the output folder and then stripping them out.

So, it looks like the issue is with the Java code in the .jar file that is included in the nuget package.

rkanagy avatar Mar 20 '20 20:03 rkanagy