diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml index 0fc3113136..69e86158ba 100644 --- a/.idea/kotlinc.xml +++ b/.idea/kotlinc.xml @@ -1,6 +1,6 @@ - \ No newline at end of file diff --git a/build-logic/build.gradle.kts b/build-logic/build.gradle.kts index 4548e350e7..809cb665f9 100644 --- a/build-logic/build.gradle.kts +++ b/build-logic/build.gradle.kts @@ -1,3 +1,5 @@ +import com.diffplug.spotless.LineEnding.PLATFORM_NATIVE + plugins { `kotlin-dsl` `kotlin-dsl-precompiled-script-plugins` @@ -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 + // using idea found at + // . + lineEndings = PLATFORM_NATIVE + val ktfmtVersion = libs.versions.ktfmt.get() kotlin { diff --git a/build-logic/src/main/kotlin/com/ibm/wala/gradle/java.gradle.kts b/build-logic/src/main/kotlin/com/ibm/wala/gradle/java.gradle.kts index 51ded7d7b1..379353c934 100644 --- a/build-logic/src/main/kotlin/com/ibm/wala/gradle/java.gradle.kts +++ b/build-logic/src/main/kotlin/com/ibm/wala/gradle/java.gradle.kts @@ -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 @@ -23,7 +24,7 @@ repositories { maven { url = uri("https://storage.googleapis.com/r8-releases/raw") } } -the().archivesName.set("com.ibm.wala${project.path.replace(':', '.')}") +the().archivesName = "com.ibm.wala${project.path.replace(':', '.')}" val sourceSets = the() @@ -45,12 +46,12 @@ dependencies { tasks.withType().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") @@ -171,12 +172,19 @@ if (project.gradle.parent != null) { } } -spotless.java { - googleJavaFormat( - rootProject - .the() - .named("libs") - .findVersion("google-java-format") - .get() - .toString()) +spotless { + // Workaround for + // using idea found at + // . + lineEndings = PLATFORM_NATIVE + + java { + googleJavaFormat( + rootProject + .the() + .named("libs") + .findVersion("google-java-format") + .get() + .toString()) + } } diff --git a/build-logic/src/main/kotlin/com/ibm/wala/gradle/project.gradle.kts b/build-logic/src/main/kotlin/com/ibm/wala/gradle/project.gradle.kts index 5dd2ec38c8..6c3b4a9bd0 100644 --- a/build-logic/src/main/kotlin/com/ibm/wala/gradle/project.gradle.kts +++ b/build-logic/src/main/kotlin/com/ibm/wala/gradle/project.gradle.kts @@ -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 @@ -43,6 +44,11 @@ tasks.register("allDeps") {} // spotless { + // Workaround for + // using idea found at + // . + lineEndings = PLATFORM_NATIVE + findProperty("spotless.ratchet.from")?.let { ratchetFrom(it as String) } kotlinGradle { diff --git a/build-logic/src/main/kotlin/com/ibm/wala/gradle/publishing.gradle.kts b/build-logic/src/main/kotlin/com/ibm/wala/gradle/publishing.gradle.kts index a8c3763bd0..a20cbc8ccf 100644 --- a/build-logic/src/main/kotlin/com/ibm/wala/gradle/publishing.gradle.kts +++ b/build-logic/src/main/kotlin/com/ibm/wala/gradle/publishing.gradle.kts @@ -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) } @@ -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 { @@ -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" } } } @@ -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("wala-$topic@lists.sourceforge.net") + 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 = "wala-$topic@lists.sourceforge.net" } } } scm { - url.set(pomUrl) - connection.set("scm:git:git://github.com/wala/WALA.git") - developerConnection.set("scm:git:ssh://git@github.com/wala/WALA.git") + url = pomUrl + connection = "scm:git:git://github.com/wala/WALA.git" + developerConnection = "scm:git:ssh://git@github.com/wala/WALA.git" } } } diff --git a/cast/java/ecj/build.gradle.kts b/cast/java/ecj/build.gradle.kts index f375402a9d..f0c333d48d 100644 --- a/cast/java/ecj/build.gradle.kts +++ b/cast/java/ecj/build.gradle.kts @@ -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) { diff --git a/cast/java/test/data/build.gradle.kts b/cast/java/test/data/build.gradle.kts index 0d7d25a80d..b773d3ea47 100644 --- a/cast/java/test/data/build.gradle.kts +++ b/cast/java/test/data/build.gradle.kts @@ -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") @@ -18,7 +18,7 @@ val compileTestJava by val testJar by tasks.registering(Jar::class) { group = "build" - archiveClassifier.set("test") + archiveClassifier = "test" from(compileTestJava) } @@ -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"]!! }) //////////////////////////////////////////////////////////////////////// // diff --git a/cast/js/build.gradle.kts b/cast/js/build.gradle.kts index ae342a41b5..61ce46db8b 100644 --- a/cast/js/build.gradle.kts +++ b/cast/js/build.gradle.kts @@ -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 diff --git a/cast/js/nodejs/build.gradle.kts b/cast/js/nodejs/build.gradle.kts index 10f7ded60e..d03fed4068 100644 --- a/cast/js/nodejs/build.gradle.kts +++ b/cast/js/nodejs/build.gradle.kts @@ -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 diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 2c0984ddc9..54392228f0 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -49,7 +49,7 @@ tasks.named("check") { dependsOn(ecjCompileJavaTestSubjects) } compileTestSubjectsJava.configure { // No need to run Error Prone on our analysis test inputs - options.errorprone.isEnabled.set(false) + options.errorprone.isEnabled = false } dependencies { @@ -80,9 +80,9 @@ interface ExtractServices { val downloadKawa by tasks.registering(VerifiedDownload::class) { val archive = "kawa-3.0.zip" - src.set(URL("https://ftp.gnu.org/pub/gnu/kawa/$archive")) - dest.set(project.layout.buildDirectory.file(archive)) - checksum.set("2713e6dfb939274ba3b1d36daea68436") + src = URL("https://ftp.gnu.org/pub/gnu/kawa/$archive") + dest = project.layout.buildDirectory.file(archive) + checksum = "2713e6dfb939274ba3b1d36daea68436" } val extractKawa by @@ -113,9 +113,9 @@ val kawaChessCommitHash = "f1d2dcc707a1ef19dc159e2eaee5aecc8a41d7a8" val downloadKawaChess by tasks.registering(VerifiedDownload::class) { - src.set(URL("https://github.com/ttu-fpclub/kawa-chess/archive/${kawaChessCommitHash}.zip")) - dest.set(project.layout.buildDirectory.file("kawa-chess.zip")) - checksum.set("cf29613d2be5f476a475ee28b4df9d9e") + src = URL("https://github.com/ttu-fpclub/kawa-chess/archive/${kawaChessCommitHash}.zip") + dest = project.layout.buildDirectory.file("kawa-chess.zip") + checksum = "cf29613d2be5f476a475ee28b4df9d9e" } val unpackKawaChess by @@ -142,9 +142,9 @@ val compileKawaSchemeChessMain by val buildChessJar by tasks.registering(Jar::class) { from(compileKawaSchemeChessMain) - destinationDirectory.set(project.layout.buildDirectory.dir(name)) - archiveFileName.set("kawachess.jar") - archiveVersion.set(null as String?) + destinationDirectory = project.layout.buildDirectory.dir(name) + archiveFileName = "kawachess.jar" + archiveVersion = null as String? } //////////////////////////////////////////////////////////////////////// @@ -154,15 +154,15 @@ val buildChessJar by val compileKawaSchemeTest by tasks.registering(CompileKawaScheme::class) { - schemeFile.set(layout.projectDirectory.file("kawasrc/test.scm")) + schemeFile = layout.projectDirectory.file("kawasrc/test.scm") } val buildKawaTestJar by tasks.registering(Jar::class) { from(compileKawaSchemeTest) - destinationDirectory.set(project.layout.buildDirectory.dir(name)) - archiveFileName.set("kawatest.jar") - archiveVersion.set(null as String?) + destinationDirectory = project.layout.buildDirectory.dir(name) + archiveFileName = "kawatest.jar" + archiveVersion = null as String? } //////////////////////////////////////////////////////////////////////// @@ -172,17 +172,18 @@ val buildKawaTestJar by val downloadBcel by tasks.registering(VerifiedDownload::class) { - val basename by extra("bcel-5.2") + val basename = "bcel-5.2" + inputs.property("basename", basename) val archive = "${basename}.tar.gz" - src.set(URL("https://archive.apache.org/dist/jakarta/bcel/binaries/$archive")) - dest.set(project.layout.buildDirectory.file(archive)) - checksum.set("19bffd7f217b0eae415f1ef87af2f0bc") - useETag.set(false) + src = URL("https://archive.apache.org/dist/jakarta/bcel/binaries/$archive") + dest = project.layout.buildDirectory.file(archive) + checksum = "19bffd7f217b0eae415f1ef87af2f0bc" + useETag = false } val extractBcel by tasks.registering { - val basename = downloadBcel.map { it.extra["basename"] as String } + val basename = downloadBcel.map { it.inputs.properties["basename"] as String } val jarFile = basename.flatMap { layout.buildDirectory.file("$name/${it}.jar") } inputs.files(downloadBcel.map { it.outputs.files }) outputs.file(jarFile) @@ -210,9 +211,9 @@ val extractBcel by val downloadJavaCup by tasks.registering(VerifiedDownload::class) { val archive = "java-cup-11a.jar" - src.set(URL("http://www2.cs.tum.edu/projects/cup/$archive")) - dest.set(layout.buildDirectory.file("$name/$archive")) - checksum.set("2bda8c40abd0cbc295d3038643d6e4ec") + src = URL("http://www2.cs.tum.edu/projects/cup/$archive") + dest = layout.buildDirectory.file("$name/$archive") + checksum = "2bda8c40abd0cbc295d3038643d6e4ec" } //////////////////////////////////////////////////////////////////////// @@ -232,8 +233,8 @@ val collectJLex by inputs.files(collectJLexFrom) from(zipTree(collectJLexFrom.singleFile)) include("JLex/") - archiveFileName.set("JLex.jar") - destinationDirectory.set(layout.buildDirectory.dir(name)) + archiveFileName = "JLex.jar" + destinationDirectory = layout.buildDirectory.dir(name) } //////////////////////////////////////////////////////////////////////// @@ -246,9 +247,9 @@ val downloadOcamlJava by val version = "2.0-alpha1" val basename by extra("ocamljava-$version") val archive = "$basename.tar.gz" - src.set(URL("http://www.ocamljava.org/downloads/download.php?version=$version-bin")) - dest.set(project.layout.buildDirectory.file(archive)) - checksum.set("45feec6e3889f5073a39c2c4c84878d1") + src = URL("http://www.ocamljava.org/downloads/download.php?version=$version-bin") + dest = project.layout.buildDirectory.file(archive) + checksum = "45feec6e3889f5073a39c2c4c84878d1" } val unpackOcamlJava by @@ -284,7 +285,7 @@ val generateHelloHashJar by inputs.file(ocamlJavaJar) classpath(ocamlJavaJar) - mainClass.set("ocaml.compilers.ocamljavaMain") + mainClass = "ocaml.compilers.ocamljavaMain" args("-o", jarTarget) argumentProviders.add { listOf(ocamlSource.get()) } } @@ -296,11 +297,11 @@ val generateHelloHashJar by val collectTestData by tasks.registering(Jar::class) { - archiveFileName.set("com.ibm.wala.core.testdata_1.0.0.jar") + archiveFileName = "com.ibm.wala.core.testdata_1.0.0.jar" from(compileTestSubjectsJava) from("classes") includeEmptyDirs = false - destinationDirectory.set(layout.buildDirectory.dir(name)) + destinationDirectory = layout.buildDirectory.dir(name) } val collectTestDataJar: Configuration by configurations.creating { isCanBeResolved = false } @@ -314,11 +315,11 @@ artifacts.add(collectTestDataJar.name, collectTestData.map { it.destinationDirec val collectTestDataA by tasks.registering(Jar::class) { - archiveFileName.set("com.ibm.wala.core.testdata_1.0.0a.jar") + archiveFileName = "com.ibm.wala.core.testdata_1.0.0a.jar" from(compileTestSubjectsJava) from("classes") includeEmptyDirs = false - destinationDirectory.set(layout.buildDirectory.dir(name)) + destinationDirectory = layout.buildDirectory.dir(name) exclude( "**/CodeDeleted.class", "**/SortingExample.class", @@ -371,7 +372,7 @@ artifacts.add(testResources.name, sourceSets.test.map { it.resources.srcDirs.sin val testJar by tasks.registering(Jar::class) { group = "build" - archiveClassifier.set("test") + archiveClassifier = "test" from(tasks.named("compileTestJava")) } diff --git a/dalvik/build.gradle.kts b/dalvik/build.gradle.kts index e15b59400a..ed810068bc 100644 --- a/dalvik/build.gradle.kts +++ b/dalvik/build.gradle.kts @@ -107,11 +107,11 @@ dependencies { val downloadDroidBench by tasks.registering(VerifiedDownload::class) { - src.set( + src = URL( - "https://codeload.github.com/secure-software-engineering/DroidBench/zip/DroidBench_2.0")) - dest.set(project.layout.buildDirectory.file("DroidBench_2.0.zip")) - checksum.set("16726a48329835140e14f18470a1b4a3") + "https://codeload.github.com/secure-software-engineering/DroidBench/zip/DroidBench_2.0") + dest = project.layout.buildDirectory.file("DroidBench_2.0.zip") + checksum = "16726a48329835140e14f18470a1b4a3" } val unpackDroidBench by @@ -144,10 +144,10 @@ val downloadAndroidSdk by }) .run { val archive = "commandlinetools-$sdkOs-7583922_latest.zip" - src.set(URL("https://dl.google.com/android/repository/$archive")) - dest.set(project.layout.buildDirectory.file(archive)) - this@registering.checksum.set(checksum) - algorithm.set("SHA-256") + src = URL("https://dl.google.com/android/repository/$archive") + dest = project.layout.buildDirectory.file(archive) + this@registering.checksum = checksum + algorithm = "SHA-256" } } @@ -175,9 +175,9 @@ val extractSampleCup by val downloadSampleLex by tasks.registering(VerifiedDownload::class) { - src.set(URL("https://www.cs.princeton.edu/~appel/modern/java/JLex/current/sample.lex")) - dest.set(layout.buildDirectory.file("$name/sample.lex")) - checksum.set("ae887758b2657981d023a72a165da830") + src = URL("https://www.cs.princeton.edu/~appel/modern/java/JLex/current/sample.lex") + dest = layout.buildDirectory.file("$name/sample.lex") + checksum = "ae887758b2657981d023a72a165da830" } tasks.named("processTestResources") { diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index ccebba7710..c1962a79e2 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6ee7ce821e..c9420a8919 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=2cbafcd2c47a101cb2165f636b4677fac0b954949c9429c1c988da399defe6a9 -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-all.zip +distributionSha256Sum=5022b0b25fe182b0e50867e77f484501dba44feeea88f5c1f13b6b4660463640 +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-all.zip networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 79a61d421c..aeb74cbb43 100755 --- a/gradlew +++ b/gradlew @@ -85,9 +85,6 @@ done APP_BASE_NAME=${0##*/} APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' - # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD=maximum @@ -197,6 +194,10 @@ if "$cygwin" || "$msys" ; then done fi + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + # Collect all arguments for the java command; # * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of # shell script including quotes and variable substitutions, so put them in diff --git a/ide/tests/build.gradle.kts b/ide/tests/build.gradle.kts index 50190e31f7..d8965b60e5 100644 --- a/ide/tests/build.gradle.kts +++ b/ide/tests/build.gradle.kts @@ -85,7 +85,7 @@ tasks.register("runIFDSExplorerExample") { group = "Execution" description = "Run the IFDSExplorerExample driver" classpath = ifdsExplorerExampleClasspath - mainClass.set("com.ibm.wala.examples.drivers.IFDSExplorerExample") + mainClass = "com.ibm.wala.examples.drivers.IFDSExplorerExample" if (System.getProperty("os.name").startsWith("Mac OS X")) { jvmArgs = listOf("-XstartOnFirstThread") }