diff --git a/README.md b/README.md index 58c1978f2..a84f6e433 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ See also the [Baseline Java Style Guide and Best Practises](./docs). ## Usage -The baseline set of plugins requires at least Gradle 4.10.0. +The baseline set of plugins requires at least Gradle 5.0. It is recommended to add `apply plugin: 'com.palantir.baseline'` to your root project's build.gradle. Individual plugins will be automatically applied to appropriate subprojects. diff --git a/baseline-refaster-javac-plugin/src/main/java/com/palantir/baseline/refaster/BaselineRefasterCompiler.java b/baseline-refaster-javac-plugin/src/main/java/com/palantir/baseline/refaster/BaselineRefasterCompiler.java index 425405404..b3692ec21 100644 --- a/baseline-refaster-javac-plugin/src/main/java/com/palantir/baseline/refaster/BaselineRefasterCompiler.java +++ b/baseline-refaster-javac-plugin/src/main/java/com/palantir/baseline/refaster/BaselineRefasterCompiler.java @@ -37,6 +37,7 @@ public String getName() { } @Override + @SuppressWarnings("PreferSafeLoggingPreconditions") public void init(JavacTask task, String... args) { List listArgs = Arrays.asList(args); int outIndex = listArgs.indexOf("--out"); diff --git a/build.gradle b/build.gradle index 32f1b429f..4c8c55007 100644 --- a/build.gradle +++ b/build.gradle @@ -45,6 +45,9 @@ allprojects { pluginManager.withPlugin('java') { sourceCompatibility = 1.8 + tasks.withType(JavaCompile) { + options.compilerArgs += ['-Werror', '-Xlint:deprecation'] + } } apply plugin: 'org.inferred.processors' diff --git a/changelog/@unreleased/pr-791.v2.yml b/changelog/@unreleased/pr-791.v2.yml new file mode 100644 index 000000000..e8f5dd4c8 --- /dev/null +++ b/changelog/@unreleased/pr-791.v2.yml @@ -0,0 +1,5 @@ +type: break +break: + description: Add gradle 6.0-20190904072820+0000 compatibiltiy. This raises minimum required version of gradle for plugins from this repo to 5.0. Additionally add '-Werror' and '-Xlint:deprecation' so we can detect compatiblilty issues early + links: + - https://github.com/palantir/gradle-baseline/pull/791 diff --git a/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/versions/CheckBomConflictTask.java b/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/versions/CheckBomConflictTask.java index ae312a007..62e4ca642 100644 --- a/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/versions/CheckBomConflictTask.java +++ b/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/versions/CheckBomConflictTask.java @@ -43,7 +43,7 @@ public class CheckBomConflictTask extends DefaultTask { private final Property shouldFix = getProject().getObjects().property(Boolean.class); - private final RegularFileProperty propsFileProperty = newInputFile(); + private final RegularFileProperty propsFileProperty = getProject().getObjects().fileProperty(); public CheckBomConflictTask() { shouldFix.set(false); diff --git a/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/versions/CheckNoUnusedPinTask.java b/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/versions/CheckNoUnusedPinTask.java index fdab58adf..e0bc32555 100644 --- a/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/versions/CheckNoUnusedPinTask.java +++ b/gradle-baseline-java/src/main/groovy/com/palantir/baseline/plugins/versions/CheckNoUnusedPinTask.java @@ -42,7 +42,7 @@ public class CheckNoUnusedPinTask extends DefaultTask { private final Property shouldFix = getProject().getObjects().property(Boolean.class); - private final RegularFileProperty propsFileProperty = newInputFile(); + private final RegularFileProperty propsFileProperty = getProject().getObjects().fileProperty(); public CheckNoUnusedPinTask() { shouldFix.set(false); diff --git a/gradle-baseline-java/src/test/groovy/com/palantir/baseline/BaselineIntegrationTest.groovy b/gradle-baseline-java/src/test/groovy/com/palantir/baseline/BaselineIntegrationTest.groovy index 4aacd48d4..40f712448 100644 --- a/gradle-baseline-java/src/test/groovy/com/palantir/baseline/BaselineIntegrationTest.groovy +++ b/gradle-baseline-java/src/test/groovy/com/palantir/baseline/BaselineIntegrationTest.groovy @@ -43,6 +43,6 @@ class BaselineIntegrationTest extends AbstractPluginTest { with().withArguments('-s').withGradleVersion(gradleVersion).build() where: - gradleVersion << ['4.10.2', '5.0-milestone-1'] + gradleVersion << ['5.0', '6.0-20190904072820+0000'] } } diff --git a/gradle-junit-reports/src/main/java/com/palantir/gradle/junit/JunitReportsExtension.java b/gradle-junit-reports/src/main/java/com/palantir/gradle/junit/JunitReportsExtension.java index 9471bf024..783e86f05 100644 --- a/gradle-junit-reports/src/main/java/com/palantir/gradle/junit/JunitReportsExtension.java +++ b/gradle-junit-reports/src/main/java/com/palantir/gradle/junit/JunitReportsExtension.java @@ -24,7 +24,7 @@ public class JunitReportsExtension { private final DirectoryProperty reportsDirectory; public JunitReportsExtension(Project project) { - this.reportsDirectory = project.getLayout().directoryProperty(); + this.reportsDirectory = project.getObjects().directoryProperty(); reportsDirectory.set(project.getLayout().getBuildDirectory().dir("junit-reports")); } diff --git a/gradle-junit-reports/src/main/java/com/palantir/gradle/junit/JunitReportsFinalizer.java b/gradle-junit-reports/src/main/java/com/palantir/gradle/junit/JunitReportsFinalizer.java index f28f26678..65a3e0af2 100644 --- a/gradle-junit-reports/src/main/java/com/palantir/gradle/junit/JunitReportsFinalizer.java +++ b/gradle-junit-reports/src/main/java/com/palantir/gradle/junit/JunitReportsFinalizer.java @@ -60,8 +60,8 @@ public static void registerFinalizer( private Task styleTask; private TaskTimer taskTimer; private FailuresSupplier failuresSupplier; - private final RegularFileProperty targetFile = getProject().getLayout().fileProperty(); - private final DirectoryProperty reportDir = getProject().getLayout().directoryProperty(); + private final RegularFileProperty targetFile = getProject().getObjects().fileProperty(); + private final DirectoryProperty reportDir = getProject().getObjects().directoryProperty(); @Inject public JunitReportsFinalizer() { } diff --git a/gradle-junit-reports/src/main/java/com/palantir/gradle/junit/JunitReportsPlugin.java b/gradle-junit-reports/src/main/java/com/palantir/gradle/junit/JunitReportsPlugin.java index a21b91572..e2c401f17 100644 --- a/gradle-junit-reports/src/main/java/com/palantir/gradle/junit/JunitReportsPlugin.java +++ b/gradle-junit-reports/src/main/java/com/palantir/gradle/junit/JunitReportsPlugin.java @@ -34,6 +34,7 @@ public final class JunitReportsPlugin implements Plugin { public static final String EXT_JUNIT_REPORTS = "junitReports"; @Override + @SuppressWarnings("Slf4jLogsafeArgs") public void apply(Project project) { if (project != project.getRootProject()) { project.getLogger().warn( @@ -82,7 +83,7 @@ private static void configureBuildFailureFinalizer(Project rootProject, Provider int attemptNumber = 1; Path targetFile = dir.getAsFile().toPath().resolve("gradle").resolve("build.xml"); while (targetFile.toFile().exists()) { - targetFile = dir.getAsFile().toPath().resolve("gradle").resolve("build" + (++attemptNumber) + ".xml"); + targetFile = dir.getAsFile().toPath().resolve("gradle").resolve("build" + ++attemptNumber + ".xml"); } return dir.file(targetFile.toAbsolutePath().toString()); });