Skip to content

Commit

Permalink
Upgrade to Gradle 7.0.2 (#1590)
Browse files Browse the repository at this point in the history
Motivation:
Upgrade to latest Gradle release
Modifications:
Update Gradle wrapper to 7.0.2 and fix Gradle deprecations
Result:
Build with latest Gradle
  • Loading branch information
bondolo authored Jun 1, 2021
1 parent d89a9a8 commit 93deaf6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
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-6.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import org.gradle.api.Task
import org.gradle.api.XmlProvider
import org.gradle.api.artifacts.repositories.IvyArtifactRepository
import org.gradle.api.artifacts.repositories.MavenArtifactRepository
import org.gradle.api.file.DirectoryProperty
import org.gradle.api.internal.artifacts.repositories.AbstractArtifactRepository
import org.gradle.api.java.archives.Manifest
import org.gradle.api.plugins.JavaBasePlugin
Expand Down Expand Up @@ -170,11 +171,21 @@ final class ProjectUtils {
}
}

static File copyResource(String resourceSourcePath, DirectoryProperty destinationFolder) {
def content = ProjectUtils.class.getResource(resourceSourcePath).text
writeToFile(content, destinationFolder, new File(resourceSourcePath).name)
}

static File copyResource(String resourceSourcePath, File destinationFolder) {
def content = ProjectUtils.class.getResource(resourceSourcePath).text
writeToFile(content, destinationFolder, new File(resourceSourcePath).name)
}

static File writeToFile(String content, DirectoryProperty folder, String fileName) {
def destAsFile = folder.get().asFile;
writeToFile(content, destAsFile, fileName)
}

static File writeToFile(String content, File folder, String fileName) {
def file = new File(folder, fileName)
if (!file.parentFile.exists() && !file.parentFile.mkdirs()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,16 @@ class ServiceTalkCorePlugin implements Plugin<Project> {
}

doLast {
copyResource("checkstyle/checkstyle.xml", checkstyle.configDir)
copyResource("checkstyle/global-suppressions.xml", checkstyle.configDir)
copyResource("checkstyle/copyright-slashstar-style.header", checkstyle.configDir)
copyResource("checkstyle/copyright-xml-style.header", checkstyle.configDir)
copyResource("checkstyle/copyright-script-style.header", checkstyle.configDir)
copyResource("checkstyle/copyright-sh-script-style.header", checkstyle.configDir)
copyResource("checkstyle/checkstyle.xml", checkstyle.configDirectory)
copyResource("checkstyle/global-suppressions.xml", checkstyle.configDirectory)
copyResource("checkstyle/copyright-slashstar-style.header", checkstyle.configDirectory)
copyResource("checkstyle/copyright-xml-style.header", checkstyle.configDirectory)
copyResource("checkstyle/copyright-script-style.header", checkstyle.configDirectory)
copyResource("checkstyle/copyright-sh-script-style.header", checkstyle.configDirectory)

File checkstyleLocalSuppressionsFile = locateBuildLevelConfigFile(project, "/gradle/checkstyle/suppressions.xml")
if (checkstyleLocalSuppressionsFile.exists()) {
writeToFile(checkstyleLocalSuppressionsFile.text, checkstyle.configDir, "local-suppressions.xml")
writeToFile(checkstyleLocalSuppressionsFile.text, checkstyle.configDirectory, "local-suppressions.xml")
}
}
}
Expand Down

0 comments on commit 93deaf6

Please sign in to comment.