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

Enforces source compatibility with animal-sniffer #346

Merged
merged 1 commit into from
Mar 18, 2015

Conversation

codefromthecrypt
Copy link
Contributor

Before, finding source compatibility issues relied on building with an
old JDK. This uses animal-sniffer to enforce java language level 6 for
libraries and 7 for executables.

closes #344

@codefromthecrypt
Copy link
Contributor Author

cc @rspieldenner

@cloudbees-pull-request-builder

NetflixOSS » denominator » denominator-pull-requests #89 SUCCESS
This pull request looks good

@codefromthecrypt
Copy link
Contributor Author

tested by adding a use of Collections.emptyIterator(), added in Java language level 7, to MockProvider.java. Animal sniffer failed.

:denominator-core:animalSniffer FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':denominator-core:animalSniffer'.
> Signature errors found. Verify them and ignore them with the proper annotation if needed.

@codefromthecrypt
Copy link
Contributor Author

@alkemist @quidryan any pointers on how to de-boilerplate this? I wasn't able to unwind the desired behavior in the base subprojects block.

@rspieldenner
Copy link
Contributor

in build.gradle at top level

// this goes above plugins block
buildscript {
  repositories { jcenter() }
  dependencies {
    classpath 'be.insaneprogramming.gradle:animalsniffer-gradle-plugin:1.4.0'
  }
}

subprojects {
  // ...
  apply plugin: 'be.insaneprogramming.gradle.animalsniffer'

  animalsniffer {
    signature = "org.codehaus.mojo.signature:java16:+@signature"
  }
}

configure the one that needs 1.7 in that one subprojects and you probably want to keep the sourceCompatibility = 1.6 since it will also set the jdk generated to jdk6 compatible bytecode otherwise gradle defaults you to the jdk it is running in (and the netflixoss plugin will default it to java 1.7 if nothing else is set)

The plugins block imports and applies plugins so it is good in some use cases and not others

@codefromthecrypt
Copy link
Contributor Author

codefromthecrypt commented Mar 18, 2015 via email

@codefromthecrypt codefromthecrypt force-pushed the adrian.source16-animalsniffer branch from 5184d60 to 4961c83 Compare March 18, 2015 02:31
Before, finding source compatibility issues relied on building with an
old JDK. This uses animal-sniffer to enforce java language level 6 for
libraries and 7 for executables.

closes #344
@codefromthecrypt codefromthecrypt force-pushed the adrian.source16-animalsniffer branch from 4961c83 to d2e04ca Compare March 18, 2015 02:32
@cloudbees-pull-request-builder

NetflixOSS » denominator » denominator-pull-requests #90 SUCCESS
This pull request looks good

@cloudbees-pull-request-builder

NetflixOSS » denominator » denominator-pull-requests #91 SUCCESS
This pull request looks good

codefromthecrypt pushed a commit that referenced this pull request Mar 18, 2015
Enforces source compatibility with animal-sniffer
@codefromthecrypt codefromthecrypt merged commit 0d335ac into master Mar 18, 2015
@codefromthecrypt codefromthecrypt deleted the adrian.source16-animalsniffer branch March 18, 2015 03:36
@ldaley
Copy link

ldaley commented Mar 24, 2015

Beaten to the punch by @rspieldenner .

@codefromthecrypt
Copy link
Contributor Author

codefromthecrypt commented Mar 24, 2015 via email

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

Successfully merging this pull request may close these issues.

Ensure java 6 source compatibility
4 participants