Skip to content

Conversation

@iamdanfox
Copy link
Contributor

@iamdanfox iamdanfox commented Nov 27, 2020

Before this PR

To get a new JVM rolled out fleet wide, we blast out excavators which just dial up the JVM used at CI time. This has been pretty much fine so far as most projects set sourceCompatibility explicitly, but nothing actually validates this right now.

Occasionally, this manifests as a question in #dev-foundry-infra about the product-dependencies.lock file differing locally on CI (because on CI it's inferring java 15) and locally it's inferring whatever JVM the dev is using, often 11.

After this PR

==COMMIT_MSG==
baseline-reproducibility validates that sourceCompatibility is set explicitly using a new checkExplicitSourceCompatibility task.
==COMMIT_MSG==

Possible downsides?

  • it's one more task that will get registered on every project, also can't see any reasonable way of caching this badboy

@iamdanfox iamdanfox requested a review from fawind November 27, 2020 16:27
@changelog-app
Copy link

changelog-app bot commented Nov 27, 2020

Generate changelog in changelog/@unreleased

Type

  • Feature
  • Improvement
  • Fix
  • Break
  • Deprecation
  • Manual task
  • Migration

Description

baseline-reproducibility validates that sourceCompatibility is set explicitly

Check the box to generate changelog(s)

  • Generate changelog entry

getProject(),
getProject().getRootProject().relativePath(getProject().getBuildFile()),
JavaVersion.current(),
getPath()));
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I broke tracing-java and tried it out, error message looks like this:

1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':tracing-jaxrs:checkExplicitSourceCompatibility'.
> project ':tracing-jaxrs' must set sourceCompatibility explicitly in 'tracing-jaxrs/build.gradle', otherwise compilation will not be reproducible but instead depends on the Java version that Gradle is currently running with (11). To auto-fix, run

       ./gradlew :tracing-jaxrs:checkExplicitSourceCompatibility --fix

  This will automatically add a suggested line (you may need to adjust the number, e.g. to '1.8' for maximum compatibility).

Copy link
Contributor

@fawind fawind left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 on having sourceCompat set explicitly.

Looks good to me! Feel free to merge after fixing the nit 🚀

…ks/CheckExplicitSourceCompatibilityTask.java

Co-authored-by: David Schlosnagle <[email protected]>
@bulldozer-bot bulldozer-bot bot merged commit 6aeb847 into develop Nov 30, 2020
@bulldozer-bot bulldozer-bot bot deleted the dfox/require-explicit-sourcecompat branch November 30, 2020 13:12
@svc-autorelease
Copy link
Collaborator

Released 3.58.0

@robert3005
Copy link
Contributor

How does this work with https://docs.gradle.org/current/userguide/toolchains.html ? Would I have to specify source compat even if I specify my jvm?

@iamdanfox
Copy link
Contributor Author

Currently yes - although as soon as they expose a way to extract the toolchain stuff we can update this plugin https://github.com/palantir/gradle-baseline/pull/1574/files#diff-14d5052a9b7ac4fa7663ebf9a728428314e468cc84e6a420f0de25aacaebbc57R81-R82

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants