google / google/compile-testing

Usage of "proc:only" flag possible?

Open
#181 0 comments 1 reaction 0 assignees View on GitHub
P3
Dominant language
Java
Stars
722
Forks
129
Avg merge
11m
Merged PRs (30d)
4

Description

Hi,

I just stumbled on this amazing project, but must be missing something quite basic:

So I've written an AnnotationProcessor that generates a Java output file. The idea is to replace a whole bunch of (so far) handwritten files which are virtually identical except for one import (let's not go into the details, I've just started). So my simple test idea was to use one of those existing files as expected generated output. But what happens is that the tool tries to compile the generated file - which fails due to the missing imports. I don't want to copy half of our sourcecode around, I'd be happy if it ran _only_ the annotation processor.

I tried this:
`final Compilation compilation = javac().withProcessors(processor).withOptions("-proc:only")
.compile(JavaFileObjects.forResource("AnnotatedResource.java"));`

But it's still telling me:
`java.lang.IllegalStateException: compilation failed, so generated files are unavailable. Compilation produced the following diagnostics:
/SOURCE_OUTPUT/` etc.

What am I doing wrong?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.