Skip to content

Commit

Permalink
Excavator: Upgrades gradle wrapper to the latest version (#804)
Browse files Browse the repository at this point in the history
  • Loading branch information
svc-excavator-bot authored and bulldozer-bot[bot] committed Sep 27, 2019
1 parent 4e6858f commit 831e40d
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 26 deletions.
9 changes: 5 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,11 +76,12 @@ jobs:

unit-test:
docker: [{ image: 'circleci/openjdk:8u222-stretch-node' }]
resource_class: large
environment:
CIRCLE_TEST_REPORTS: /home/circleci/junit
CIRCLE_ARTIFACTS: /home/circleci/artifacts
GRADLE_OPTS: -Dorg.gradle.jvmargs='-Xms3072m -Xmx3072m'
_JAVA_OPTIONS: -XX:ActiveProcessorCount=2 -XX:ErrorFile=/home/circleci/artifacts/hs_err_pid%p.log -XX:HeapDumpPath=/home/circleci/artifacts
GRADLE_OPTS: -Dorg.gradle.jvmargs='-XX:MaxMetaspaceSize=256m' -Dorg.gradle.workers.max=4
_JAVA_OPTIONS: -XX:ActiveProcessorCount=4 -Xmx1382m -XX:MaxMetaspaceSize=256m -XX:ActiveProcessorCount=2 -XX:ErrorFile=/home/circleci/artifacts/hs_err_pid%p.log -XX:HeapDumpPath=/home/circleci/artifacts
steps:
- attach_workspace: { at: /home/circleci }
- restore_cache: { key: 'gradle-wrapper-v2-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' }
Expand All @@ -101,8 +102,8 @@ jobs:
environment:
CIRCLE_TEST_REPORTS: /home/circleci/junit
CIRCLE_ARTIFACTS: /home/circleci/artifacts
GRADLE_OPTS: -Dorg.gradle.jvmargs='-Xms6144m -Xmx6144m'
_JAVA_OPTIONS: -XX:ActiveProcessorCount=4 -XX:ErrorFile=/home/circleci/artifacts/hs_err_pid%p.log -XX:HeapDumpPath=/home/circleci/artifacts
GRADLE_OPTS: -Dorg.gradle.jvmargs='-XX:MaxMetaspaceSize=256m' -Dorg.gradle.workers.max=4
_JAVA_OPTIONS: -XX:ActiveProcessorCount=4 -Xmx1382m -XX:MaxMetaspaceSize=256m -XX:ActiveProcessorCount=2 -XX:ErrorFile=/home/circleci/artifacts/hs_err_pid%p.log -XX:HeapDumpPath=/home/circleci/artifacts
steps:
- checkout
- restore_cache: { key: 'gradle-wrapper-v2-{{ checksum "gradle/wrapper/gradle-wrapper.properties" }}' }
Expand Down
6 changes: 6 additions & 0 deletions changelog/@unreleased/refaster-gradle-6.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type: break
break:
description: |
Refaster now works on repos using Gradle 6.0. This raises the minimum supported version of Gradle from 5.0 -> 5.4
links:
- https://github.com/palantir/gradle-baseline/pull/804
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableList;
import com.palantir.baseline.extensions.BaselineErrorProneExtension;
import com.palantir.baseline.tasks.RefasterCompileTask;
import com.palantir.baseline.tasks.CompileRefasterTask;
import java.io.File;
import java.util.AbstractList;
import java.util.Collections;
Expand Down Expand Up @@ -91,8 +91,8 @@ private static void applyToJavaProject(Project project) {
.file("refaster/rules.refaster")
.map(RegularFile::getAsFile);

RefasterCompileTask compileRefaster =
project.getTasks().create("compileRefaster", RefasterCompileTask.class, task -> {
CompileRefasterTask compileRefaster =
project.getTasks().create("compileRefaster", CompileRefasterTask.class, task -> {
task.setSource(refasterConfiguration);
task.getRefasterSources().set(refasterConfiguration);
task.setClasspath(refasterCompilerConfiguration);
Expand Down Expand Up @@ -170,7 +170,7 @@ private static void applyToJavaProject(Project project) {
private static void configureErrorProneOptions(
Project project,
Provider<File> refasterRulesFile,
RefasterCompileTask compileRefaster,
CompileRefasterTask compileRefaster,
BaselineErrorProneExtension errorProneExtension,
JavaCompile javaCompile,
ErrorProneOptions errorProneOptions) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.gradle.api.DefaultTask;
import org.gradle.api.provider.Property;
import org.gradle.api.provider.Provider;
import org.gradle.api.tasks.Input;
import org.gradle.api.tasks.options.Option;

public class CheckVersionsPropsTask extends DefaultTask {
Expand All @@ -35,6 +36,7 @@ public final void setShouldFix(boolean shouldFix) {
this.shouldFix.set(shouldFix);
}

@Input
final Provider<Boolean> getShouldFix() {
return shouldFix;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import org.gradle.api.artifacts.Configuration;
import org.gradle.api.artifacts.ModuleVersionIdentifier;
import org.gradle.api.tasks.CacheableTask;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.Classpath;
import org.gradle.api.tasks.OutputFile;
import org.gradle.api.tasks.TaskAction;

Expand All @@ -43,7 +43,7 @@ public CheckClassUniquenessTask() {
setDescription("Checks that the given configuration contains no identically named classes.");
}

@InputFiles
@Classpath
public final Configuration getConfiguration() {
return configuration;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.OutputFile;
import org.gradle.api.tasks.compile.JavaCompile;
import org.gradle.work.InputChanges;

public class RefasterCompileTask extends JavaCompile {
public class CompileRefasterTask extends JavaCompile {

private final Property<Configuration> refasterSources = getProject().getObjects().property(Configuration.class);
private final Property<File> refasterRulesFile = getProject().getObjects().property(File.class);

public RefasterCompileTask() {
public CompileRefasterTask() {
// Don't care about .class files
setDestinationDir(getTemporaryDir());

Expand All @@ -42,7 +43,7 @@ public RefasterCompileTask() {
}

@Override
protected final void compile() {
protected final void compile(InputChanges inputs) {
// Clear out the default error-prone providers
getOptions().getCompilerArgumentProviders().clear();
getOptions().setCompilerArgs(ImmutableList.of(
Expand All @@ -69,12 +70,13 @@ protected final void compile() {

if (!javaSources.isEmpty()) {
setSource(javaSources);
super.compile();
super.compile(inputs);
} else {
setDidWork(false);
}
}


@InputFiles
public final Property<Configuration> getRefasterSources() {
return refasterSources;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,13 @@ class BaselineErrorProneIntegrationTest extends AbstractPluginTest {
plugins {
id 'java'
id 'com.palantir.baseline-error-prone'
id 'org.inferred.processors' version '1.3.0'
id 'org.inferred.processors' version '3.1.0'
}
repositories {
mavenLocal()
jcenter()
// TODO(forozco): figure out why pTML no longer works
maven { url "http://palantir.bintray.com/releases" }
}
'''.stripIndent()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package com.palantir.baseline

import org.gradle.testkit.runner.BuildResult
import org.gradle.testkit.runner.TaskOutcome

/**
* This test depends on ./gradlew :baseline-error-prone:publishToMavenLocal
*/
Expand All @@ -29,11 +28,13 @@ class BaselineErrorProneRefasterIntegrationTest extends AbstractPluginTest {
plugins {
id 'java'
id 'com.palantir.baseline-error-prone'
id 'org.inferred.processors' version '1.3.0'
id 'org.inferred.processors' version '3.1.0'
}
repositories {
mavenLocal()
jcenter()
// TODO(forozco): figure out why pTML no longer works
maven { url "http://palantir.bintray.com/releases" }
}
tasks.withType(JavaCompile) {
options.compilerArgs += ['-Werror', '-Xlint:deprecation']
Expand All @@ -54,6 +55,7 @@ class BaselineErrorProneRefasterIntegrationTest extends AbstractPluginTest {
then:
BuildResult result = with('compileJava', '-i', '-PrefasterApply').build()
result.task(":compileJava").outcome == TaskOutcome.SUCCESS
file('build/refaster/rules.refaster').exists()
file('src/main/java/test/Test.java').text == '''
package test;
import java.util.ArrayList;
Expand Down Expand Up @@ -117,6 +119,11 @@ class BaselineErrorProneRefasterIntegrationTest extends AbstractPluginTest {
def 'compileJava with refaster fixes Utf8Length with deprecated method'() {
when:
buildFile << standardBuildFile
buildFile << '''
dependencies {
compile 'com.google.guava:guava:27.1-jre'
}
'''
file('src/main/java/test/Test.java') << '''
package test;
import com.google.common.base.CharMatcher;
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 << ['5.0', '6.0-20190904072820+0000']
gradleVersion << ['5.4', '6.0-20190904072820+0000']
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class BaselineTestingIntegrationTest extends AbstractPluginTest {
plugins {
id 'java'
id 'com.palantir.baseline-testing'
id 'com.palantir.consistent-versions' version '1.9.2'
}
repositories {
Expand Down Expand Up @@ -73,7 +72,7 @@ class BaselineTestingIntegrationTest extends AbstractPluginTest {
file('src/test/java/test/TestClass5.java') << junit5Test

then:
BuildResult result = with('test', '--write-locks').build()
BuildResult result = with('test').build()
result.task(':test').outcome == TaskOutcome.SUCCESS
new File(projectDir, "build/reports/tests/test/classes/test.TestClass4.html").exists()
new File(projectDir, "build/reports/tests/test/classes/test.TestClass5.html").exists()
Expand All @@ -100,7 +99,7 @@ class BaselineTestingIntegrationTest extends AbstractPluginTest {
file('src/integrationTest/java/test/TestClass5.java') << junit5Test

then:
BuildResult result = with('integrationTest', '--write-locks').build()
BuildResult result = with('integrationTest').build()
result.task(':integrationTest').outcome == TaskOutcome.SUCCESS
new File(projectDir, "build/reports/tests/integrationTest/classes/test.TestClass5.html").exists()
}
Expand All @@ -126,7 +125,7 @@ class BaselineTestingIntegrationTest extends AbstractPluginTest {
file('src/integrationTest/java/test/TestClass5.java') << junit5Test

then:
BuildResult result = with('checkJUnitDependencies', '--write-locks').buildAndFail()
BuildResult result = with('checkJUnitDependencies').buildAndFail()
result.output.contains 'Some tests still use JUnit4, but Gradle has been set to use JUnit Platform'
}

Expand All @@ -142,7 +141,7 @@ class BaselineTestingIntegrationTest extends AbstractPluginTest {
file('src/test/java/test/TestClass5.java') << junit5Test

then:
BuildResult result = with('checkJUnitDependencies', '--write-locks').buildAndFail()
BuildResult result = with('checkJUnitDependencies').buildAndFail()
result.output.contains 'Some tests mention JUnit5, but the \'test\' task does not have useJUnitPlatform() enabled'
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
plugins {
id 'java'
id 'checkstyle'
id 'findbugs'
}

repositories {
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions-snapshots/gradle-6.0-20190925220032+0000-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
1 change: 0 additions & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
rootProject.name = "gradle-baseline"
enableFeaturePreview("STABLE_PUBLISHING")

include "baseline-error-prone"
include "baseline-refaster-javac-plugin"
Expand Down

0 comments on commit 831e40d

Please sign in to comment.