Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gradle build finishes -- No warning found in compiler output #17

Open
aplatypus opened this issue Feb 21, 2019 · 1 comment
Open

Gradle build finishes -- No warning found in compiler output #17

aplatypus opened this issue Feb 21, 2019 · 1 comment

Comments

@aplatypus
Copy link

aplatypus commented Feb 21, 2019

I've added the following javac-warning-annotation coordinated into my build.gradle file.

// https://mvnrepository.com/artifact/com.pushtorefresh/javac-warning-annotation
compile group: 'com.pushtorefresh', name: 'javac-warning-annotation', version: '1.0.0'

I was getting compiler errors for the @Warning(...) annotation with the provided scope. Errors went away when I put the dependency into compileOnly.

When I build, I am not seeing a warning on the class I used it on. Is the "provided" scope the only way the annotation will work? I didn't tink that would make much difference one way or the other.

I noticed that you had some to-do with annotations. This is how I set-up the configurations following below. The two things to ask about are the:

  • annotationProcessor and
  • lombok

I wondered if either of these are going to mess-up the @Warning?

 dep_javacWarning     = "com.pushtorefresh:javac-warning-annotation:1.0.0"

  : 

configurations {
    annotationProcessor
    provided
}

dependencies
{
    provided (
        dep_javacWarning      // <-- Compile errors on @Warning
    )

    compileOnly (
        dep_lombok,          //  Must come first
        dep_javacWarning     // <-- Compiles clean with the entry here.
    )
    
    :
}

Many thanks ....

@artem-zinnatullin
Copy link
Member

You should be able to make it work by declaring it as both compileOnly and annotationProcessor

Reason being that I ship both the annotation and the annotation processor in same dependency.

If you declare it only as compileOnly then annotation processor won't run, if you declare it only as annotationProcessor then the annotation won't be available, thus you need to declare as both:

compileOnly 'com.pushtorefresh:javac-warning-annotation:1.0.0'
annotationProcessor 'com.pushtorefresh:javac-warning-annotation:1.0.0'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants