Skip to content

Commit

Permalink
Merge branch 'wala:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
aakgna authored Jan 23, 2024
2 parents a38c5b7 + 675cee8 commit ab16227
Show file tree
Hide file tree
Showing 42 changed files with 293 additions and 247 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
java: 11
- os: ubuntu-latest
java: 17
- os: ubuntu-latest
java: 21
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
Expand All @@ -43,13 +45,13 @@ jobs:
uses: gradle/gradle-build-action@v2
with:
gradle-executable: xvfb-gradle.sh
arguments: aggregatedJavadocs build publishAllPublicationsToFakeRemoteRepository shellcheck --no-configuration-cache
arguments: aggregatedJavadocs build publishAllPublicationsToFakeRemoteRepository shellcheck --no-configuration-cache -Pcom.ibm.wala.jdk-version=${{ matrix.java }}
# testing ECJ compilation on any one OS is sufficient; we choose Linux arbitrarily
if: runner.os == 'Linux'
- name: Build and test using Gradle but without ECJ
uses: gradle/gradle-build-action@v2
with:
arguments: aggregatedJavadocs javadoc build -PskipJavaUsingEcjTasks --no-configuration-cache
arguments: aggregatedJavadocs javadoc build -PskipJavaUsingEcjTasks --no-configuration-cache -Pcom.ibm.wala.jdk-version=${{ matrix.java }}
if: runner.os != 'Linux'
- name: Check for Git cleanliness after build and test
run: ./check-git-cleanliness.sh
Expand Down
1 change: 1 addition & 0 deletions .idea/.gitignore

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

6 changes: 0 additions & 6 deletions .idea/kotlinc.xml

This file was deleted.

1 change: 0 additions & 1 deletion .idea/misc.xml

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

8 changes: 8 additions & 0 deletions README-Gradle.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ project-level Gradle caches will make incremental rebuilds much
faster. Rerunning `./gradlew assemble processTestResources` with a
warm cache in an already-built tree takes under three seconds.

