Gradle: use simpler Kotlin DSL property assignment

https://blog.gradle.org/simpler-kotlin-dsl-property-assignment
This commit is contained in:
Karl Tauber
2024-03-23 13:56:47 +01:00
parent a62dd22f83
commit 55ddac2bc7
9 changed files with 30 additions and 30 deletions

View File

@@ -27,7 +27,7 @@ library {
} }
with( linkTask.get() ) { with( linkTask.get() ) {
if( name.contains( "Release" ) ) if( name.contains( "Release" ) )
debuggable.set( false ) debuggable = false
} }
} }
} }

View File

@@ -44,34 +44,34 @@ publishing {
pom { pom {
afterEvaluate { afterEvaluate {
this@pom.name.set( extension.name ) this@pom.name = extension.name
this@pom.description.set( extension.description ) this@pom.description = extension.description
} }
url.set( "https://github.com/JFormDesigner/FlatLaf" ) url = "https://github.com/JFormDesigner/FlatLaf"
licenses { licenses {
license { license {
name.set( "The Apache License, Version 2.0" ) name = "The Apache License, Version 2.0"
url.set( "https://www.apache.org/licenses/LICENSE-2.0.txt" ) url = "https://www.apache.org/licenses/LICENSE-2.0.txt"
} }
} }
developers { developers {
developer { developer {
name.set( "Karl Tauber" ) name = "Karl Tauber"
organization.set( "FormDev Software GmbH" ) organization = "FormDev Software GmbH"
organizationUrl.set( "https://www.formdev.com/" ) organizationUrl = "https://www.formdev.com/"
} }
} }
scm { scm {
connection.set( "scm:git:git://github.com/JFormDesigner/FlatLaf.git" ) connection = "scm:git:git://github.com/JFormDesigner/FlatLaf.git"
url.set( "https://github.com/JFormDesigner/FlatLaf" ) url = "https://github.com/JFormDesigner/FlatLaf"
} }
issueManagement { issueManagement {
system.set( "GitHub" ) system = "GitHub"
url.set( "https://github.com/JFormDesigner/FlatLaf/issues" ) url = "https://github.com/JFormDesigner/FlatLaf/issues"
} }
} }

View File

@@ -21,6 +21,6 @@ plugins {
val toolchainJavaVersion = System.getProperty( "toolchain" ) val toolchainJavaVersion = System.getProperty( "toolchain" )
if( !toolchainJavaVersion.isNullOrEmpty() ) { if( !toolchainJavaVersion.isNullOrEmpty() ) {
java.toolchain { java.toolchain {
languageVersion.set( JavaLanguageVersion.of( toolchainJavaVersion ) ) languageVersion = JavaLanguageVersion.of( toolchainJavaVersion )
} }
} }

View File

@@ -42,11 +42,11 @@ java {
tasks { tasks {
compileJava { compileJava {
// generate JNI headers // generate JNI headers
options.headerOutputDirectory.set( layout.buildDirectory.dir( "generated/jni-headers" ) ) options.headerOutputDirectory = layout.buildDirectory.dir( "generated/jni-headers" )
} }
jar { jar {
archiveBaseName.set( "flatlaf" ) archiveBaseName = "flatlaf"
doLast { doLast {
ReorderJarEntries.reorderJarEntries( outputs.files.singleFile ); ReorderJarEntries.reorderJarEntries( outputs.files.singleFile );
@@ -54,20 +54,20 @@ tasks {
} }
named<Jar>( "sourcesJar" ) { named<Jar>( "sourcesJar" ) {
archiveBaseName.set( "flatlaf" ) archiveBaseName = "flatlaf"
} }
named<Jar>( "javadocJar" ) { named<Jar>( "javadocJar" ) {
archiveBaseName.set( "flatlaf" ) archiveBaseName = "flatlaf"
} }
register<Zip>( "jarNoNatives" ) { register<Zip>( "jarNoNatives" ) {
group = "build" group = "build"
dependsOn( "jar" ) dependsOn( "jar" )
archiveBaseName.set( "flatlaf" ) archiveBaseName = "flatlaf"
archiveClassifier.set( "no-natives" ) archiveClassifier = "no-natives"
archiveExtension.set( "jar" ) archiveExtension = "jar"
destinationDirectory = layout.buildDirectory.dir( "libs" ) destinationDirectory = layout.buildDirectory.dir( "libs" )
from( zipTree( jar.get().archiveFile.get().asFile ) ) from( zipTree( jar.get().archiveFile.get().asFile ) )

View File

@@ -73,8 +73,8 @@ publishing {
pom { pom {
licenses { licenses {
license { license {
name.set( "SIL OPEN FONT LICENSE Version 1.1" ) name = "SIL OPEN FONT LICENSE Version 1.1"
url.set( "https://choosealicense.com/licenses/ofl-1.1/" ) url = "https://choosealicense.com/licenses/ofl-1.1/"
} }
} }
} }

View File

@@ -73,8 +73,8 @@ publishing {
pom { pom {
licenses { licenses {
license { license {
name.set( "SIL OPEN FONT LICENSE Version 1.1" ) name = "SIL OPEN FONT LICENSE Version 1.1"
url.set( "https://choosealicense.com/licenses/ofl-1.1/" ) url = "https://choosealicense.com/licenses/ofl-1.1/"
} }
} }
} }

View File

@@ -25,7 +25,7 @@ flatlafJniHeaders {
} }
library { library {
targetMachines.set( listOf( machines.linux.x86_64 ) ) targetMachines = listOf( machines.linux.x86_64 )
} }
var javaHome = System.getProperty( "java.home" ) var javaHome = System.getProperty( "java.home" )

View File

@@ -30,10 +30,10 @@ flatlafJniHeaders {
} }
library { library {
targetMachines.set( listOf( targetMachines = listOf(
machines.macOS.architecture( "arm64" ), machines.macOS.architecture( "arm64" ),
machines.macOS.x86_64 machines.macOS.x86_64
) ) )
} }
var javaHome = System.getProperty( "java.home" ) var javaHome = System.getProperty( "java.home" )

View File

@@ -29,11 +29,11 @@ flatlafJniHeaders {
} }
library { library {
targetMachines.set( listOf( targetMachines = listOf(
machines.windows.x86, machines.windows.x86,
machines.windows.x86_64, machines.windows.x86_64,
machines.windows.architecture( "aarch64" ) machines.windows.architecture( "aarch64" )
) ) )
} }
var javaHome = System.getProperty( "java.home" ) var javaHome = System.getProperty( "java.home" )