tunnelvisionlabs / antlrworks2

Tunnel Vision Labs' ANTLRWorks 2 IDE
http://tunnelvisionlabs.com/products/antlrworks
Other
48 stars 21 forks source link

Build errors on master #31

Closed bobziuchkovski closed 9 years ago

bobziuchkovski commented 10 years ago

Hi, it looks like there are some ant build problems with the code from master. In particular, the tasks under org-antlr-works-editor fail. The first failure is related to the grammar compilation:

antlr4:
     [echo] Generating ANTLR 4 grammars:
     [echo]   org/antlr/works/editor/grammar/experimental/GrammarLexer.g4
     [echo]   org/antlr/works/editor/grammar/experimental/GrammarParser.g4
     [echo]   org/antlr/works/editor/grammar/highlighter/GrammarHighlighterLexer.g4
     [echo]   org/antlr/works/editor/st4/experimental/TemplateLexer.g4
     [echo]   org/antlr/works/editor/st4/experimental/TemplateParser.g4
     [echo]   org/antlr/works/editor/st4/highlighter/GroupHighlighterLexer.g4
     [java] error(7):  cannot find or open file: *.g4

I started patching the org-antlr-works-editor build.xml to fix the grammar compilation, but the grammar files look like they are using a new 'abstract' option that isn't available in the compiled antlr4 jars that are retrieved by ant. So I stopped there, realizing I'm probably missing some pieces of the build process.

Let me know if I can provide any other useful info on my end.

sharwell commented 10 years ago

The core problem is you can't pass *.g4 to the ANTLR tool on non-Windows platforms. To address this issue, the build.xml script needs to expand the wildcard to actual filenames before starting the ANTLR tool. A similar problem arose when working on the IntelliJ plugin for ANTLR 4: https://github.com/antlr/intellij-plugin-v4/pull/12

In our case, the solution is not quite as simple. Unlike the IntelliJ plugin, the antlr4 target actually uses the <parallel> target to execute multiple code generation steps together. When the antlr4 macro is updated to expand the wildcard using the following block, an error occurs.

<path id="path.antlr4.local">
    <fileset dir="${src.dir}/@{srcpath}" includes="*.g4"/>
</path>

It turns out the path and/or fileset targets cannot be used within a parallel. This will need to be resolved without making the body of the <parallel> element more complicated before the build will work on non-Windows platforms.

sharwell commented 10 years ago

Also note: the antlr4-complete-4.2.jar file downloaded by org-antlr-work-editor/build.xml is not actually used for code generation of these grammars. ANTLRWorks 2 uses a non-standard build of ANTLR 4 for almost everything, but downloads a copy of the reference release so actions like Generate Code and Run in TestRig work properly.

transistor1 commented 9 years ago

For future reference to anyone who wants to build on Linux... I haven't done Java dev in a while, and I don't know anything about Ant, but I wanted to build AntlrWorks2 on Linux (Ubuntu, JDK 1.8.0_45). I was able to hack my way through it; here is a patch against commit bfee49a9b029625ef3bffeaa1b026d2bbc95b61d, with the changes I made to the repo to get it to build using the NetBeans IDE.

git checkout bfee49a9b029625ef3bffeaa1b026d2bbc95b61d
git apply < patch.diff