WALA components are built using a mix of Java 11 and Java 17. Gradle
will [download suitable JDKs
automatically](https://docs.gradle.org/current/userguide/toolchains.html#sec:provisioning)
if they are not already [locally
installed](https://docs.gradle.org/current/userguide/toolchains.html#sec:auto_detection)
or
[custom-configured](https://docs.gradle.org/current/userguide/toolchains.html#sec:custom_loc).

## Eclipse

### One-Time Eclipse Configuration
Expand Down
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![WALA logo](http://wala.sourceforge.net/wiki/images/9/94/WALA-banner.png)
![WALA logo](https://wala.github.io/logos/WALA-banner.png)

[![GitHub Actions
status](https://github.com/wala/WALA/workflows/Continuous%20integration/badge.svg)](https://github.com/wala/WALA/actions?query=workflow%3A%22Continuous+integration%22)
Expand Down Expand Up @@ -82,6 +82,13 @@ list](http://sourceforge.net/p/wala/mailman/), [ask a question on
Gitter](https://gitter.im/WALAHelp/Lobby), or [open an
issue](https://github.com/wala/WALA/issues).

## Required Java Versions

Most components of each [official WALA
release](https://github.com/wala/WALA/releases) are built for use with
Java 11 or newer. However, components that use Eclipse require at
least Java 17.

## Building from Source

WALA uses Gradle as its build system. If you intend to modify or
Expand All @@ -105,3 +112,9 @@ Several groups have built open-source tools that enhance or build on
WALA that may be useful to other WALA users. For details, see the
[Wala-based tools](https://github.com/wala/WALA/wiki/WALA-Based-Tools)
page.

## Acknowledgements

![YourKit logo](https://www.yourkit.com/images/yklogo.png)

We thank [YourKit](https://www.yourkit.com) for providing WALA developers with a complimentary license for their excellent [Java profiler](https://www.yourkit.com/java/profiler/), which we use to improve and maintain WALA performance.
9 changes: 0 additions & 9 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
@file:Suppress("UnstableApiUsage")

import com.diffplug.spotless.LineEnding.PLATFORM_NATIVE

plugins {
`kotlin-dsl`
`kotlin-dsl-precompiled-script-plugins`
Expand All @@ -23,11 +19,6 @@ dependencies {
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
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.ibm.wala.gradle

import javax.inject.Inject
import org.gradle.api.Project
import org.gradle.api.file.Directory
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.logging.LogLevel
Expand All @@ -13,13 +11,9 @@ import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.PathSensitive
import org.gradle.api.tasks.PathSensitivity

////////////////////////////////////////////////////////////////////////
//
// specialized task for Kawa compilation into jar archive
//

/** Specialized task for Kawa compilation into jar archive. */
@CacheableTask
abstract class CompileKawaScheme @Inject constructor(project: Project) : JavaExec() {
abstract class CompileKawaScheme : JavaExec() {

@get:InputFile
@get:PathSensitive(PathSensitivity.NONE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@ import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.SourceSet
import org.gradle.api.tasks.TaskAction

////////////////////////////////////////////////////////////////////////
//
// create a Javadoc-style "package-list" file
//

/** Create a Javadoc-style `package-list` file. */
@CacheableTask
open class CreatePackageList : DefaultTask() {

Expand All @@ -25,7 +21,7 @@ open class CreatePackageList : DefaultTask() {

private var sourceFileSubdirectories: SortedSet<Path>? = null

// serializable representation of subdirs suitable for cache indexing
/** Serializable representation of subdirs suitable for cache indexing. */
@Input fun getSourceFileSubdirectories() = sourceFileSubdirectories!!.map { it.toString() }

fun sourceSet(sourceSet: SourceSet) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package com.ibm.wala.gradle

import javax.inject.Inject
import org.gradle.api.Project
import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.api.provider.Provider
import org.gradle.jvm.toolchain.JavaLanguageVersion
import org.gradle.jvm.toolchain.JavaLauncher
import org.gradle.jvm.toolchain.JavaToolchainService
import org.gradle.kotlin.dsl.the

/**
* The earliest Java version that is compatible with bytecode used in Eclipse dependencies.
*
* When changing `eclipse` in the `versions` section of `gradle/libs.versions.toml`, consider
* whether this value needs to be changed as well.
*/
private const val MINIMUM_ECLIPSE_COMPATIBLE_JAVA_VERSION = 17

/**
* A Gradle [Project] extension providing details about Eclipse-compatible Java toolchains.
*
* @constructor Creates an extension instance that will be attached to the given [project].
* @property project The project to which this extension instance is attached.
* @property languageVersion A Java language version that is compatible with WALA's Eclipse
* dependencies.
* @property launcher Provides a Java JVM launcher (i.e., `java` command) that is compatible with
* WALA's Eclipse dependencies.
*/
open class EclipseCompatibleJavaExtension @Inject constructor(private val project: Project) {

val languageVersion: JavaLanguageVersion by lazy {
project.run {
val projectVersion = the<JavaPluginExtension>().toolchain.languageVersion.get()
val minimumVersion = JavaLanguageVersion.of(MINIMUM_ECLIPSE_COMPATIBLE_JAVA_VERSION)
if (projectVersion.canCompileOrRun(minimumVersion)) projectVersion else minimumVersion
}
}

val launcher: Provider<JavaLauncher> by lazy {
project.the<JavaToolchainService>().launcherFor {
languageVersion.set(this@EclipseCompatibleJavaExtension.languageVersion)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import java.io.File
import javax.inject.Inject
import org.gradle.api.Project
import org.gradle.api.file.RegularFile
import org.gradle.api.provider.Provider
import org.gradle.api.tasks.CacheableTask
import org.gradle.api.tasks.CompileClasspath
import org.gradle.api.tasks.InputFile
Expand All @@ -14,6 +15,7 @@ import org.gradle.api.tasks.TaskAction
import org.gradle.api.tasks.TaskProvider
import org.gradle.api.tasks.compile.JavaCompile
import org.gradle.kotlin.dsl.named
import org.gradle.kotlin.dsl.the
import org.gradle.process.ExecOperations

/**
Expand All @@ -35,6 +37,16 @@ abstract class JavaCompileUsingEcj : JavaCompile() {

@get:Inject abstract val execOperations: ExecOperations

/**
* The path to the Java launcher executable used for running the Eclipse Java compiler (ECJ).
*
* @see EclipseCompatibleJavaExtension.launcher
*/
@InputFile
@PathSensitive(PathSensitivity.NONE)
val javaLauncherPath: Provider<RegularFile> =
project.the<EclipseCompatibleJavaExtension>().launcher.map { it.executablePath }

init {
options.compilerArgumentProviders.run {
add {
Expand All @@ -54,6 +66,7 @@ abstract class JavaCompileUsingEcj : JavaCompile() {
fun compile() {
execOperations.javaexec {
classpath(ecjJar.absolutePath)
executable(javaLauncherPath.get())
args(options.allCompilerArgs)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ plugins {
}

dependencies {
annotationProcessor(
rootProject.the<VersionCatalogsExtension>().named("libs").findLibrary("nullaway").get())
annotationProcessor(rootProject.versionCatalogs.named("libs").findLibrary("nullaway").get())
}

tasks.withType<JavaCompile>().configureEach {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,32 @@ import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
import org.gradle.kotlin.dsl.property

////////////////////////////////////////////////////////////////////////
//
// download and use checksum to verify that we got what we expected
//

/** Download and use checksum to verify that we got what we expected. */
@CacheableTask
abstract class VerifiedDownload : DefaultTask() {

// URI of resource to download
/** URI of resource to download. */
@get:Input abstract val src: Property<URI>

// expected checksum of resource as hex digits
/** Expected checksum of resource as hex digits. */
@get:Input abstract val checksum: Property<String>

// algorithm to use for computing checksum
/** Algorithm to use for computing checksum. */
@get:Input val algorithm: Property<String> = project.objects.property<String>().convention("MD5")

// whether to use ETag for selective downloading
/** Whether to use ETag for selective downloading. */
@get:Input val useETag: Property<Boolean> = project.objects.property<Boolean>().convention(true)

// local file into which resource should be saved
/** Local file into which resource should be saved. */
@get:OutputFile abstract val dest: RegularFileProperty

// plugin-provided extension for downloading a resource from some URL
/** Plugin-provided extension for downloading a resource from some URL. */
@Internal
@Suppress("LeakingThis")
val downloadExtension: DownloadExtension =
project.objects.newInstance(DownloadExtension::class.java, this)

// plugin-provided extension for verifying that a file has the expected checksum
/** Plugin-provided extension for verifying that a file has the expected checksum. */
@Internal
@Suppress("LeakingThis")
val verifyExtension: VerifyExtension =
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package com.ibm.wala.gradle

plugins { java }

// Make Eclipse-compatible Java information available as `project.eclipseCompatibleJava`.
extensions.create<EclipseCompatibleJavaExtension>("eclipseCompatibleJava")
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
package com.ibm.wala.gradle

import com.diffplug.gradle.eclipse.MavenCentralExtension
import com.diffplug.gradle.eclipse.MavenCentralExtension.ReleaseConfigurer
import com.diffplug.gradle.eclipse.MavenCentralPlugin
import com.diffplug.gradle.pde.EclipseRelease

plugins {
id("com.diffplug.eclipse.mavencentral")
id("com.ibm.wala.gradle.eclipse-compatible-java")
id("com.ibm.wala.gradle.java")
}

// This subproject uses one or more Eclipse dependencies. Eensure that it is using an
// Eclipse-compatible Java toolchain. That toolchain might be newer than the Java toolchain that
// WALA uses elsewhere.
java.toolchain.languageVersion = the<EclipseCompatibleJavaExtension>().languageVersion

/**
* WALA-specialized adaptation of
* [ReleaseConfigurer](https://javadoc.io/doc/com.diffplug.gradle/goomph/latest/com/diffplug/gradle/eclipse/MavenCentralExtension.ReleaseConfigurer.html).
Expand Down Expand Up @@ -48,8 +58,7 @@ open class WalaMavenCentralReleaseConfigurerExtension @Inject constructor(projec
*/
private val configurer by lazy {
project.run {
the<MavenCentralExtension>()
.ReleaseConfigurer(rootProject.extra["eclipseVersion"] as EclipseRelease)
eclipseMavenCentral.ReleaseConfigurer(rootProject.extra["eclipseVersion"] as EclipseRelease)
}
}

Expand Down
Loading

0 comments on commit ab16227

Please sign in to comment.