Skip to content
  • RIFE2 Tips & Tricks

    RIFE2
    1
    1 Votes
    1 Posts
    659 Views
    No one has replied
  • bld Tips & Tricks

    Bld
    2
    1 Votes
    2 Posts
    199 Views
    ethauvinE

    Annotation processors are easy to use with bld. Generally, you'll just need to include processor as a dependency, for example:

    public class ExampleBuild extends Project { public ExampleBuild() { // ... scope(provided) .include(dependency("com.example", "annotator", version(1, 0, 0))); } }

    If the processor is generating source files, you can easily specify where they should be saved, using the -s javac option, for example:

    /** * Saves generated source files in the {@code build/generated} directory. */ @Override public void compile() throws Exception { var generated = new File(buildDirectory(), "generated"); var ignore = generated.mkdir(); compileOperation().compileOptions().addAll(List.of("-s", generated.getAbsolutePath())); super.compile(); }

    To incorporate the generated source code into the source tree, add this directory as an additional source location in your IDE.

    Screenshot from 2023-08-20 21-27-10.png