-
Notifications
You must be signed in to change notification settings - Fork 225
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'wala:master' into master
- Loading branch information
Showing
42 changed files
with
293 additions
and
247 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
build-logic/src/main/kotlin/com/ibm/wala/gradle/EclipseCompatibleJavaExtension.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
build-logic/src/main/kotlin/com/ibm/wala/gradle/eclipse-compatible-java.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.