Skip to content

Commit

Permalink
Don't impose a gradle 6.7 requirement (#1579)
Browse files Browse the repository at this point in the history
  • Loading branch information
iamdanfox authored Dec 3, 2020
1 parent 393d097 commit 60638c3
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.gradle.api.specs.Spec;
import org.gradle.api.tasks.TaskAction;
import org.gradle.api.tasks.options.Option;
import org.gradle.util.GradleVersion;

/**
* By default, Gradle will infer sourceCompat based on whatever JVM is currently being used to evaluate the
Expand All @@ -56,6 +57,12 @@ public CheckExplicitSourceCompatibilityTask(ObjectFactory objectFactory) {
onlyIf(new Spec<Task>() {
@Override
public boolean isSatisfiedBy(Task element) {
if (GradleVersion.current().compareTo(GradleVersion.version("6.7")) < 0) {
// We're cheekily using this 'getRawSourceCompatibility' method which was only added in Gradle 6.7
// https://github.com/gradle/gradle/commit/8e55abb151e7d933c8348b32b6163fb535254a08.
return false;
}

// sometimes people apply the 'java' plugin to projects that doesn't actually have any java code in it
// (e.g. the root project), so if they're not publishing anything, then we don't bother enforcing the
// sourceCompat thing. Also they might apply the publishing plugin just to get the 'publish' task.
Expand Down

0 comments on commit 60638c3

Please sign in to comment.