Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
8 changes: 8 additions & 0 deletions changelog/@unreleased/pr-791.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
type: improvement
improvement:
Copy link
Contributor

Choose a reason for hiding this comment

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

we should flag this as a break so any folks lagging on gradle < 5.x upgrade

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As I mentioned in the pr description it's possible to not make it a break so I leave it to the maintainers to decide what they prefer

description: Compile with `-Werror` and `-Xlint:deprecation` to catch deprecations
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you describe the change in a way that would be helpful for consumers of the plugin? something like: gradle-baseline should now be compatible with Gradle 6.0. gradle-baseline now requires at least Gradle 5.0 and is no longer compatible with 4.X.

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 am not sure we are compatible with gradle 6 though since it's not released. I could say it's compatible with gradle snapshot that I tested with.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also if I was just making it compatible with gradle 6 I wouldn't be adding the compiler flags

Copy link
Contributor

@iamdanfox iamdanfox Sep 4, 2019

Choose a reason for hiding this comment

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

Yeah I'd just phrase this as a break and declare compatibility with 6.0-20190904072820+0000. Seems like we've got rid of most gradle4 users in the foundry org:

Screenshot 2019-09-04 at 15 39 47

Copy link
Contributor

Choose a reason for hiding this comment

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

Mmmm looks like there are more stragglers outside Foundry, but I think this is probably OK:

image

when they're introduced instead of when they become compilation error. This allows
us to future proof early before regular users are hit with those issues in their
projects
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']
Copy link
Contributor

Choose a reason for hiding this comment

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

could we add 6.0-20190904072820+0000 here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure

}
}
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