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

Break: Add gradle 6.0-20190904072820+0000 compatibility. Compile with -Werror and -Xlint:deprecation #791

Merged
merged 6 commits into from
Sep 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public String getName() {
}

@Override
@SuppressWarnings("PreferSafeLoggingPreconditions")
public void init(JavacTask task, String... args) {
List<String> listArgs = Arrays.asList(args);
int outIndex = listArgs.indexOf("--out");
Expand Down
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ allprojects {

pluginManager.withPlugin('java') {
sourceCompatibility = 1.8
tasks.withType(JavaCompile) {
options.compilerArgs += ['-Werror', '-Xlint:deprecation']
}
}

apply plugin: 'org.inferred.processors'
Expand Down
5 changes: 5 additions & 0 deletions changelog/@unreleased/pr-791.v2.yml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
public class CheckBomConflictTask extends DefaultTask {

private final Property<Boolean> shouldFix = getProject().getObjects().property(Boolean.class);
private final RegularFileProperty propsFileProperty = newInputFile();
private final RegularFileProperty propsFileProperty = getProject().getObjects().fileProperty();

public CheckBomConflictTask() {
shouldFix.set(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
public class CheckNoUnusedPinTask extends DefaultTask {

private final Property<Boolean> shouldFix = getProject().getObjects().property(Boolean.class);
private final RegularFileProperty propsFileProperty = newInputFile();
private final RegularFileProperty propsFileProperty = getProject().getObjects().fileProperty();

public CheckNoUnusedPinTask() {
shouldFix.set(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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']
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public final class JunitReportsPlugin implements Plugin<Project> {
public static final String EXT_JUNIT_REPORTS = "junitReports";

@Override
@SuppressWarnings("Slf4jLogsafeArgs")
public void apply(Project project) {
if (project != project.getRootProject()) {
project.getLogger().warn(
Expand Down Expand Up @@ -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());
});
Expand Down