-
Notifications
You must be signed in to change notification settings - Fork 134
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
Excavator: Update to Gradle 7 #1875
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,6 @@ | |
|
||
import com.google.common.base.Preconditions; | ||
import com.google.common.collect.ImmutableMap; | ||
import com.google.common.collect.ImmutableMap.Builder; | ||
import com.google.common.collect.ImmutableSet; | ||
import com.palantir.baseline.tasks.CheckImplicitDependenciesParentTask; | ||
import com.palantir.baseline.tasks.CheckImplicitDependenciesTask; | ||
|
@@ -199,7 +198,7 @@ private static void configureSourceSet( | |
checkUnusedDependencies.configure(task -> task.dependsOn(sourceSetUnusedDependencies)); | ||
TaskProvider<CheckImplicitDependenciesTask> sourceSetCheckImplicitDependencies = project.getTasks() | ||
.register( | ||
GUtil.toLowerCamelCase("checkImplicitDependencies " + sourceSet.getName()), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. GUtil is deprecated but usually source sets should already use camel case so this should be equivalent. |
||
"checkImplicitDependencies" + StringUtils.capitalize(sourceSet.getName()), | ||
CheckImplicitDependenciesTask.class, | ||
task -> { | ||
task.dependsOn(sourceSet.getClassesTaskName()); | ||
|
@@ -216,7 +215,7 @@ private static void configureSourceSet( | |
} | ||
|
||
static String checkUnusedDependenciesNameForSourceSet(SourceSet sourceSet) { | ||
return GUtil.toLowerCamelCase("checkUnusedDependencies " + sourceSet.getName()); | ||
return "checkUnusedDependencies" + StringUtils.capitalize(sourceSet.getName()); | ||
} | ||
|
||
/** | ||
|
@@ -232,14 +231,10 @@ private static String getCompileConfigurationName(SourceSet sourceSet) { | |
} | ||
|
||
private static Map<String, String> excludeRuleAsMap(ExcludeRule rule) { | ||
Builder<String, String> excludeRule = ImmutableMap.builder(); | ||
if (rule.getGroup() != null) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Intellij flags this with |
||
excludeRule.put("group", rule.getGroup()); | ||
} | ||
if (rule.getModule() != null) { | ||
excludeRule.put("module", rule.getModule()); | ||
} | ||
return excludeRule.build(); | ||
return ImmutableMap.<String, String>builder() | ||
.put("group", rule.getGroup()) | ||
.put("module", rule.getModule()) | ||
.build(); | ||
} | ||
|
||
/** Given a {@code com/palantir/product/Foo.class} file, what other classes does it import/reference. */ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,21 +132,23 @@ private JavaVersion getRawSourceCompat() { | |
org.gradle.api.plugins.internal.DefaultJavaPluginConvention convention = | ||
(org.gradle.api.plugins.internal.DefaultJavaPluginConvention) | ||
getProject().getConvention().getPlugin(JavaPluginConvention.class); | ||
return convention.getRawSourceCompatibility(); | ||
|
||
try { | ||
Method getRawSourceCompatibility = | ||
org.gradle.api.plugins.internal.DefaultJavaPluginConvention.class.getMethod( | ||
"getRawSourceCompatibility"); | ||
return (JavaVersion) getRawSourceCompatibility.invoke(convention); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Flipping the reflection call as we now build with Gradle 7 |
||
} catch (Exception e) { | ||
throw new RuntimeException( | ||
"Error calling DefaultJavaPluginConvention#getRawSourceCompatibility for " | ||
+ GradleVersion.current(), | ||
e); | ||
} | ||
} | ||
|
||
// TODO(fwindheuser): Don't use reflection after building with Gradle 7 | ||
org.gradle.api.plugins.internal.DefaultJavaPluginExtension extension = | ||
(org.gradle.api.plugins.internal.DefaultJavaPluginExtension) | ||
getProject().getExtensions().getByType(JavaPluginExtension.class); | ||
try { | ||
Method rawSourceCompat = org.gradle.api.plugins.internal.DefaultJavaPluginExtension.class.getMethod( | ||
"getRawSourceCompatibility"); | ||
return (JavaVersion) rawSourceCompat.invoke(extension); | ||
} catch (Exception e) { | ||
throw new RuntimeException( | ||
"Error calling DefaultJavaPluginExtension#getRawSourceCompatibility for " + GradleVersion.current(), | ||
e); | ||
} | ||
return extension.getRawSourceCompatibility(); | ||
} | ||
} |
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-6.9-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,7 +72,7 @@ case "`uname`" in | |
Darwin* ) | ||
darwin=true | ||
;; | ||
MINGW* ) | ||
MSYS* | MINGW* ) | ||
msys=true | ||
;; | ||
NONSTOP* ) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I imagine this is due to gradle 7 failing on duplicate plugin resource files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. It fails for the plugin resources because they are defined here and here.
Let me add a comment.