Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simple property assignments in KTS #120

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ dependencies {

java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
languageVersion = JavaLanguageVersion.of(11)
}
}
2 changes: 1 addition & 1 deletion buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pluginManagement {
@Suppress("UnstableApiUsage")
dependencyResolutionManagement {

repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositoriesMode = RepositoriesMode.PREFER_SETTINGS

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ tasks.withType<AbstractArchiveTask>().configureEach {
}

tasks.withType<AbstractTestTask>().configureEach {
timeout.set(Duration.ofMinutes(60))
timeout = Duration.ofMinutes(60)

testLogging {
showCauses = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ fun createDokkatooExampleProjectsSettings(
val destinationDir = it.parentFile
val name = destinationDir.toRelativeString(projectDir.asFile).toAlphaNumericCamelCase()
exampleProjects.register(name) {
this.exampleProjectDir.set(destinationDir)
this.exampleProjectDir = destinationDir
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ plugins {

extensions.getByType<JavaPluginExtension>().apply {
toolchain {
languageVersion.set(JavaLanguageVersion.of(11))
languageVersion = JavaLanguageVersion.of(11)
}
withSourcesJar()
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
}

tasks.validatePlugins {
enableStricterValidation.set(true)
enableStricterValidation = true
}

val createJavadocJarReadme by tasks.registering(Sync::class) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ publishing {

developers {
developer {
email.set("adam@adamko.dev")
email = "adam@adamko.dev"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ configurations.exampleProjectsElements.configure {
}

dokkaSourceDownload {
dokkaVersion.set(libs.versions.kotlin.dokka)
dokkaVersion = libs.versions.kotlin.dokka
}
4 changes: 2 additions & 2 deletions examples/custom-format-example/dokkatoo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

dokkatoo {
moduleName.set("customFormat-example")
moduleName = "customFormat-example"
pluginsConfiguration.html {
// Dokka's stylesheets and assets with conflicting names will be overridden.
// In this particular case, logo-styles.css will be overridden
Expand All @@ -13,6 +13,6 @@ dokkatoo {
customAssets.from("ktor-logo.png")

// Text used in the footer
footerMessage.set("(c) Custom Format Dokka example")
footerMessage = "(c) Custom Format Dokka example"
}
}
11 changes: 5 additions & 6 deletions examples/gradle-example/dokka/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,18 @@ tasks.withType<DokkaTask>().configureEach {
dokkaSourceSets {
named("main") {
// used as project name in the header
moduleName.set("Dokka Gradle Example")
moduleName = "Dokka Gradle Example"

// contains descriptions for the module and the packages
includes.from("Module.md")

// adds source links that lead to this repository, allowing readers
// to easily find source code for inspected declarations
sourceLink {
localDirectory.set(file("src/main/kotlin"))
remoteUrl.set(URL("https://github.com/Kotlin/dokka/tree/master/" +
"examples/gradle/dokka-gradle-example/src/main/kotlin"
))
remoteLineSuffix.set("#L")
localDirectory = file("src/main/kotlin")
remoteUrl = URL("https://github.com/Kotlin/dokka/tree/master/" +
"examples/gradle/dokka-gradle-example/src/main/kotlin")
remoteLineSuffix = "#L"
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions examples/gradle-example/dokkatoo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {

dokkatoo {
// used as project name in the header
moduleName.set("Dokka Gradle Example")
moduleName = "Dokka Gradle Example"

dokkatooSourceSets.main {

Expand All @@ -15,9 +15,9 @@ dokkatoo {
// adds source links that lead to this repository, allowing readers
// to easily find source code for inspected declarations
sourceLink {
localDirectory.set(file("src/main/kotlin"))
localDirectory = file("src/main/kotlin")
remoteUrl("https://github.com/Kotlin/dokka/tree/master/examples/gradle/dokka-gradle-example/src/main/kotlin")
remoteLineSuffix.set("#L")
remoteLineSuffix = "#L"
}
}
}
4 changes: 2 additions & 2 deletions examples/library-publishing-example/dokka/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ dependencies {
val dokkaJavadocJar by tasks.register<Jar>("dokkaJavadocJar") {
dependsOn(tasks.dokkaJavadoc)
from(tasks.dokkaJavadoc.flatMap { it.outputDirectory })
archiveClassifier.set("javadoc")
archiveClassifier = "javadoc"
}

val dokkaHtmlJar by tasks.register<Jar>("dokkaHtmlJar") {
dependsOn(tasks.dokkaHtml)
from(tasks.dokkaHtml.flatMap { it.outputDirectory })
archiveClassifier.set("html-doc")
archiveClassifier = "html-doc"
}

publishing {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ subprojects {

tasks.withType<DokkaTaskPartial>().configureEach {
dokkaSourceSets.configureEach {
documentedVisibilities.set(setOf(
documentedVisibilities = setOf(
Visibility.PUBLIC,
Visibility.PROTECTED
))
Expand All @@ -23,9 +23,9 @@ subprojects {
sourceLink {
val exampleDir = "https://github.com/Kotlin/dokka/tree/master/examples/gradle/dokka-multimodule-example"

localDirectory.set(rootProject.projectDir)
remoteUrl.set(URL("$exampleDir"))
remoteLineSuffix.set("#L")
localDirectory = rootProject.projectDir
remoteUrl = URL("$exampleDir")
remoteLineSuffix = "#L"
}
}
}
Expand All @@ -34,5 +34,5 @@ subprojects {
// Configures only the parent MultiModule task,
// this will not affect subprojects
tasks.dokkaHtmlMultiModule {
moduleName.set("Dokka MultiModule Example")
moduleName = "Dokka MultiModule Example"
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pluginManagement {
@Suppress("UnstableApiUsage")
dependencyResolutionManagement {

repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)
repositoriesMode = RepositoriesMode.PREFER_SETTINGS

repositories {
mavenCentral()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dokkatoo {
sourceLink {
// Read docs for more details: https://kotlinlang.org/docs/dokka-gradle.html#source-link-configuration
remoteUrl("https://github.com/Kotlin/dokka/tree/master/examples/gradle/dokka-multimodule-example")
localDirectory.set(rootDir)
localDirectory = rootDir
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ dependencies {
}

dokkatoo {
moduleName.set("Dokka MultiModule Example")
moduleName = "Dokka MultiModule Example"
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ dokkatoo {

//region DON'T COPY - this is only needed for internal Dokkatoo integration tests
dokkatoo {
modulePath.set("childProjectA") // match the original dokka default
modulePath = "childProjectA" // match the original dokka default
}
tasks.withType<dev.adamko.dokkatoo.tasks.DokkatooGenerateTask>().configureEach {
generator.dokkaSourceSets.configureEach {
sourceSetScope.set(":parentProject:childProjectA:dokkaHtmlPartial")
sourceSetScope = ":parentProject:childProjectA:dokkaHtmlPartial"
}
}
//endregion
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ dokkatoo {

//region DON'T COPY - this is only needed for internal Dokkatoo integration tests
dokkatoo {
modulePath.set("childProjectB") // match the original dokka default
modulePath = "childProjectB" // match the original dokka default
}
tasks.withType<dev.adamko.dokkatoo.tasks.DokkatooGenerateTask>().configureEach {
generator.dokkaSourceSets.configureEach {
sourceSetScope.set(":parentProject:childProjectB:dokkaHtmlPartial")
sourceSetScope = ":parentProject:childProjectB:dokkaHtmlPartial"
}
}
//endregion
4 changes: 2 additions & 2 deletions examples/multiplatform-example/dokka/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ tasks.withType<DokkaTask>().configureEach {
dokkaSourceSets {
// Create a custom source set not known to the Kotlin Gradle Plugin
register("customSourceSet") {
this.jdkVersion.set(9)
this.displayName.set("custom")
this.jdkVersion = 9
this.displayName = "custom"
this.sourceRoots.from(file("src/customJdk9/kotlin"))
}
}
Expand Down
6 changes: 3 additions & 3 deletions examples/multiplatform-example/dokkatoo/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ kotlin {
dokkatoo {
// Create a custom source set not known to the Kotlin Gradle Plugin
dokkatooSourceSets.register("customSourceSet") {
jdkVersion.set(9)
displayName.set("custom")
jdkVersion = 9
displayName = "custom"
sourceRoots.from("src/customJdk9/kotlin")
}
}


//region DON'T COPY - this is only needed for internal Dokkatoo integration tests
dokkatoo {
sourceSetScopeDefault.set(":dokkaHtml")
sourceSetScopeDefault = ":dokkaHtml"
}
//endregion
2 changes: 1 addition & 1 deletion modules/docs/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ dependencies {
}

dokkatoo {
moduleName.set("Dokkatoo Gradle Plugin")
moduleName = "Dokkatoo Gradle Plugin"

pluginsConfiguration.named<DokkaHtmlPluginParameters>("html") {
customStyleSheets.from(
Expand Down
8 changes: 4 additions & 4 deletions modules/dokkatoo-plugin-integration-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ testing.suites {

targets.configureEach {
testTask.configure {
javaLauncher.set(javaToolchains.launcherFor {
javaLauncher = javaToolchains.launcherFor {
// Android test project requires Java 17
languageVersion.set(JavaLanguageVersion.of(17))
})
languageVersion = JavaLanguageVersion.of(17)
}

val projectTestTempDirPath = "$buildDir_/test-temp-dir"
inputs.property("projectTestTempDir", projectTestTempDirPath)
Expand Down Expand Up @@ -264,7 +264,7 @@ tasks.withType<Test>().configureEach {
}

dokkaSourceDownload {
dokkaVersion.set(libs.versions.kotlin.dokka)
dokkaVersion = libs.versions.kotlin.dokka
}

tasks.updateAndroidLocalProperties {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ tasks.withType<dev.adamko.dokkatoo.tasks.DokkatooGenerateTask>().configureEach {
// sourceSetScope renaming is fine, I'm not worried about it. The default comes from the
// Gradle Task name, so a name difference doesn't matter.
// We can just manually force the Dokkatoo name to match Dokka.
sourceSetScope.set(":dokkaHtml")
sourceSetScope = ":dokkaHtml"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,39 +25,33 @@ dependencies {
}

tasks.withType<DokkaTask> {
moduleName.set("Basic Project")
moduleName = "Basic Project"
dokkaSourceSets {
configureEach {
documentedVisibilities.set(
setOf(DokkaConfiguration.Visibility.PUBLIC, DokkaConfiguration.Visibility.PROTECTED)
)
documentedVisibilities = setOf(DokkaConfiguration.Visibility.PUBLIC, DokkaConfiguration.Visibility.PROTECTED)
suppressedFiles.from(file("src/main/kotlin/it/suppressedByPath"))
perPackageOption {
matchingRegex.set("it.suppressedByPackage.*")
suppress.set(true)
matchingRegex = "it.suppressedByPackage.*"
suppress = true
}
perPackageOption {
matchingRegex.set("it.overriddenVisibility.*")
documentedVisibilities.set(
setOf(DokkaConfiguration.Visibility.PRIVATE)
)
matchingRegex = "it.overriddenVisibility.*")
documentedVisibilities = setOf(DokkaConfiguration.Visibility.PRIVATE)
}
sourceLink {
localDirectory.set(file("src/main"))
remoteUrl.set(
URL(
localDirectory = file("src/main")
remoteUrl = URL(
"https://github.com/Kotlin/dokka/tree/master/" +
"integration-tests/gradle/projects/it-basic/src/main"
)
)
}
}

register("myTest") {
kotlinSourceSet(kotlin.sourceSets["test"])
}
}
suppressObviousFunctions.set(false)
suppressObviousFunctions = false

pluginsMapConfiguration.set(mapOf(DokkaBase::class.qualifiedName to """{ "customStyleSheets": ["${file("../customResources/logo-styles.css").invariantSeparatorsPath}", "${file("../customResources/custom-style-to-add.css").invariantSeparatorsPath}"], "customAssets" : ["${file("../customResources/custom-resource.svg").invariantSeparatorsPath}"] }"""))
pluginsMapConfiguration = mapOf(DokkaBase::class.qualifiedName to """{ "customStyleSheets": ["${file("../customResources/logo-styles.css").invariantSeparatorsPath}", "${file("../customResources/custom-style-to-add.css").invariantSeparatorsPath}"], "customAssets" : ["${file("../customResources/custom-resource.svg").invariantSeparatorsPath}"] }""")
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,25 @@ kotlin {
}

dokkatoo {
moduleName.set("Basic Project")
moduleName = "Basic Project"
dokkatooSourceSets.configureEach {
documentedVisibilities(
VisibilityModifier.PUBLIC,
VisibilityModifier.PROTECTED,
)
suppressedFiles.from(file("src/main/kotlin/it/suppressedByPath"))
perPackageOption {
matchingRegex.set("it.suppressedByPackage.*")
suppress.set(true)
matchingRegex = "it.suppressedByPackage.*"
suppress = true
}
perPackageOption {
matchingRegex.set("it.overriddenVisibility.*")
matchingRegex = "it.overriddenVisibility.*"
documentedVisibilities(
VisibilityModifier.PRIVATE,
)
}
sourceLink {
localDirectory.set(file("src/main"))
localDirectory = file("src/main")
remoteUrl(
"https://github.com/Kotlin/dokka/tree/master/integration-tests/gradle/projects/it-basic/src/main"
)
Expand All @@ -53,12 +53,12 @@ dokkatoo {
}

dokkatooPublications.configureEach {
suppressObviousFunctions.set(false)
suppressObviousFunctions = false
}
}

tasks.withType<dev.adamko.dokkatoo.tasks.DokkatooGenerateTask>().configureEach {
generator.dokkaSourceSets.configureEach {
sourceSetScope.set(":dokkaHtml")
sourceSetScope = ":dokkaHtml"
}
}
Loading
Loading