Update gradle scripts for latest gradle version

1. Use lazy property assignment
2. Remove usages of deprecated buildDir property
This commit is contained in:
Alexey Andreev 2023-09-21 09:52:29 +02:00
parent 2ae9c593d2
commit ba7dcd13b5
17 changed files with 65 additions and 65 deletions

View File

@ -61,7 +61,7 @@ gradlePlugin {
checkstyle {
toolVersion = libs.versions.checkstyle.get()
configDirectory.set(project.layout.projectDirectory.dir("../config/checkstyle"))
configDirectory = project.layout.projectDirectory.dir("../config/checkstyle")
}
java {

View File

@ -37,15 +37,15 @@ dependencies {
}
tasks {
val generatedClassesDir = File(buildDir, "generated/classes/java/main")
val generatedClassesDir = layout.buildDirectory.dir("generated/classes/java/main")
val generateTzCache by registering(JavaExec::class) {
val outputFile = File(generatedClassesDir, "org/teavm/classlib/impl/tz/cache")
val outputFile = generatedClassesDir.map { it.dir( "org/teavm/classlib/impl/tz/cache") }
classpath(sourceSets.main.get().runtimeClasspath, sourceSets.main.get().compileClasspath)
outputs.file(outputFile)
inputs.files(sourceSets.main.get().runtimeClasspath)
dependsOn(compileJava)
mainClass.set("org.teavm.classlib.impl.tz.TimeZoneCache")
args(outputFile.absolutePath)
mainClass = "org.teavm.classlib.impl.tz.TimeZoneCache"
args(outputFile.get().asFile.absolutePath)
}
jar {
dependsOn(generateTzCache)

View File

@ -30,8 +30,8 @@ dependencies {
}
teavm.js {
addedToWebApp.set(true)
mainClass.set("org.teavm.samples.async.AsyncProgram")
addedToWebApp = true
mainClass = "org.teavm.samples.async.AsyncProgram"
}
tasks.war {

View File

@ -43,18 +43,18 @@ val executableFile = File(buildDir, "dist/teavm_benchmark")
teavm {
js {
addedToWebApp.set(true)
mainClass.set("org.teavm.samples.benchmark.teavm.BenchmarkStarter")
debugInformation.set(true)
addedToWebApp = true
mainClass = "org.teavm.samples.benchmark.teavm.BenchmarkStarter"
debugInformation = true
}
wasm {
addedToWebApp.set(true)
mainClass.set("org.teavm.samples.benchmark.teavm.WasmBenchmarkStarter")
addedToWebApp = true
mainClass = "org.teavm.samples.benchmark.teavm.WasmBenchmarkStarter"
}
c {
mainClass.set("org.teavm.samples.benchmark.teavm.Gtk3BenchmarkStarter")
relativePathInOutputDir.set("")
outputDir.set(generatedCSources)
mainClass = "org.teavm.samples.benchmark.teavm.Gtk3BenchmarkStarter"
relativePathInOutputDir = ""
outputDir = generatedCSources
}
}

View File

@ -26,6 +26,6 @@ dependencies {
}
teavm.js {
addedToWebApp.set(true)
mainClass.set("org.teavm.samples.hello.Client")
addedToWebApp = true
mainClass = "org.teavm.samples.hello.Client"
}

View File

@ -25,6 +25,6 @@ dependencies {
}
teavm.js {
addedToWebApp.set(true)
mainClass.set("org.teavm.samples.kotlin.HelloKt")
addedToWebApp = true
mainClass = "org.teavm.samples.kotlin.HelloKt"
}

View File

@ -30,17 +30,17 @@ dependencies {
teavm {
js {
addedToWebApp.set(true)
addedToWebApp = true
}
wasm {
addedToWebApp.set(true)
addedToWebApp = true
}
wasi {
outputDir.set(File(buildDir, "libs/wasi"))
relativePathInOutputDir.set("")
outputDir = layout.buildDirectory.dir("libs/wasi").get().asFile
relativePathInOutputDir = ""
}
all {
mainClass.set("org.teavm.samples.pi.PiCalculator")
mainClass = "org.teavm.samples.pi.PiCalculator"
}
}
@ -56,7 +56,7 @@ tasks.assemble {
val buildNativeLinux by tasks.register<Exec>("buildNativeLinux") {
group = "build"
dependsOn(tasks.generateC)
inputs.dir(File(buildDir, "generated/teavm/c"))
inputs.dir(layout.buildDirectory.dir("generated/teavm/c"))
inputs.file(project.file("CMakeLists.txt"))
outputs.file("build/dist/calc_pi")
executable = "./build-native.sh"

View File

@ -26,6 +26,6 @@ dependencies {
}
teavm.js {
addedToWebApp.set(true)
mainClass.set("org.teavm.samples.scala.Client")
addedToWebApp = true
mainClass = "org.teavm.samples.scala.Client"
}

View File

@ -85,7 +85,7 @@ gradle.afterProject {
extensions.configure<CheckstyleExtension> {
toolVersion = extensions.getByType<VersionCatalogsExtension>().named("libs")
.findVersion("checkstyle").get().requiredVersion
configDirectory.set(File(settings.rootDir, "../config/checkstyle"))
configDirectory = File(settings.rootDir, "../config/checkstyle")
}
java.sourceCompatibility = JavaVersion.VERSION_11
java.targetCompatibility = JavaVersion.VERSION_11

View File

@ -25,6 +25,6 @@ dependencies {
}
teavm.js {
addedToWebApp.set(true)
mainClass.set("org.teavm.samples.webapis.Main")
addedToWebApp = true
mainClass = "org.teavm.samples.webapis.Main"
}

View File

@ -95,29 +95,29 @@ gradle.afterProject {
}
fun MavenPom.setupPom(project: Project) {
name.set(project.description)
description.set(project.description)
name = project.description
description = project.description
licenses {
license {
name.set("The Apache Software License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
distribution.set("repo")
comments.set("A business-friendly OSS license")
name = "The Apache Software License, Version 2.0"
url = "http://www.apache.org/licenses/LICENSE-2.0.txt"
distribution = "repo"
comments = "A business-friendly OSS license"
}
}
developers {
developer {
id.set("konsoletyper")
name.set("Alexey Andreev")
email.set("konsoletyper@gmail.com")
timezone.set("Europe/Berlin")
id = "konsoletyper"
name = "Alexey Andreev"
email = "konsoletyper@gmail.com"
timezone = "Europe/Berlin"
}
}
scm {
url.set("https://github.com/konsoletyper/teavm")
connection.set("scm:git:git@github.com:konsoletyper/teavm.git")
url = "https://github.com/konsoletyper/teavm"
connection = "scm:git:git@github.com:konsoletyper/teavm.git"
}
url.set("https://teavm.org")
url = "https://teavm.org"
}
extensions.configure<DependencyRelocationExtension> {

View File

@ -39,7 +39,7 @@ dependencies {
}
tasks.test {
systemProperty("teavm.junit.target", "${project.buildDir.absolutePath }/teavm-tests")
systemProperty("teavm.junit.target", layout.buildDirectory.dir("teavm-tests").get().asFile.absolutePath)
systemProperty("teavm.junit.threads", "1")
val browser = providers.gradleProperty("teavm.tests.browser").orElse("browser-chrome").get()

View File

@ -33,7 +33,7 @@ val generateComparison by tasks.register<JavaExec>("generateComparison") {
inputs.files(tasks["relocateJar"].outputs.files)
outputs.dir(outputDir)
classpath = configurations.runtimeClasspath.get() + tasks["relocateJar"].outputs.files
mainClass.set("org.teavm.tools.classlibcomparison.JCLComparisonBuilder")
mainClass = "org.teavm.tools.classlibcomparison.JCLComparisonBuilder"
args("-output", outputDir.get().asFile.absolutePath)
}

View File

@ -35,37 +35,37 @@ dependencies {
}
val generateJs by tasks.register<JavaExec>("generateJs") {
outputs.dir(File(buildDir, "teavm"))
outputs.dir(layout.buildDirectory.dir("teavm"))
dependsOn(tasks.classes)
classpath += configurations["teavmCompile"]
classpath += java.sourceSets.main.get().output.classesDirs
mainClass.set("org.teavm.tooling.deobfuscate.js.Compiler")
mainClass = "org.teavm.tooling.deobfuscate.js.Compiler"
args(
"org.teavm.tooling.deobfuscate.js.Deobfuscator",
"\$teavm_deobfuscator",
File(buildDir, "teavm").absolutePath,
layout.buildDirectory.dir("teavm").get().asFile.absolutePath,
"deobfuscator.js"
)
}
val generateLibJs by tasks.register<JavaExec>("generateLibJs") {
outputs.dir(File(buildDir, "teavm-lib"))
outputs.dir(layout.buildDirectory.dir("teavm-lib"))
dependsOn(tasks.classes)
classpath += configurations["teavmCompile"]
classpath += java.sourceSets.main.get().output.classesDirs
mainClass.set("org.teavm.tooling.deobfuscate.js.Compiler")
mainClass = "org.teavm.tooling.deobfuscate.js.Compiler"
args(
"org.teavm.tooling.deobfuscate.js.DeobfuscatorLib",
"deobfuscator",
File(buildDir, "teavm-lib").absolutePath,
layout.buildDirectory.dir("teavm-lib").get().asFile.absolutePath,
"deobfuscator-lib.js",
)
}
val zipWithJs by tasks.register<Jar>("zipWithJs") {
dependsOn(generateJs, generateLibJs)
archiveClassifier.set("js")
from(File(buildDir, "teavm"), File(buildDir, "teavm-lib"))
archiveClassifier = "js"
from(layout.buildDirectory.dir("teavm"), layout.buildDirectory.dir("teavm-lib"))
entryCompression = ZipEntryCompression.DEFLATED
}

View File

@ -29,22 +29,22 @@ dependencies {
}
gradlePlugin {
website.set("https://teavm.org")
vcsUrl.set("https://github.com/konsoletyper/teavm")
website = "https://teavm.org"
vcsUrl = "https://github.com/konsoletyper/teavm"
plugins {
create("TeaVMPlugin") {
id = "org.teavm"
implementationClass = "org.teavm.gradle.TeaVMPlugin"
displayName = "TeaVM application plugin"
description = "Installs TeaVM compilation tasks, configurations and source sets"
tags.set(listOf("teavm", "javascript", "webassembly", "compiler", "aot-compiler"))
tags = listOf("teavm", "javascript", "webassembly", "compiler", "aot-compiler")
}
create("TeaVMLibraryPlugin") {
id = "org.teavm.library"
implementationClass = "org.teavm.gradle.TeaVMLibraryPlugin"
displayName = "TeaVM library plugin"
description = "Installs TeaVM DSL for consuming TeaVM libraries and running tests in a browser"
tags.set(listOf("teavm", "javascript", "webassembly", "compiler", "aot-compiler"))
tags = listOf("teavm", "javascript", "webassembly", "compiler", "aot-compiler")
}
}
}

View File

@ -29,6 +29,6 @@ dependencies {
}
tasks.shadowJar {
archiveFileName.set("teavm.jar")
archiveFileName = "teavm.jar"
mergeServiceFiles()
}

View File

@ -20,15 +20,15 @@ plugins {
}
intellij {
version.set(libs.versions.idea.asProvider().get())
type.set("IC")
updateSinceUntilBuild.set(false)
version = libs.versions.idea.asProvider().get()
type = "IC"
updateSinceUntilBuild = false
plugins.set(listOf(
plugins = listOf(
"java",
"org.intellij.scala:${libs.versions.idea.scala.get()}",
"org.jetbrains.kotlin"
))
)
}
dependencies {
@ -37,13 +37,13 @@ dependencies {
tasks {
instrumentedJar {
archiveFileName.set("teavm-plugin.jar")
archiveFileName = "teavm-plugin.jar"
}
buildSearchableOptions {
enabled = false
}
publishPlugin {
token.set(providers.gradleProperty("teavm.idea.publishToken"))
token = providers.gradleProperty("teavm.idea.publishToken")
}
}