marcohu / rules_antlr

ANTLR rules for Bazel
Apache License 2.0
26 stars 36 forks source link

Use relative paths for the grammar input files #15

Open rrbutani opened 3 years ago

rrbutani commented 3 years ago

The file paths that are passed to ANTLR end up in the generated output so using absolute paths breaks caching.


This PR makes it so that the relative paths to the grammar files that we get from Bazel are passed straight through to ANTLR.

To keep ANTLR from trying to recreate the directory structure containing the grammar files within the output directory I had to add -Xexact-output-dir for ANTLR4 and -fo for ANTLR3. ANTLR2 doesn't seem to have an equivalent flag and doesn't seem to have the same behavior for relative grammar file input paths.


Fixes #12.