How to set a package name for generated classes when using cup.gradle.cup-gradle-plugin?

27 views Asked by At

The cup arg: -destdir does not work. With or without this option, the generated source files (parser and symbols) always in the top folder (build/generated-src/cup).

For example as below, the expected destination folder is 'build/generated-src/cup/my/pkg' but actually it's still 'build/generated-src/cup'.

cup {
   args = ["-destdir", "build/generated-src/cup/my/pkg", "-parser", "my_parser", "-symbols", "my_sym"]
}

The questions are:

  1. How can I get the generated class in the right folder that matching the package name?

  2. Is there a workaround to move the generated files by using a gradle task?

1

There are 1 answers

0
Zhen On

This issue is resolved by putting the cup source file into the folder that matching the package name like src/main/cup/my/pkg/parser.cup.

Do not put the cup source file under the top folder such as src/main/cup/parser.cup.