Skip to content

Commit

Permalink
chore(gradle): Simpler Kotlin DSL Property Assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonMarquis committed Feb 2, 2024
1 parent ef56659 commit 56c1104
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import org.gradle.api.Project
import org.gradle.api.artifacts.VersionCatalog
import org.gradle.api.artifacts.VersionCatalogsExtension
import org.gradle.api.plugins.JavaPluginExtension
import org.gradle.kotlin.dsl.assign
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.getByType
Expand Down Expand Up @@ -96,10 +97,10 @@ internal inline fun <reified T : KotlinTopLevelExtension> Project.configureKotli
}
tasks.withType<KotlinCompile>().configureEach {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
jvmTarget = JvmTarget.JVM_11
// kotlinOptions.jvmTarget = JavaVersion.VERSION_11.toString()
this.allWarningsAsErrors.set(allWarningsAsErrors)
explicitApiMode.set(ExplicitApiMode.Strict)
this.allWarningsAsErrors = allWarningsAsErrors
explicitApiMode = ExplicitApiMode.Strict
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ package com.adevinta.spark
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.assign
import org.gradle.kotlin.dsl.dependencies
import org.gradle.kotlin.dsl.named
import org.gradle.kotlin.dsl.withType
Expand Down Expand Up @@ -58,8 +59,8 @@ internal class SparkDokkaPlugin : Plugin<Project> {
}

private fun Project.configureRootProject() = tasks.named<DokkaMultiModuleTask>("dokkaHtmlMultiModule") {
moduleName.set("Spark")
outputDirectory.set(layout.buildDirectory.dir("dokka"))
moduleName = "Spark"
outputDirectory = layout.buildDirectory.dir("dokka")
pluginConfiguration<DokkaBase, DokkaBaseConfiguration> {
fun File.recursiveAssets() = walk().filter(File::isFile)
// https://github.com/Kotlin/dokka/issues/3400
Expand Down Expand Up @@ -92,9 +93,9 @@ internal class SparkDokkaPlugin : Plugin<Project> {
// FIXME(android): https://github.com/Kotlin/dokka/issues/2876
sourceLink {
val url = "https://github.com/Adevinta/spark-android/tree/main/${project.name}/src/main/kotlin"
localDirectory.set(projectDir.resolve("src"))
remoteUrl.set(URL(url))
remoteLineSuffix.set("#L")
localDirectory = projectDir.resolve("src")
remoteUrl = URL(url)
remoteLineSuffix = "#L"
}
}
pluginConfiguration<DokkaBase, DokkaBaseConfiguration> { configureFooterMessage() }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import org.gradle.api.Project
import org.gradle.api.publish.PublishingExtension
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.assign
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.provideDelegate
Expand Down Expand Up @@ -96,22 +97,22 @@ internal class SparkPublishingPlugin : Plugin<Project> {
}

private fun MavenPublication.configurePom() = pom {
name.set("Spark")
description.set("Spark Design System")
url.set("https://github.com/adevinta/spark-android")
name = "Spark"
description = "Spark Design System"
url = "https://github.com/adevinta/spark-android"
licenses {
license {
name.set("MIT License")
url.set("https://opensource.org/licenses/MIT")
name = "MIT License"
url = "https://opensource.org/licenses/MIT"
}
}
scm {
url.set("https://github.com/adevinta/spark-android")
url = "https://github.com/adevinta/spark-android"
}
developers {
developer {
name.set("Adevinta Engineers")
email.set("engineers@adevinta.com")
name = "Adevinta Engineers"
email = "engineers@adevinta.com"
}
}
}
Expand Down

0 comments on commit 56c1104

Please sign in to comment.