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

Upgrade to Gradle 8.2 #1285

Merged
merged 4 commits into from
Jul 4, 2023
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 .idea/kotlinc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 8 additions & 1 deletion build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import com.diffplug.spotless.LineEnding.PLATFORM_NATIVE

plugins {
`kotlin-dsl`
`kotlin-dsl-precompiled-script-plugins`
Expand All @@ -16,9 +18,14 @@ dependencies {
implementation(libs.gradle.spotless.plugin)
}

kotlin.jvmToolchain { languageVersion.set(JavaLanguageVersion.of(11)) }
kotlin.jvmToolchain { languageVersion = JavaLanguageVersion.of(11) }

spotless {
// Workaround for <https://github.com/diffplug/spotless/issues/1644>
// using idea found at
// <https://github.com/diffplug/spotless/issues/1527#issuecomment-1409142798>.
lineEndings = PLATFORM_NATIVE

val ktfmtVersion = libs.versions.ktfmt.get()

kotlin {
Expand Down
30 changes: 19 additions & 11 deletions build-logic/src/main/kotlin/com/ibm/wala/gradle/java.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.ibm.wala.gradle

// Build configuration for subprojects that include Java source code.

import com.diffplug.spotless.LineEnding.PLATFORM_NATIVE
import net.ltgt.gradle.errorprone.errorprone
import org.gradle.plugins.ide.eclipse.model.EclipseModel

Expand All @@ -23,7 +24,7 @@ repositories {
maven { url = uri("https://storage.googleapis.com/r8-releases/raw") }
}

the<BasePluginExtension>().archivesName.set("com.ibm.wala${project.path.replace(':', '.')}")
the<BasePluginExtension>().archivesName = "com.ibm.wala${project.path.replace(':', '.')}"

val sourceSets = the<SourceSetContainer>()

Expand All @@ -45,12 +46,12 @@ dependencies {

tasks.withType<JavaCompile>().configureEach {
// Generate JDK 11 bytecodes; that is the minimum version supported by WALA
options.release.set(11)
options.release = 11
options.errorprone {
// don't run warning-level checks by default as they add too much noise to build output
// NOTE: until https://github.com/google/error-prone/pull/3462 makes it to a release,
// we need to customize the level of at least one specific check to make this flag work
disableAllWarnings.set(true)
disableAllWarnings = true
// warning-level checks upgraded to error, since we've fixed all the warnings
error("UnnecessaryParentheses")
error("UnusedVariable")
Expand Down Expand Up @@ -171,12 +172,19 @@ if (project.gradle.parent != null) {
}
}

spotless.java {
googleJavaFormat(
rootProject
.the<VersionCatalogsExtension>()
.named("libs")
.findVersion("google-java-format")
.get()
.toString())
spotless {
// Workaround for <https://github.com/diffplug/spotless/issues/1644>
// using idea found at
// <https://github.com/diffplug/spotless/issues/1527#issuecomment-1409142798>.
lineEndings = PLATFORM_NATIVE

java {
googleJavaFormat(
rootProject
.the<VersionCatalogsExtension>()
.named("libs")
.findVersion("google-java-format")
.get()
.toString())
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.ibm.wala.gradle

import com.diffplug.spotless.LineEnding.PLATFORM_NATIVE
import org.gradle.plugins.ide.eclipse.model.AbstractClasspathEntry
import org.gradle.plugins.ide.eclipse.model.Classpath
import org.gradle.plugins.ide.eclipse.model.EclipseModel
Expand Down Expand Up @@ -43,6 +44,11 @@ tasks.register<DependencyReportTask>("allDeps") {}
//

spotless {
// Workaround for <https://github.com/diffplug/spotless/issues/1644>
// using idea found at
// <https://github.com/diffplug/spotless/issues/1527#issuecomment-1409142798>.
lineEndings = PLATFORM_NATIVE

findProperty("spotless.ratchet.from")?.let { ratchetFrom(it as String) }

kotlinGradle {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@ val testFixturesJavadoc by

val testFixturesJavadocJar by
tasks.registering(Jar::class) {
archiveClassifier.set("test-fixtures-javadoc")
archiveClassifier = "test-fixtures-javadoc"
from(testFixturesJavadoc.map { it.destinationDir!! })
}

val testFixturesSourcesJar by
tasks.registering(Jar::class) {
archiveClassifier.set("test-fixtures-sources")
archiveClassifier = "test-fixtures-sources"
from(allTestFixturesSource)
}

Expand Down Expand Up @@ -56,15 +56,15 @@ val mavenPublication =
}

pom {
name.set(project.properties["POM_NAME"] as String)
description.set("T. J. Watson Libraries for Analysis")
inceptionYear.set("2006")
url.set("https://github.com/wala/WALA")
name = project.properties["POM_NAME"] as String
description = "T. J. Watson Libraries for Analysis"
inceptionYear = "2006"
url = "https://github.com/wala/WALA"
val pomUrl = url

ciManagement {
system.set("GitHub Actions")
url.set("https://github.com/wala/WALA/actions")
system = "GitHub Actions"
url = "https://github.com/wala/WALA/actions"
}

developers {
Expand All @@ -77,22 +77,22 @@ val mavenPublication =
)
.forEach { entry ->
developer {
id.set(entry.key)
name.set(entry.value)
url.set("https://github.com/{$entry.key}")
id = entry.key
name = entry.value
url = "https://github.com/{$entry.key}"
}
}
}

issueManagement {
system.set("GitHub")
url.set(pomUrl.map { "$it/issues" })
system = "GitHub"
url = pomUrl.map { "$it/issues" }
}

licenses {
license {
name.set("Eclipse Public License v2.0")
url.set(pomUrl.map { "$it/blob/master/LICENSE" })
name = "Eclipse Public License v2.0"
url = pomUrl.map { "$it/blob/master/LICENSE" }
}
}

Expand All @@ -103,20 +103,20 @@ val mavenPublication =
)
.forEach { topic ->
mailingList {
name.set("wala-$topic")
archive.set("https://sourceforge.net/p/wala/mailman/wala-$topic")
subscribe.set("https://sourceforge.net/projects/wala/lists/wala-$topic")
unsubscribe.set(
"https://sourceforge.net/projects/wala/lists/wala-$topic/unsubscribe")
post.set("[email protected]")
name = "wala-$topic"
archive = "https://sourceforge.net/p/wala/mailman/wala-$topic"
subscribe = "https://sourceforge.net/projects/wala/lists/wala-$topic"
unsubscribe =
"https://sourceforge.net/projects/wala/lists/wala-$topic/unsubscribe"
post = "[email protected]"
}
}
}

scm {
url.set(pomUrl)
connection.set("scm:git:git://github.com/wala/WALA.git")
developerConnection.set("scm:git:ssh://[email protected]/wala/WALA.git")
url = pomUrl
connection = "scm:git:git://github.com/wala/WALA.git"
developerConnection = "scm:git:ssh://[email protected]/wala/WALA.git"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion cast/java/ecj/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ dependencies {
testRuntimeOnly(testFixtures(projects.core))
}

application.mainClass.set("com.ibm.wala.cast.java.ecj.util.SourceDirCallGraph")
application.mainClass = "com.ibm.wala.cast.java.ecj.util.SourceDirCallGraph"

val run by
tasks.existing(JavaExec::class) {
Expand Down
18 changes: 11 additions & 7 deletions cast/java/test/data/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ val compileTestJava by
tasks.existing(JavaCompile::class) {
options.run {
// No need to run Error Prone on our analysis test inputs
errorprone.isEnabled.set(false)
errorprone.isEnabled = false
// Some code in the test data is written in a deliberately bad style, so allow warnings
compilerArgs.remove("-Werror")
compilerArgs.add("-nowarn")
Expand All @@ -18,7 +18,7 @@ val compileTestJava by
val testJar by
tasks.registering(Jar::class) {
group = "build"
archiveClassifier.set("test")
archiveClassifier = "test"
from(compileTestJava)
}

Expand All @@ -43,13 +43,17 @@ spotless { java { targetExclude("**/*") } }

val downloadJLex by
tasks.registering(VerifiedDownload::class) {
src.set(URL("https://www.cs.princeton.edu/~appel/modern/java/JLex/current/Main.java"))
checksum.set("fe0cff5db3e2f0f5d67a153cf6c783af")
val downloadedSourceDir by extra(layout.buildDirectory.dir(name))
dest.set(downloadedSourceDir.map { it.file("JLex/Main.java") })
src = URL("https://www.cs.princeton.edu/~appel/modern/java/JLex/current/Main.java")
checksum = "fe0cff5db3e2f0f5d67a153cf6c783af"
val downloadedSourceDir = layout.buildDirectory.dir(name).map(Directory::toString)
inputs.property("downloadedSourceDir", downloadedSourceDir)
dest = layout.buildDirectory.dir(name).map { it.file("JLex/Main.java") }
}

sourceSets.test.get().java.srcDir(downloadJLex.map { it.extra["downloadedSourceDir"]!! })
sourceSets.test
.get()
.java
.srcDir(downloadJLex.map { it.inputs.properties["downloadedSourceDir"]!! })

////////////////////////////////////////////////////////////////////////
//
Expand Down
8 changes: 4 additions & 4 deletions cast/js/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ val downloadAjaxslt by
tasks.registering(VerifiedDownload::class) {
val version = "0.8.1"
val versionedArchive = "ajaxslt-${version}.tar.gz"
src.set(
src =
URL(
"https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/ajaxslt/$versionedArchive"))
dest.set(project.layout.buildDirectory.file(versionedArchive))
checksum.set("c995abe3310a401bb4db7f28a6409756")
"https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/ajaxslt/$versionedArchive")
dest = project.layout.buildDirectory.file(versionedArchive)
checksum = "c995abe3310a401bb4db7f28a6409756"
}

val unpackAjaxslt by
Expand Down
8 changes: 4 additions & 4 deletions cast/js/nodejs/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ dependencies {

val downloadNodeJS by
tasks.registering(VerifiedDownload::class) {
src.set(URL("https://nodejs.org/dist/v0.12.4/node-v0.12.4.tar.gz"))
dest.set(project.layout.buildDirectory.file("nodejs.tar.gz"))
algorithm.set("SHA-1")
checksum.set("147ff79947752399b870fcf3f1fc37102100b545")
src = URL("https://nodejs.org/dist/v0.12.4/node-v0.12.4.tar.gz")
dest = project.layout.buildDirectory.file("nodejs.tar.gz")
algorithm = "SHA-1"
checksum = "147ff79947752399b870fcf3f1fc37102100b545"
}

val unpackNodeJSLib by
Expand Down
Loading