From df50360cd5bc346f26c06cc07485660d71c1d5a9 Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Tue, 14 Mar 2023 19:27:25 +0100 Subject: [PATCH 01/11] remove `implementation(kotlin("stdlib"))`` dependency --- examples/gradle/dokka-customFormat-example/build.gradle.kts | 1 - examples/gradle/dokka-gradle-example/build.gradle.kts | 1 - examples/gradle/dokka-kotlinAsJava-example/build.gradle.kts | 1 - .../gradle/dokka-library-publishing-example/build.gradle.kts | 1 - .../dokka-multimodule-example/parentProject/build.gradle.kts | 5 ----- .../parentProject/childProjectA/build.gradle.kts | 4 ---- .../parentProject/childProjectB/build.gradle.kts | 4 ---- .../parentProject/build.gradle.kts | 4 ---- .../parentProject/childProjectA/build.gradle.kts | 4 ++-- .../parentProject/childProjectB/build.gradle.kts | 2 +- examples/plugin/hide-internal-api/build.gradle.kts | 2 +- 11 files changed, 4 insertions(+), 25 deletions(-) diff --git a/examples/gradle/dokka-customFormat-example/build.gradle.kts b/examples/gradle/dokka-customFormat-example/build.gradle.kts index da22dda551..594d65d39c 100644 --- a/examples/gradle/dokka-customFormat-example/build.gradle.kts +++ b/examples/gradle/dokka-customFormat-example/build.gradle.kts @@ -31,6 +31,5 @@ tasks.dokkaHtml { } dependencies { - implementation(kotlin("stdlib")) testImplementation(kotlin("test-junit")) } diff --git a/examples/gradle/dokka-gradle-example/build.gradle.kts b/examples/gradle/dokka-gradle-example/build.gradle.kts index dc38461c5a..30cb4d7228 100644 --- a/examples/gradle/dokka-gradle-example/build.gradle.kts +++ b/examples/gradle/dokka-gradle-example/build.gradle.kts @@ -11,7 +11,6 @@ repositories { } dependencies { - implementation(kotlin("stdlib")) testImplementation(kotlin("test-junit")) } diff --git a/examples/gradle/dokka-kotlinAsJava-example/build.gradle.kts b/examples/gradle/dokka-kotlinAsJava-example/build.gradle.kts index 96a4745133..d1335e4767 100644 --- a/examples/gradle/dokka-kotlinAsJava-example/build.gradle.kts +++ b/examples/gradle/dokka-kotlinAsJava-example/build.gradle.kts @@ -8,7 +8,6 @@ repositories { } dependencies { - implementation(kotlin("stdlib")) testImplementation(kotlin("test-junit")) // Will apply the plugin to all Dokka tasks diff --git a/examples/gradle/dokka-library-publishing-example/build.gradle.kts b/examples/gradle/dokka-library-publishing-example/build.gradle.kts index 3349702e29..b01322eea0 100644 --- a/examples/gradle/dokka-library-publishing-example/build.gradle.kts +++ b/examples/gradle/dokka-library-publishing-example/build.gradle.kts @@ -10,7 +10,6 @@ repositories { } dependencies { - implementation(kotlin("stdlib")) testImplementation(kotlin("test-junit")) } diff --git a/examples/gradle/dokka-multimodule-example/parentProject/build.gradle.kts b/examples/gradle/dokka-multimodule-example/parentProject/build.gradle.kts index 66b32b18ba..da7b382e31 100644 --- a/examples/gradle/dokka-multimodule-example/parentProject/build.gradle.kts +++ b/examples/gradle/dokka-multimodule-example/parentProject/build.gradle.kts @@ -26,8 +26,3 @@ subprojects { tasks.dokkaHtmlMultiModule { moduleName.set("Dokka MultiModule Example") } - -dependencies { - implementation(kotlin("stdlib")) -} - diff --git a/examples/gradle/dokka-multimodule-example/parentProject/childProjectA/build.gradle.kts b/examples/gradle/dokka-multimodule-example/parentProject/childProjectA/build.gradle.kts index e13819a160..7b3b1e233e 100644 --- a/examples/gradle/dokka-multimodule-example/parentProject/childProjectA/build.gradle.kts +++ b/examples/gradle/dokka-multimodule-example/parentProject/childProjectA/build.gradle.kts @@ -5,10 +5,6 @@ plugins { id("org.jetbrains.dokka") } -dependencies { - implementation(kotlin("stdlib")) -} - // configuration specific to this subproject. // notice the use of Partial task tasks.withType().configureEach { diff --git a/examples/gradle/dokka-multimodule-example/parentProject/childProjectB/build.gradle.kts b/examples/gradle/dokka-multimodule-example/parentProject/childProjectB/build.gradle.kts index 089813a88f..e8b40d4ae4 100644 --- a/examples/gradle/dokka-multimodule-example/parentProject/childProjectB/build.gradle.kts +++ b/examples/gradle/dokka-multimodule-example/parentProject/childProjectB/build.gradle.kts @@ -5,10 +5,6 @@ plugins { id("org.jetbrains.dokka") } -dependencies { - implementation(kotlin("stdlib")) -} - // configuration specific to this subproject. // notice the use of Partial task tasks.withType().configureEach { diff --git a/examples/gradle/dokka-versioning-multimodule-example/parentProject/build.gradle.kts b/examples/gradle/dokka-versioning-multimodule-example/parentProject/build.gradle.kts index 295b4485b4..59d0181f69 100644 --- a/examples/gradle/dokka-versioning-multimodule-example/parentProject/build.gradle.kts +++ b/examples/gradle/dokka-versioning-multimodule-example/parentProject/build.gradle.kts @@ -12,10 +12,6 @@ buildscript { } } -dependencies { - implementation(kotlin("stdlib")) -} - val currentVersion = "1.0" val previousVersionsDirectory = project.rootProject.projectDir.resolve("previousDocVersions").invariantSeparatorsPath diff --git a/examples/gradle/dokka-versioning-multimodule-example/parentProject/childProjectA/build.gradle.kts b/examples/gradle/dokka-versioning-multimodule-example/parentProject/childProjectA/build.gradle.kts index dd9f519909..2e3ca6ab49 100644 --- a/examples/gradle/dokka-versioning-multimodule-example/parentProject/childProjectA/build.gradle.kts +++ b/examples/gradle/dokka-versioning-multimodule-example/parentProject/childProjectA/build.gradle.kts @@ -1,3 +1,3 @@ dependencies { - implementation(kotlin("stdlib")) -} \ No newline at end of file + +} diff --git a/examples/gradle/dokka-versioning-multimodule-example/parentProject/childProjectB/build.gradle.kts b/examples/gradle/dokka-versioning-multimodule-example/parentProject/childProjectB/build.gradle.kts index fceff82977..2e3ca6ab49 100644 --- a/examples/gradle/dokka-versioning-multimodule-example/parentProject/childProjectB/build.gradle.kts +++ b/examples/gradle/dokka-versioning-multimodule-example/parentProject/childProjectB/build.gradle.kts @@ -1,3 +1,3 @@ dependencies { - implementation(kotlin("stdlib")) + } diff --git a/examples/plugin/hide-internal-api/build.gradle.kts b/examples/plugin/hide-internal-api/build.gradle.kts index ed8169adfc..533bbd6018 100644 --- a/examples/plugin/hide-internal-api/build.gradle.kts +++ b/examples/plugin/hide-internal-api/build.gradle.kts @@ -19,7 +19,7 @@ repositories { val dokkaVersion: String by project dependencies { - implementation(kotlin("stdlib")) + compileOnly("org.jetbrains.dokka:dokka-core:$dokkaVersion") implementation("org.jetbrains.dokka:dokka-base:$dokkaVersion") From 4f49425256314e40303c90796a58bb7f3f6cab70 Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Tue, 14 Mar 2023 19:32:45 +0100 Subject: [PATCH 02/11] set up Version Catalog and typesafe project accessors --- build-logic/build.gradle.kts | 22 +--- build-logic/settings.gradle.kts | 6 + .../main/kotlin/org/jetbrains/publication.kt | 16 +-- build.gradle.kts | 12 +- core/build.gradle.kts | 18 +-- .../build.gradle.kts | 6 +- core/test-api/build.gradle.kts | 5 +- gradle/libs.versions.toml | 123 ++++++++++++++++++ integration-tests/build.gradle.kts | 11 +- integration-tests/cli/build.gradle.kts | 8 +- integration-tests/gradle/build.gradle.kts | 7 +- .../projects/it-android-0/build.gradle.kts | 2 - .../gradle/projects/it-basic/build.gradle.kts | 1 - .../moduleA/moduleB/build.gradle.kts | 4 - .../moduleA/moduleC/build.gradle.kts | 4 - .../projects/it-js-ir-0/build.gradle.kts | 3 +- .../moduleA/moduleB/build.gradle.kts | 4 - .../moduleA/moduleC/build.gradle.kts | 4 - .../moduleA/moduleD/build.gradle.kts | 4 - .../build.gradle.kts | 5 - .../serialization/kotlinx-serialization | 2 +- integration-tests/maven/build.gradle.kts | 4 +- kotlin-analysis/build.gradle.kts | 2 +- .../compiler-dependency/build.gradle.kts | 3 +- .../intellij-dependency/build.gradle.kts | 16 +-- plugins/all-modules-page/build.gradle.kts | 43 +++--- .../android-documentation/build.gradle.kts | 18 +-- plugins/base/base-test-utils/build.gradle.kts | 21 +-- plugins/base/build.gradle.kts | 52 ++++---- plugins/base/frontend/build.gradle.kts | 2 +- plugins/gfm/build.gradle.kts | 25 ++-- .../gfm-template-processing/build.gradle.kts | 23 ++-- plugins/javadoc/build.gradle.kts | 31 ++--- plugins/jekyll/build.gradle.kts | 15 +-- .../build.gradle.kts | 26 ++-- plugins/kotlin-as-java/build.gradle.kts | 26 ++-- plugins/mathjax/build.gradle.kts | 22 ++-- plugins/templating/build.gradle.kts | 32 ++--- plugins/versioning/build.gradle.kts | 33 ++--- runners/cli/build.gradle.kts | 6 +- runners/gradle-plugin/build.gradle.kts | 17 ++- runners/maven-plugin/build.gradle.kts | 26 ++-- settings.gradle.kts | 101 +++++++------- 43 files changed, 434 insertions(+), 377 deletions(-) create mode 100644 gradle/libs.versions.toml diff --git a/build-logic/build.gradle.kts b/build-logic/build.gradle.kts index 0c054c5cdf..10d9f44320 100644 --- a/build-logic/build.gradle.kts +++ b/build-logic/build.gradle.kts @@ -1,5 +1,3 @@ -import java.util.* - plugins { `kotlin-dsl` } @@ -10,22 +8,8 @@ kotlin { } } -// TODO define versions in Gradle Version Catalog https://github.com/Kotlin/dokka/pull/2884 -val properties = file("../gradle.properties").inputStream().use { - Properties().apply { load(it) } -} - -val kotlinVersion = properties["kotlin_version"] - dependencies { - // Import Gradle Plugins that will be used in the buildSrc pre-compiled script plugins, and any `build.gradle.kts` - // files in the project. - // Use their Maven coordinates (plus versions), not Gradle plugin IDs! - // This should be the only place that Gradle plugin versions are defined, so they are aligned across all build scripts - - implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") - implementation("gradle.plugin.com.github.johnrengelman:shadow:7.1.2") - implementation("org.jetbrains.kotlinx:binary-compatibility-validator:0.12.1") - implementation("io.github.gradle-nexus:publish-plugin:1.1.0") - implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.8.10") + implementation(libs.gradlePlugin.dokka) + implementation(libs.gradlePlugin.kotlin) + implementation(libs.gradlePlugin.shadow) } diff --git a/build-logic/settings.gradle.kts b/build-logic/settings.gradle.kts index 55dfe5c1a3..ed31885b05 100644 --- a/build-logic/settings.gradle.kts +++ b/build-logic/settings.gradle.kts @@ -14,4 +14,10 @@ dependencyResolutionManagement { google() gradlePluginPortal() } + + versionCatalogs { + create("libs") { + from(files("../gradle/libs.versions.toml")) + } + } } diff --git a/build-logic/src/main/kotlin/org/jetbrains/publication.kt b/build-logic/src/main/kotlin/org/jetbrains/publication.kt index 60d91c33ea..32e34dca36 100644 --- a/build-logic/src/main/kotlin/org/jetbrains/publication.kt +++ b/build-logic/src/main/kotlin/org/jetbrains/publication.kt @@ -2,13 +2,9 @@ package org.jetbrains import com.github.jengelman.gradle.plugins.shadow.ShadowExtension import org.gradle.api.Project -import org.gradle.api.plugins.JavaBasePlugin import org.gradle.api.publish.PublishingExtension import org.gradle.api.publish.maven.MavenPublication import org.gradle.api.publish.maven.tasks.PublishToMavenRepository -import org.gradle.api.tasks.TaskContainer -import org.gradle.api.tasks.TaskProvider -import org.gradle.api.tasks.bundling.Jar import org.gradle.kotlin.dsl.* import org.gradle.plugins.signing.SigningExtension import org.jetbrains.DokkaPublicationChannel.* @@ -24,7 +20,10 @@ class DokkaPublicationBuilder { } -fun Project.registerDokkaArtifactPublication(publicationName: String, configure: DokkaPublicationBuilder.() -> Unit) { +fun Project.registerDokkaArtifactPublication( + publicationName: String, + configure: DokkaPublicationBuilder.() -> Unit +) { configure { publications { register(publicationName) { @@ -143,9 +142,10 @@ private fun Project.signPublicationsIfKeyPresent(vararg publications: String) { useInMemoryPgpKeys(signingKey, signingKeyPassphrase) } publications.forEach { publicationName -> - extensions.findByType(PublishingExtension::class)!!.publications.findByName(publicationName)?.let { - sign(it) - } + extensions.getByType() + .publications + .findByName(publicationName) + ?.let { sign(it) } } } } diff --git a/build.gradle.kts b/build.gradle.kts index 76067b7531..5e46c36566 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,12 +1,14 @@ import org.jetbrains.ValidatePublications import org.jetbrains.publicationChannels +@Suppress("DSL_SCOPE_VIOLATION") // fixed in Gradle 8.1 https://github.com/gradle/gradle/pull/23639 plugins { - id("org.jetbrains.conventions.base") apply false - id("org.jetbrains.dokka") version "1.8.10" - id("io.github.gradle-nexus.publish-plugin") version "1.1.0" - id("com.gradle.plugin-publish") version "0.20.0" - id("org.jetbrains.kotlinx.binary-compatibility-validator") version "0.12.1" + id("org.jetbrains.conventions.base") + id("org.jetbrains.conventions.dokka") + + alias(libs.plugins.kotlinx.binaryCompatibilityValidator) + alias(libs.plugins.gradle.pluginPublish) + alias(libs.plugins.nexusPublish) } val dokka_version: String by project diff --git a/core/build.gradle.kts b/core/build.gradle.kts index a59bb0a585..a51e3a62de 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -7,26 +7,22 @@ plugins { } dependencies { - api("org.jetbrains:markdown:0.3.1") + api(libs.jetbrainsMarkdown) implementation(kotlin("reflect")) - val jsoup_version: String by project - implementation("org.jsoup:jsoup:$jsoup_version") + implementation(libs.jsoup) - val jackson_version: String by project - implementation("com.fasterxml.jackson.module:jackson-module-kotlin:$jackson_version") - implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jackson_version") - val jackson_databind_version: String by project + implementation(libs.jackson.kotlin) + implementation(libs.jackson.xml) constraints { - implementation("com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version") { + implementation(libs.jackson.databind) { because("CVE-2022-42003") } } - val coroutines_version: String by project - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version") + implementation(libs.kotlinx.coroutines.core) - testImplementation(project(":core:test-api")) + testImplementation(projects.core.testApi) testImplementation(kotlin("test-junit")) } diff --git a/core/content-matcher-test-utils/build.gradle.kts b/core/content-matcher-test-utils/build.gradle.kts index 4ddba0fba7..75602c64a9 100644 --- a/core/content-matcher-test-utils/build.gradle.kts +++ b/core/content-matcher-test-utils/build.gradle.kts @@ -3,8 +3,8 @@ plugins { } dependencies { - implementation(project(":core:test-api")) - implementation(kotlin("stdlib-jdk8")) + implementation(projects.core.testApi) + implementation(kotlin("reflect")) - implementation("com.willowtreeapps.assertk:assertk-jvm:0.25") + implementation(libs.assertk) } diff --git a/core/test-api/build.gradle.kts b/core/test-api/build.gradle.kts index b913700914..1eb8f00cd6 100644 --- a/core/test-api/build.gradle.kts +++ b/core/test-api/build.gradle.kts @@ -6,10 +6,9 @@ plugins { } dependencies { - api(project(":core")) - implementation(project(":kotlin-analysis")) + api(projects.core) + implementation(projects.kotlinAnalysis) implementation("junit:junit:4.13.2") // TODO: remove dependency to junit - implementation(kotlin("stdlib")) implementation(kotlin("reflect")) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 0000000000..b7ce4e2205 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,123 @@ +[versions] + +## compilation ## +jvm = "11" +kotlin = "1.8.10" +kotlin-languageLevel = "1.4" + + +## libs ## +kotlin-plugin = "213-1.8.10-release-430-IJ6777.52" +kotlinx-coroutines = "1.6.3" +kotlinx-html = "0.7.5" +jsoup = "1.15.3" +idea = "213.6777.52" + +jackson = "2.12.7" # jackson 2.13.X does not support kotlin language version 1.4, check before updating +jacksonDatabind = "2.12.7.1" # fixes CVE-2022-42003 + +freemarker = "2.3.31" + +jetbrainsMarkdown = "0.3.1" + + +apache-maven = "3.5.0" +apache-mavenArtifact = "3.8.5" +apache-mavenArchiver = "2.5" +apache-mavenPluginTools = "3.5.2" + +eclipse-jgit = "5.12.0.202106070339-r" + +## test ## +junit = "5.9.2" + +## gradle plugins ## +gradlePlugin-shadow = "7.1.2" +gradlePlugin-binaryCompatibilityValidator = "0.12.1" +gradlePlugin-nexusPublish = "1.1.0" +gradlePlugin-dokka = "1.7.10" +gradlePlugin-gradlePluginPublish = "0.20.0" +gradlePlugin-gradle = "4.0.1" + +## NPM ## +node = "16.13.0" + +[libraries] + +## Kotlin ## +kotlin-bom = { module = "org.jetbrains.kotlin:kotlin-bom", version.ref = "kotlin" } + +kotlin-compiler = { module = "org.jetbrains.kotlin:kotlin-compiler", version.ref = "kotlin" } +kotlin-idea = { module = "org.jetbrains.kotlin:idea", version.ref = "kotlin" } +kotlin-common = { module = "org.jetbrains.kotlin:common", version.ref = "kotlin" } +kotlin-core = { module = "org.jetbrains.kotlin:core", version.ref = "kotlin" } +kotlin-native = { module = "org.jetbrains.kotlin:native", version.ref = "kotlin" } + +kotlinx-cli = { module = "org.jetbrains.kotlinx:kotlinx-cli", version = "0.3.4" } +kotlinx-html = { module = "org.jetbrains.kotlinx:kotlinx-html", version.ref = "kotlinx-html" } + +kotlinx-coroutines-bom = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-bom", version.ref = "kotlinx-coroutines" } +kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" } + +kotlinPlugin-common = { module = "org.jetbrains.kotlin:common", version.ref = "kotlin.plugin" } +kotlinPlugin-idea = { module = "org.jetbrains.kotlin:idea", version.ref = "kotlin.plugin" } +kotlinPlugin-core = { module = "org.jetbrains.kotlin:core", version.ref = "kotlin.plugin" } +kotlinPlugin-native = { module = "org.jetbrains.kotlin:native", version.ref = "kotlin.plugin" } + +jsoup = { module = "org.jsoup:jsoup", version.ref = "jsoup" } +jetbrainsMarkdown = { module = "org.jetbrains:markdown", version.ref = "jetbrainsMarkdown" } +freemarker = { module = "org.freemarker:freemarker", version.ref = "freemarker" } +soywiz-korte = { module = "com.soywiz.korlibs.korte:korte", version = "2.7.0" } + +jetbrainsIntelliJ-core = { module = "com.jetbrains.intellij.idea:intellij-core", version.ref = "idea" } +jetbrainsIntelliJ-jpsStandalone = { module = "com.jetbrains.intellij.idea:jps-standalone", version.ref = "idea" } + +## Jackson ## +jackson-bom = { module = "com.fasterxml.jackson.module:jackson-module-kotlin", version.ref = "jackson" } +jackson-kotlin = { module = "com.fasterxml.jackson.module:jackson-module-kotlin", version.ref = "jackson" } +jackson-xml = { module = "com.fasterxml.jackson.dataformat:jackson-dataformat-xml", version.ref = "jackson" } + +jackson-databind = { module = "com.fasterxml.jackson.core:jackson-databind", version.ref = "jacksonDatabind" } + + + +## Apache Maven ## +apache-mavenArchiver = { module = "org.apache.maven:maven-archiver", version.ref = "apache-mavenArchiver" } +apache-mavenCore = { module = "org.apache.maven:maven-core", version.ref = "apache-maven" } +apache-mavenPluginAnnotations = { module = "org.apache.maven.plugin-tools:maven-plugin-annotations", version.ref = "apache-mavenPluginTools" } +apache-mavenPluginApi = { module = "org.apache.maven:maven-plugin-api", version.ref = "apache-maven" } +apache-mavenArtifact = { module = "org.apache.maven:maven-artifact", version.ref = "apache-mavenArtifact" } + + +eclipse-jgit = { module = "org.eclipse.jgit:org.eclipse.jgit", version.ref = "eclipse-jgit" } + +## logging ## + + +############# +### test ### +############# + +## junit ## + +## junit ## +junit-bom = { module = "org.junit:junit-bom", version.ref = "junit" } +junit-jupiter = { module = "org.junit.jupiter:junit-jupiter" } + +assertk = { module = "com.willowtreeapps.assertk:assertk", version = "0.25" } + +### Gradle plugins ### +# The Maven coordinates of Gradle plugins that are used as + +gradlePlugin-dokka = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "gradlePlugin-dokka" } +gradlePlugin-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } +gradlePlugin-shadow = { module = "gradle.plugin.com.github.johnrengelman:shadow", version.ref = "gradlePlugin-shadow" } +gradlePlugin-android = { module = "com.android.tools.build:gradle", version.ref = "gradlePlugin-gradle" } + + +[plugins] + +kotlinx-binaryCompatibilityValidator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "gradlePlugin-binaryCompatibilityValidator" } +shadow = { id = "com.github.johnrengelman.shadow", version.ref = "gradlePlugin-shadow" } +gradle-pluginPublish = { id = "com.gradle.plugin-publish", version.ref = "gradlePlugin-gradlePluginPublish" } +nexusPublish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "gradlePlugin-nexusPublish" } diff --git a/integration-tests/build.gradle.kts b/integration-tests/build.gradle.kts index fd1d7746fc..7f3eee421a 100644 --- a/integration-tests/build.gradle.kts +++ b/integration-tests/build.gradle.kts @@ -3,11 +3,8 @@ plugins { } dependencies { - implementation(kotlin("stdlib")) - api(project(":test-utils")) - val coroutines_version: String by project - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version") - val jsoup_version: String by project - implementation("org.jsoup:jsoup:$jsoup_version") - implementation("org.eclipse.jgit:org.eclipse.jgit:5.12.0.202106070339-r") + api(projects.testUtils) + implementation(libs.kotlinx.coroutines.core) + implementation(libs.jsoup) + implementation(libs.eclipse.jgit) } diff --git a/integration-tests/cli/build.gradle.kts b/integration-tests/cli/build.gradle.kts index c0cb46ee04..4e498df140 100644 --- a/integration-tests/cli/build.gradle.kts +++ b/integration-tests/cli/build.gradle.kts @@ -10,9 +10,8 @@ evaluationDependsOn(":runners:cli") evaluationDependsOn(":plugins:base") dependencies { - implementation(kotlin("stdlib")) implementation(kotlin("test-junit")) - implementation(project(":integration-tests")) + implementation(projects.integrationTests) } /* Create a fat base plugin jar for cli tests */ @@ -23,8 +22,8 @@ val basePluginShadow: Configuration by configurations.creating { } dependencies { - basePluginShadow(project(":plugins:base")) - basePluginShadow(project(":kotlin-analysis")) // compileOnly in base plugin + basePluginShadow(projects.plugins.base) + basePluginShadow(projects.kotlinAnalysis) // compileOnly in base plugin } val basePluginShadowJar by tasks.register("basePluginShadowJar", ShadowJar::class) { @@ -41,4 +40,3 @@ tasks.integrationTest { dependsOn(cliJar) dependsOn(basePluginShadowJar) } - diff --git a/integration-tests/gradle/build.gradle.kts b/integration-tests/gradle/build.gradle.kts index f47ef6709e..45c21010bb 100644 --- a/integration-tests/gradle/build.gradle.kts +++ b/integration-tests/gradle/build.gradle.kts @@ -5,13 +5,12 @@ plugins { } dependencies { - implementation(project(":integration-tests")) - implementation(kotlin("stdlib")) + implementation(projects.integrationTests) + implementation(kotlin("test-junit")) implementation(gradleTestKit()) - val jsoup_version: String by project - implementation("org.jsoup:jsoup:$jsoup_version") + implementation(libs.jsoup) } tasks.integrationTest { diff --git a/integration-tests/gradle/projects/it-android-0/build.gradle.kts b/integration-tests/gradle/projects/it-android-0/build.gradle.kts index 799ec22d58..b19b7ebd09 100644 --- a/integration-tests/gradle/projects/it-android-0/build.gradle.kts +++ b/integration-tests/gradle/projects/it-android-0/build.gradle.kts @@ -14,7 +14,5 @@ android { } dependencies { - implementation(kotlin("stdlib")) implementation("androidx.appcompat:appcompat:1.1.0") } - diff --git a/integration-tests/gradle/projects/it-basic/build.gradle.kts b/integration-tests/gradle/projects/it-basic/build.gradle.kts index 44159de062..23f11cbbbf 100644 --- a/integration-tests/gradle/projects/it-basic/build.gradle.kts +++ b/integration-tests/gradle/projects/it-basic/build.gradle.kts @@ -21,7 +21,6 @@ version = "1.8.10-SNAPSHOT" apply(from = "../template.root.gradle.kts") dependencies { - implementation(kotlin("stdlib")) testImplementation(kotlin("test-junit")) } diff --git a/integration-tests/gradle/projects/it-collector-0/moduleA/moduleB/build.gradle.kts b/integration-tests/gradle/projects/it-collector-0/moduleA/moduleB/build.gradle.kts index 9492fdc8ca..9f7e98dec5 100644 --- a/integration-tests/gradle/projects/it-collector-0/moduleA/moduleB/build.gradle.kts +++ b/integration-tests/gradle/projects/it-collector-0/moduleA/moduleB/build.gradle.kts @@ -2,7 +2,3 @@ plugins { kotlin("jvm") id("org.jetbrains.dokka") } - -dependencies { - implementation(kotlin("stdlib")) -} diff --git a/integration-tests/gradle/projects/it-collector-0/moduleA/moduleC/build.gradle.kts b/integration-tests/gradle/projects/it-collector-0/moduleA/moduleC/build.gradle.kts index 9492fdc8ca..9f7e98dec5 100644 --- a/integration-tests/gradle/projects/it-collector-0/moduleA/moduleC/build.gradle.kts +++ b/integration-tests/gradle/projects/it-collector-0/moduleA/moduleC/build.gradle.kts @@ -2,7 +2,3 @@ plugins { kotlin("jvm") id("org.jetbrains.dokka") } - -dependencies { - implementation(kotlin("stdlib")) -} diff --git a/integration-tests/gradle/projects/it-js-ir-0/build.gradle.kts b/integration-tests/gradle/projects/it-js-ir-0/build.gradle.kts index ec366c9d93..31c1af84e1 100644 --- a/integration-tests/gradle/projects/it-js-ir-0/build.gradle.kts +++ b/integration-tests/gradle/projects/it-js-ir-0/build.gradle.kts @@ -13,10 +13,9 @@ kotlin { } dependencies { - implementation(kotlin("stdlib")) implementation(npm("is-sorted", "1.0.5")) val reactVersion = properties["react_version"] implementation("org.jetbrains.kotlin-wrappers:kotlin-react:$reactVersion") implementation("org.jetbrains.kotlin-wrappers:kotlin-react-dom:$reactVersion") -} \ No newline at end of file +} diff --git a/integration-tests/gradle/projects/it-multimodule-0/moduleA/moduleB/build.gradle.kts b/integration-tests/gradle/projects/it-multimodule-0/moduleA/moduleB/build.gradle.kts index 5f0b69c72d..1981701f36 100644 --- a/integration-tests/gradle/projects/it-multimodule-0/moduleA/moduleB/build.gradle.kts +++ b/integration-tests/gradle/projects/it-multimodule-0/moduleA/moduleB/build.gradle.kts @@ -5,10 +5,6 @@ plugins { id("org.jetbrains.dokka") } -dependencies { - implementation(kotlin("stdlib")) -} - tasks.withType().configureEach { moduleName.set("!Module B!") dokkaSourceSets.configureEach { diff --git a/integration-tests/gradle/projects/it-multimodule-0/moduleA/moduleC/build.gradle.kts b/integration-tests/gradle/projects/it-multimodule-0/moduleA/moduleC/build.gradle.kts index e471d37504..728e764d94 100644 --- a/integration-tests/gradle/projects/it-multimodule-0/moduleA/moduleC/build.gradle.kts +++ b/integration-tests/gradle/projects/it-multimodule-0/moduleA/moduleC/build.gradle.kts @@ -5,10 +5,6 @@ plugins { id("org.jetbrains.dokka") } -dependencies { - implementation(kotlin("stdlib")) -} - tasks.withType().configureEach { dokkaSourceSets.configureEach { includes.from("Module.md") diff --git a/integration-tests/gradle/projects/it-multimodule-0/moduleA/moduleD/build.gradle.kts b/integration-tests/gradle/projects/it-multimodule-0/moduleA/moduleD/build.gradle.kts index a16e038f2b..e5edf940f8 100644 --- a/integration-tests/gradle/projects/it-multimodule-0/moduleA/moduleD/build.gradle.kts +++ b/integration-tests/gradle/projects/it-multimodule-0/moduleA/moduleD/build.gradle.kts @@ -4,7 +4,3 @@ plugins { kotlin("jvm") id("org.jetbrains.dokka") } - -dependencies { - implementation(kotlin("stdlib")) -} diff --git a/integration-tests/gradle/projects/it-sequential-tasks-execution-stress/build.gradle.kts b/integration-tests/gradle/projects/it-sequential-tasks-execution-stress/build.gradle.kts index f180628f1d..e84a74a560 100644 --- a/integration-tests/gradle/projects/it-sequential-tasks-execution-stress/build.gradle.kts +++ b/integration-tests/gradle/projects/it-sequential-tasks-execution-stress/build.gradle.kts @@ -18,10 +18,6 @@ buildscript { apply(from = "../template.root.gradle.kts") -dependencies { - implementation(kotlin("stdlib")) -} - fun createTask(name: String) { tasks.register(name, org.jetbrains.dokka.gradle.DokkaTask::class) { dokkaSourceSets { @@ -42,4 +38,3 @@ task("runTasks") { dependsOn ("task_"+i) } } - diff --git a/integration-tests/gradle/projects/serialization/kotlinx-serialization b/integration-tests/gradle/projects/serialization/kotlinx-serialization index daa95c79ff..6333daf8bb 160000 --- a/integration-tests/gradle/projects/serialization/kotlinx-serialization +++ b/integration-tests/gradle/projects/serialization/kotlinx-serialization @@ -1 +1 @@ -Subproject commit daa95c79ffadc0eedbbb4a481a00556b78212e43 +Subproject commit 6333daf8bb4ee7e7c8cd66619c7c66cc8c69dddf diff --git a/integration-tests/maven/build.gradle.kts b/integration-tests/maven/build.gradle.kts index 4b8b60113b..383fcbf3ce 100644 --- a/integration-tests/maven/build.gradle.kts +++ b/integration-tests/maven/build.gradle.kts @@ -8,8 +8,8 @@ plugins { evaluationDependsOn(":runners:maven-plugin") dependencies { - implementation(project(":integration-tests")) - implementation(kotlin("stdlib")) + implementation(projects.integrationTests) + implementation(kotlin("test-junit")) } diff --git a/kotlin-analysis/build.gradle.kts b/kotlin-analysis/build.gradle.kts index 36dc58c4ed..a5908b4ec0 100644 --- a/kotlin-analysis/build.gradle.kts +++ b/kotlin-analysis/build.gradle.kts @@ -7,7 +7,7 @@ plugins { } dependencies { - compileOnly(project(":core")) + compileOnly(projects.core) api(project("intellij-dependency", configuration = "shadow")) api(project("compiler-dependency", configuration = "shadow")) } diff --git a/kotlin-analysis/compiler-dependency/build.gradle.kts b/kotlin-analysis/compiler-dependency/build.gradle.kts index f18b6f493b..5d0a01e09f 100644 --- a/kotlin-analysis/compiler-dependency/build.gradle.kts +++ b/kotlin-analysis/compiler-dependency/build.gradle.kts @@ -8,8 +8,7 @@ plugins { } dependencies { - val kotlin_version: String by project - api("org.jetbrains.kotlin:kotlin-compiler:$kotlin_version") + api(libs.kotlin.compiler) } tasks { diff --git a/kotlin-analysis/intellij-dependency/build.gradle.kts b/kotlin-analysis/intellij-dependency/build.gradle.kts index ad9d74e851..baf47b6f93 100644 --- a/kotlin-analysis/intellij-dependency/build.gradle.kts +++ b/kotlin-analysis/intellij-dependency/build.gradle.kts @@ -35,19 +35,19 @@ fun jpsModel() = zipTree(jpsStandalone.singleFile).matching { } dependencies { - val kotlin_plugin_version: String by project - api("org.jetbrains.kotlin:common:$kotlin_plugin_version") - api("org.jetbrains.kotlin:idea:$kotlin_plugin_version") { +// val kotlin_plugin_version: String = libs.versions.kotlin.plugin.get() + + api(libs.kotlinPlugin.common) + api(libs.kotlinPlugin.idea) { isTransitive = false } - api("org.jetbrains.kotlin:core:$kotlin_plugin_version") - api("org.jetbrains.kotlin:native:$kotlin_plugin_version") + api(libs.kotlinPlugin.core) + api(libs.kotlinPlugin.native) - val idea_version: String by project - intellijCore("com.jetbrains.intellij.idea:intellij-core:$idea_version") + intellijCore(libs.jetbrainsIntelliJ.core) implementation(intellijCoreAnalysis()) - jpsStandalone("com.jetbrains.intellij.idea:jps-standalone:$idea_version") + jpsStandalone(libs.jetbrainsIntelliJ.jpsStandalone) implementation(jpsModel()) } diff --git a/plugins/all-modules-page/build.gradle.kts b/plugins/all-modules-page/build.gradle.kts index ef91b9ee65..1f64893240 100644 --- a/plugins/all-modules-page/build.gradle.kts +++ b/plugins/all-modules-page/build.gradle.kts @@ -10,37 +10,30 @@ registerDokkaArtifactPublication("dokkaAllModulesPage") { } dependencies { - compileOnly(project(":core")) - implementation(kotlin("stdlib-jdk8")) - implementation(kotlin("stdlib")) + compileOnly(projects.core) implementation(kotlin("reflect")) - compileOnly(project(":kotlin-analysis")) - implementation(project(":plugins:base")) - implementation(project(":plugins:templating")) - testImplementation(project(":plugins:base")) - testImplementation(project(":plugins:base:base-test-utils")) - testImplementation(project(":plugins:gfm")) - testImplementation(project(":plugins:gfm:gfm-template-processing")) - testImplementation(project(":core:content-matcher-test-utils")) + compileOnly(projects.kotlinAnalysis) + implementation(projects.plugins.base) + implementation(projects.plugins.templating) + testImplementation(projects.plugins.base) + testImplementation(projects.plugins.base.baseTestUtils) + testImplementation(projects.plugins.gfm) + testImplementation(projects.plugins.gfm.gfmTemplateProcessing) + testImplementation(projects.core.contentMatcherTestUtils) - val coroutines_version: String by project - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version") - val jackson_version: String by project - implementation("com.fasterxml.jackson.module:jackson-module-kotlin:$jackson_version") - val jackson_databind_version: String by project + implementation(libs.kotlinx.coroutines.core) + implementation(libs.jackson.kotlin) constraints { - implementation("com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version") { + implementation(libs.jackson.databind) { because("CVE-2022-42003") } } - val kotlinx_html_version: String by project - implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:$kotlinx_html_version") + implementation(libs.kotlinx.html) + implementation(libs.jsoup) - val jsoup_version: String by project - implementation("org.jsoup:jsoup:$jsoup_version") - - testImplementation(project(":test-utils")) - testImplementation(project(":core:test-api")) - testImplementation("org.junit.jupiter:junit-jupiter:5.6.0") + testImplementation(projects.testUtils) + testImplementation(projects.core.testApi) + testImplementation(platform(libs.junit.bom)) + testImplementation(libs.junit.jupiter) } diff --git a/plugins/android-documentation/build.gradle.kts b/plugins/android-documentation/build.gradle.kts index e0766ab480..9a94a44c97 100644 --- a/plugins/android-documentation/build.gradle.kts +++ b/plugins/android-documentation/build.gradle.kts @@ -6,17 +6,17 @@ plugins { } dependencies { - compileOnly(project(":core")) - implementation(kotlin("stdlib-jdk8")) - implementation(kotlin("stdlib")) + compileOnly(projects.core) + implementation(kotlin("reflect")) + implementation(projects.plugins.base) - implementation(project(":plugins:base")) - testImplementation(project(":plugins:base")) - testImplementation(project(":plugins:base:base-test-utils")) - testImplementation(project(":test-utils")) - testImplementation(project(":core:test-api")) - testImplementation("org.junit.jupiter:junit-jupiter:5.6.0") + testImplementation(projects.plugins.base) + testImplementation(projects.plugins.base.baseTestUtils) + testImplementation(projects.testUtils) + testImplementation(projects.core.testApi) + testImplementation(platform(libs.junit.bom)) + testImplementation(libs.junit.jupiter) } registerDokkaArtifactPublication("androidDocumentationPlugin") { diff --git a/plugins/base/base-test-utils/build.gradle.kts b/plugins/base/base-test-utils/build.gradle.kts index 36ff2011ca..924a96c8ad 100644 --- a/plugins/base/base-test-utils/build.gradle.kts +++ b/plugins/base/base-test-utils/build.gradle.kts @@ -6,20 +6,21 @@ plugins { } dependencies { - compileOnly(project(":core")) - implementation(kotlin("stdlib-jdk8")) - implementation(kotlin("stdlib")) + compileOnly(projects.core) + + implementation(kotlin("reflect")) - compileOnly(project(":plugins:base")) - implementation(project(":core:test-api")) - val jsoup_version: String by project - implementation("org.jsoup:jsoup:$jsoup_version") + compileOnly(projects.plugins.base) + implementation(projects.core.testApi) + + implementation(libs.jsoup) implementation(kotlin("test-junit")) - testImplementation(project(":test-utils")) - testImplementation(project(":core:test-api")) - testImplementation("org.junit.jupiter:junit-jupiter:5.6.0") + testImplementation(projects.testUtils) + testImplementation(projects.core.testApi) + testImplementation(platform(libs.junit.bom)) + testImplementation(libs.junit.jupiter) } registerDokkaArtifactPublication("dokkaBaseTestUtils") { diff --git a/plugins/base/build.gradle.kts b/plugins/base/build.gradle.kts index 2bbfaa8c46..b8e63b1783 100644 --- a/plugins/base/build.gradle.kts +++ b/plugins/base/build.gradle.kts @@ -6,59 +6,55 @@ plugins { } dependencies { - compileOnly(project(":core")) - implementation(kotlin("stdlib-jdk8")) - implementation(kotlin("stdlib")) + compileOnly(projects.core) + implementation(kotlin("reflect")) - val coroutines_version: String by project - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version") + implementation(libs.kotlinx.coroutines.core) - compileOnly(project(":kotlin-analysis")) - val jsoup_version: String by project - implementation("org.jsoup:jsoup:$jsoup_version") + compileOnly(projects.kotlinAnalysis) + implementation(libs.jsoup) - val jackson_version: String by project - implementation("com.fasterxml.jackson.module:jackson-module-kotlin:$jackson_version") - val jackson_databind_version: String by project + implementation(libs.jackson.kotlin) constraints { - implementation("com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version") { + implementation(libs.jackson.databind) { because("CVE-2022-42003") } } - val freemarker_version: String by project - implementation("org.freemarker:freemarker:$freemarker_version") + implementation(libs.freemarker) - testImplementation(project(":plugins:base:base-test-utils")) - testImplementation(project(":core:content-matcher-test-utils")) + testImplementation(projects.plugins.base.baseTestUtils) + testImplementation(projects.core.contentMatcherTestUtils) - val kotlinx_html_version: String by project - implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:$kotlinx_html_version") + implementation(libs.kotlinx.html) - testImplementation(project(":kotlin-analysis")) - testImplementation(project(":test-utils")) - testImplementation(project(":core:test-api")) - testImplementation("org.junit.jupiter:junit-jupiter:5.6.0") + testImplementation(projects.kotlinAnalysis) + testImplementation(projects.testUtils) + testImplementation(projects.core.testApi) + testImplementation(platform(libs.junit.bom)) + testImplementation(libs.junit.jupiter) } val projectDistDir = project(":plugins:base:frontend").file("dist") val generateFrontendFiles = tasks.getByPath(":plugins:base:frontend:generateFrontendFiles") -val copyJsFiles by tasks.registering(Copy::class){ - from(projectDistDir){ +val copyJsFiles by tasks.registering(Copy::class) { + from(projectDistDir) { include("*.js") } dependsOn(generateFrontendFiles) - destinationDir = File(sourceSets.main.get().resources.sourceDirectories.singleFile, "dokka/scripts") + destinationDir = + File(sourceSets.main.get().resources.sourceDirectories.singleFile, "dokka/scripts") } -val copyCssFiles by tasks.registering(Copy::class){ - from(projectDistDir){ +val copyCssFiles by tasks.registering(Copy::class) { + from(projectDistDir) { include("*.css") } dependsOn(generateFrontendFiles) - destinationDir = File(sourceSets.main.get().resources.sourceDirectories.singleFile, "dokka/styles") + destinationDir = + File(sourceSets.main.get().resources.sourceDirectories.singleFile, "dokka/styles") } val copyFrontend by tasks.registering { diff --git a/plugins/base/frontend/build.gradle.kts b/plugins/base/frontend/build.gradle.kts index 9ed576cd07..f837575e9f 100644 --- a/plugins/base/frontend/build.gradle.kts +++ b/plugins/base/frontend/build.gradle.kts @@ -4,7 +4,7 @@ plugins { } node { - version.set("16.13.0") + version.set(libs.versions.node) download.set(true) } diff --git a/plugins/gfm/build.gradle.kts b/plugins/gfm/build.gradle.kts index 8892362b95..6cdadefbe6 100644 --- a/plugins/gfm/build.gradle.kts +++ b/plugins/gfm/build.gradle.kts @@ -6,22 +6,19 @@ plugins { } dependencies { - compileOnly(project(":core")) - implementation(kotlin("stdlib-jdk8")) - implementation(kotlin("stdlib")) + compileOnly(projects.core) implementation(kotlin("reflect")) - implementation(project(":plugins:base")) - testImplementation(project(":plugins:base")) - testImplementation(project(":plugins:base:base-test-utils")) - val jackson_version: String by project - implementation("com.fasterxml.jackson.module:jackson-module-kotlin:$jackson_version") - testImplementation(project(":test-utils")) - testImplementation(project(":core:test-api")) - testImplementation("org.junit.jupiter:junit-jupiter:5.6.0") - - val jackson_databind_version: String by project + implementation(projects.plugins.base) + testImplementation(projects.plugins.base) + testImplementation(projects.plugins.base.baseTestUtils) + implementation(libs.jackson.kotlin) + testImplementation(projects.testUtils) + testImplementation(projects.core.testApi) + testImplementation(platform(libs.junit.bom)) + testImplementation(libs.junit.jupiter) + constraints { - implementation("com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version") { + implementation(libs.jackson.databind) { because("CVE-2022-42003") } } diff --git a/plugins/gfm/gfm-template-processing/build.gradle.kts b/plugins/gfm/gfm-template-processing/build.gradle.kts index 41790b441b..75634ed28b 100644 --- a/plugins/gfm/gfm-template-processing/build.gradle.kts +++ b/plugins/gfm/gfm-template-processing/build.gradle.kts @@ -6,21 +6,20 @@ plugins { } dependencies { - compileOnly(project(":core")) - implementation(kotlin("stdlib-jdk8")) - implementation(kotlin("stdlib")) + compileOnly(projects.core) + implementation(kotlin("reflect")) - implementation(project(":plugins:base")) - implementation(project(":plugins:gfm")) - implementation(project(":plugins:all-modules-page")) - implementation(project(":plugins:templating")) + implementation(projects.plugins.base) + implementation(projects.plugins.gfm) + implementation(projects.plugins.allModulesPage) + implementation(projects.plugins.templating) - val coroutines_version: String by project - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version") + implementation(libs.kotlinx.coroutines.core) - testImplementation(project(":test-utils")) - testImplementation(project(":core:test-api")) - testImplementation("org.junit.jupiter:junit-jupiter:5.6.0") + testImplementation(projects.testUtils) + testImplementation(projects.core.testApi) + testImplementation(platform(libs.junit.bom)) + testImplementation(libs.junit.jupiter) } registerDokkaArtifactPublication("dokkaGfmTemplateProcessing") { diff --git a/plugins/javadoc/build.gradle.kts b/plugins/javadoc/build.gradle.kts index f29207308d..97e3a0467f 100644 --- a/plugins/javadoc/build.gradle.kts +++ b/plugins/javadoc/build.gradle.kts @@ -6,28 +6,25 @@ plugins { } dependencies { - compileOnly(project(":core")) - implementation(kotlin("stdlib-jdk8")) - implementation(kotlin("stdlib")) + compileOnly(projects.core) + compileOnly(projects.kotlinAnalysis) + implementation(kotlin("reflect")) - compileOnly(project(":kotlin-analysis")) - implementation("com.soywiz.korlibs.korte:korte-jvm:2.7.0") - implementation(project(":plugins:base")) - implementation(project(":plugins:kotlin-as-java")) - testImplementation(project(":plugins:base:base-test-utils")) + implementation(libs.soywiz.korte) + implementation(projects.plugins.base) + implementation(projects.plugins.kotlinAsJava) - val kotlinx_html_version: String by project - implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:$kotlinx_html_version") + implementation(libs.kotlinx.html) + implementation(libs.kotlinx.coroutines.core) - val coroutines_version: String by project - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version") + testImplementation(projects.plugins.base.baseTestUtils) + testImplementation(projects.testUtils) + testImplementation(projects.core.testApi) - val jsoup_version: String by project - testImplementation("org.jsoup:jsoup:$jsoup_version") + testImplementation(libs.jsoup) - testImplementation(project(":test-utils")) - testImplementation(project(":core:test-api")) - testImplementation("org.junit.jupiter:junit-jupiter:5.6.0") + testImplementation(platform(libs.junit.bom)) + testImplementation(libs.junit.jupiter) } registerDokkaArtifactPublication("javadocPlugin") { diff --git a/plugins/jekyll/build.gradle.kts b/plugins/jekyll/build.gradle.kts index 1291c56d46..489b5e00c2 100644 --- a/plugins/jekyll/build.gradle.kts +++ b/plugins/jekyll/build.gradle.kts @@ -6,16 +6,15 @@ plugins { } dependencies { - compileOnly(project(":core")) - implementation(kotlin("stdlib-jdk8")) - implementation(kotlin("stdlib")) + compileOnly(projects.core) implementation(kotlin("reflect")) - implementation(project(":plugins:base")) - implementation(project(":plugins:gfm")) + implementation(projects.plugins.base) + implementation(projects.plugins.gfm) - testImplementation(project(":test-utils")) - testImplementation(project(":core:test-api")) - testImplementation("org.junit.jupiter:junit-jupiter:5.6.0") + testImplementation(projects.testUtils) + testImplementation(projects.core.testApi) + testImplementation(platform(libs.junit.bom)) + testImplementation(libs.junit.jupiter) } registerDokkaArtifactPublication("jekyllPlugin") { diff --git a/plugins/jekyll/jekyll-template-processing/build.gradle.kts b/plugins/jekyll/jekyll-template-processing/build.gradle.kts index 6cfb48f246..354c4ee78c 100644 --- a/plugins/jekyll/jekyll-template-processing/build.gradle.kts +++ b/plugins/jekyll/jekyll-template-processing/build.gradle.kts @@ -6,24 +6,22 @@ plugins { } dependencies { - compileOnly(project(":core")) - implementation(kotlin("stdlib-jdk8")) - implementation(kotlin("stdlib")) + compileOnly(projects.core) implementation(kotlin("reflect")) - implementation(project(":plugins:base")) - implementation(project(":plugins:jekyll")) - implementation(project(":plugins:all-modules-page")) - implementation(project(":plugins:templating")) - implementation(project(":plugins:gfm")) - implementation(project(":plugins:gfm:gfm-template-processing")) + implementation(projects.plugins.base) + implementation(projects.plugins.jekyll) + implementation(projects.plugins.allModulesPage) + implementation(projects.plugins.templating) + implementation(projects.plugins.gfm) + implementation(projects.plugins.gfm.gfmTemplateProcessing) - val coroutines_version: String by project - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version") + implementation(libs.kotlinx.coroutines.core) - testImplementation(project(":test-utils")) - testImplementation(project(":core:test-api")) - testImplementation("org.junit.jupiter:junit-jupiter:5.6.0") + testImplementation(projects.testUtils) + testImplementation(projects.core.testApi) + testImplementation(platform(libs.junit.bom)) + testImplementation(libs.junit.jupiter) } registerDokkaArtifactPublication("dokkaJekyllTemplateProcessing") { diff --git a/plugins/kotlin-as-java/build.gradle.kts b/plugins/kotlin-as-java/build.gradle.kts index 979896973f..cfebcfaada 100644 --- a/plugins/kotlin-as-java/build.gradle.kts +++ b/plugins/kotlin-as-java/build.gradle.kts @@ -6,22 +6,20 @@ plugins { } dependencies { - compileOnly(project(":core")) - implementation(kotlin("stdlib-jdk8")) - implementation(kotlin("stdlib")) + compileOnly(projects.core) implementation(kotlin("reflect")) - compileOnly(project(":kotlin-analysis")) - implementation(project(":plugins:base")) - testImplementation(project(":plugins:base")) - testImplementation(project(":plugins:base:base-test-utils")) - testImplementation(project(":core:content-matcher-test-utils")) - val jsoup_version: String by project - testImplementation("org.jsoup:jsoup:$jsoup_version") - testImplementation(project(":kotlin-analysis")) + compileOnly(projects.kotlinAnalysis) + implementation(projects.plugins.base) + testImplementation(projects.plugins.base) + testImplementation(projects.plugins.base.baseTestUtils) + testImplementation(projects.core.contentMatcherTestUtils) + testImplementation(libs.jsoup) + testImplementation(projects.kotlinAnalysis) - testImplementation(project(":test-utils")) - testImplementation(project(":core:test-api")) - testImplementation("org.junit.jupiter:junit-jupiter:5.6.0") + testImplementation(projects.testUtils) + testImplementation(projects.core.testApi) + testImplementation(platform(libs.junit.bom)) + testImplementation(libs.junit.jupiter) } registerDokkaArtifactPublication("kotlinAsJavaPlugin") { diff --git a/plugins/mathjax/build.gradle.kts b/plugins/mathjax/build.gradle.kts index 4219a66bbe..d4e5979a6f 100644 --- a/plugins/mathjax/build.gradle.kts +++ b/plugins/mathjax/build.gradle.kts @@ -6,22 +6,20 @@ plugins { } dependencies { - compileOnly(project(":core")) - implementation(kotlin("stdlib-jdk8")) - implementation(kotlin("stdlib")) + compileOnly(projects.core) implementation(kotlin("reflect")) - implementation(project(":plugins:base")) + implementation(projects.plugins.base) - val jsoup_version: String by project - testImplementation("org.jsoup:jsoup:$jsoup_version") - testImplementation(project(":plugins:base:base-test-utils")) - testImplementation(project(":core:content-matcher-test-utils")) + testImplementation(libs.jsoup) + testImplementation(projects.plugins.base.baseTestUtils) + testImplementation(projects.core.contentMatcherTestUtils) testImplementation(kotlin("test-junit")) - testImplementation(project(":kotlin-analysis")) + testImplementation(projects.kotlinAnalysis) - testImplementation(project(":test-utils")) - testImplementation(project(":core:test-api")) - testImplementation("org.junit.jupiter:junit-jupiter:5.6.0") + testImplementation(projects.testUtils) + testImplementation(projects.core.testApi) + testImplementation(platform(libs.junit.bom)) + testImplementation(libs.junit.jupiter) } registerDokkaArtifactPublication("mathjaxPlugin") { diff --git a/plugins/templating/build.gradle.kts b/plugins/templating/build.gradle.kts index c4d919931f..e4ed093e2c 100644 --- a/plugins/templating/build.gradle.kts +++ b/plugins/templating/build.gradle.kts @@ -10,30 +10,26 @@ registerDokkaArtifactPublication("templating-plugin") { } dependencies { - compileOnly(project(":core")) - implementation(kotlin("stdlib-jdk8")) - implementation(kotlin("stdlib")) + compileOnly(projects.core) + + implementation(kotlin("reflect")) - implementation(project(":plugins:base")) + implementation(projects.plugins.base) - val coroutines_version: String by project - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version") - val jackson_version: String by project - implementation("com.fasterxml.jackson.module:jackson-module-kotlin:$jackson_version") - val jackson_databind_version: String by project + implementation(libs.kotlinx.coroutines.core) + implementation(libs.jackson.kotlin) constraints { - implementation("com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version") { + implementation(libs.jackson.databind) { because("CVE-2022-42003") } } - val kotlinx_html_version: String by project - implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:$kotlinx_html_version") + implementation(libs.kotlinx.html) - val jsoup_version: String by project - implementation("org.jsoup:jsoup:$jsoup_version") - testImplementation(project(":plugins:base:base-test-utils")) + implementation(libs.jsoup) + testImplementation(projects.plugins.base.baseTestUtils) - testImplementation(project(":test-utils")) - testImplementation(project(":core:test-api")) - testImplementation("org.junit.jupiter:junit-jupiter:5.6.0") + testImplementation(projects.testUtils) + testImplementation(projects.core.testApi) + testImplementation(platform(libs.junit.bom)) + testImplementation(libs.junit.jupiter) } diff --git a/plugins/versioning/build.gradle.kts b/plugins/versioning/build.gradle.kts index eafd094fa0..d236342903 100644 --- a/plugins/versioning/build.gradle.kts +++ b/plugins/versioning/build.gradle.kts @@ -10,31 +10,26 @@ registerDokkaArtifactPublication("versioning-plugin") { } dependencies { - compileOnly(project(":core")) - implementation(kotlin("stdlib-jdk8")) - implementation(kotlin("stdlib")) + compileOnly(projects.core) implementation(kotlin("reflect")) - implementation(project(":plugins:base")) - implementation(project(":plugins:templating")) + implementation(projects.plugins.base) + implementation(projects.plugins.templating) + implementation(projects.plugins.templating) - val coroutines_version: String by project - implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version") - val jackson_version: String by project - implementation("com.fasterxml.jackson.module:jackson-module-kotlin:$jackson_version") - val jackson_databind_version: String by project + implementation(libs.kotlinx.coroutines.core) + implementation(libs.jackson.kotlin) constraints { - implementation("com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version") { + implementation(libs.jackson.databind) { because("CVE-2022-42003") } } - val kotlinx_html_version: String by project - implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:$kotlinx_html_version") + implementation(libs.kotlinx.html) - val jsoup_version: String by project - implementation("org.jsoup:jsoup:$jsoup_version") - implementation("org.apache.maven:maven-artifact:3.8.5") + implementation(libs.jsoup) + implementation(libs.apache.mavenArtifact) - testImplementation(project(":test-utils")) - testImplementation(project(":core:test-api")) - testImplementation("org.junit.jupiter:junit-jupiter:5.6.0") + testImplementation(projects.testUtils) + testImplementation(projects.core.testApi) + testImplementation(platform(libs.junit.bom)) + testImplementation(libs.junit.jupiter) } diff --git a/runners/cli/build.gradle.kts b/runners/cli/build.gradle.kts index 5461837ef6..3afd27fcc7 100644 --- a/runners/cli/build.gradle.kts +++ b/runners/cli/build.gradle.kts @@ -8,9 +8,9 @@ plugins { } dependencies { - implementation("org.jetbrains.kotlinx:kotlinx-cli-jvm:0.3.4") - implementation(project(":core")) - implementation(kotlin("stdlib")) + implementation(projects.core) + implementation(libs.kotlinx.cli) + testImplementation(kotlin("test-junit")) } diff --git a/runners/gradle-plugin/build.gradle.kts b/runners/gradle-plugin/build.gradle.kts index 5ce70dcc17..dbddec248f 100644 --- a/runners/gradle-plugin/build.gradle.kts +++ b/runners/gradle-plugin/build.gradle.kts @@ -8,15 +8,14 @@ plugins { } dependencies { - api(project(":core")) - - compileOnly("org.jetbrains.kotlin:kotlin-gradle-plugin") - compileOnly("com.android.tools.build:gradle:4.0.1") - compileOnly(gradleKotlinDsl()) - testImplementation(project(":test-utils")) - testImplementation(gradleKotlinDsl()) - testImplementation("org.jetbrains.kotlin:kotlin-gradle-plugin") - testImplementation("com.android.tools.build:gradle:4.0.1") + implementation(projects.core) + + compileOnly(libs.gradlePlugin.kotlin) + compileOnly(libs.gradlePlugin.android) + + testImplementation(projects.testUtils) + testImplementation(libs.gradlePlugin.kotlin) + testImplementation(libs.gradlePlugin.android) } // Gradle will put its own version of the stdlib in the classpath, so not pull our own we will end up with diff --git a/runners/maven-plugin/build.gradle.kts b/runners/maven-plugin/build.gradle.kts index f8badf8e49..49a1a586fa 100644 --- a/runners/maven-plugin/build.gradle.kts +++ b/runners/maven-plugin/build.gradle.kts @@ -10,12 +10,14 @@ plugins { val setupMaven by tasks.register("setupMaven") dependencies { - implementation(project(":core")) - implementation("org.apache.maven:maven-core:${setupMaven.mavenVersion}") - implementation("org.apache.maven:maven-plugin-api:${setupMaven.mavenVersion}") - implementation("org.apache.maven.plugin-tools:maven-plugin-annotations:${setupMaven.mavenPluginToolsVersion}") - implementation("org.apache.maven:maven-archiver:2.5") - implementation(kotlin("stdlib-jdk8")) + implementation(projects.core) + + implementation(libs.apache.mavenCore) + implementation(libs.apache.mavenPluginApi) + implementation(libs.apache.mavenPluginAnnotations) + implementation(libs.apache.mavenArchiver) + + } val mavenBuildDir = setupMaven.mavenBuildDir @@ -39,7 +41,10 @@ val generatePom by tasks.registering(Copy::class) { eachFile { filter { line -> - line.replace("", "${setupMaven.mavenVersion}") + line.replace( + "", + "${setupMaven.mavenVersion}" + ) } filter { line -> line.replace("dokka_version", "$dokka_version") @@ -76,7 +81,12 @@ val helpMojo by tasks.registering(CrossPlatformExec::class) { val pluginDescriptor by tasks.registering(CrossPlatformExec::class) { dependsOn(setupMaven, generatePom, syncClasses) workingDir(setupMaven.mavenBuildDir) - commandLine(setupMaven.mvn, "-e", "-B", "org.apache.maven.plugins:maven-plugin-plugin:descriptor") + commandLine( + setupMaven.mvn, + "-e", + "-B", + "org.apache.maven.plugins:maven-plugin-plugin:descriptor" + ) outputs.dir(layout.buildDirectory.dir("maven/classes/java/main/META-INF/maven")) } diff --git a/settings.gradle.kts b/settings.gradle.kts index 9794dd1889..82b2093e3c 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,5 +1,58 @@ +@file:Suppress("UnstableApiUsage") + rootProject.name = "dokka" +pluginManagement { + includeBuild("build-logic") + + repositories { + gradlePluginPortal() + mavenCentral() + } +} + +dependencyResolutionManagement { + + // subproject :kotlin-analysis:intellij-dependency requires specific repositories that should not be used in + // the other subprojects, so use PREFER_PROJECT to allow subprojects to override the repositories defined here. + repositoriesMode.set(RepositoriesMode.PREFER_PROJECT) + + repositories { + mavenCentral() + google() + + // Declare the Node.js & Yarn download repositories + // Required by Gradle Node plugin: https://github.com/node-gradle/gradle-node-plugin/blob/3.5.1/docs/faq.md#is-this-plugin-compatible-with-centralized-repositories-declaration + exclusiveContent { + forRepository { + ivy("https://nodejs.org/dist/") { + name = "Node Distributions at $url" + patternLayout { artifact("v[revision]/[artifact](-v[revision]-[classifier]).[ext]") } + metadataSources { artifact() } + content { includeModule("org.nodejs", "node") } + } + } + filter { includeGroup("org.nodejs") } + } + + exclusiveContent { + forRepository { + ivy("https://github.com/yarnpkg/yarn/releases/download") { + name = "Yarn Distributions at $url" + patternLayout { artifact("v[revision]/[artifact](-v[revision]).[ext]") } + metadataSources { artifact() } + content { includeModule("com.yarnpkg", "yarn") } + } + } + filter { includeGroup("com.yarnpkg") } + } + } +} + +plugins { + `gradle-enterprise` +} + include( ":core", ":core:test-api", @@ -39,20 +92,10 @@ include( ":mkdocs", ) -includeBuild("build-logic") val isCiBuild = System.getenv("GITHUB_ACTIONS") != null || System.getenv("TEAMCITY_VERSION") != null -pluginManagement { - repositories { - gradlePluginPortal() - mavenCentral() - } -} -plugins { - `gradle-enterprise` -} gradleEnterprise { buildScan { @@ -62,41 +105,5 @@ gradleEnterprise { } } -@Suppress("UnstableApiUsage") -dependencyResolutionManagement { - - // subproject :kotlin-analysis:intellij-dependency requires specific repositories that should not be used in - // the other subprojects, so use PREFER_PROJECT to allow subprojects to override the repositories defined here. - repositoriesMode.set(RepositoriesMode.PREFER_PROJECT) - - repositories { - mavenCentral() - google() - - // Declare the Node.js & Yarn download repositories - // Required by Gradle Node plugin: https://github.com/node-gradle/gradle-node-plugin/blob/3.5.1/docs/faq.md#is-this-plugin-compatible-with-centralized-repositories-declaration - exclusiveContent { - forRepository { - ivy("https://nodejs.org/dist/") { - name = "Node Distributions at $url" - patternLayout { artifact("v[revision]/[artifact](-v[revision]-[classifier]).[ext]") } - metadataSources { artifact() } - content { includeModule("org.nodejs", "node") } - } - } - filter { includeGroup("org.nodejs") } - } - exclusiveContent { - forRepository { - ivy("https://github.com/yarnpkg/yarn/releases/download") { - name = "Yarn Distributions at $url" - patternLayout { artifact("v[revision]/[artifact](-v[revision]).[ext]") } - metadataSources { artifact() } - content { includeModule("com.yarnpkg", "yarn") } - } - } - filter { includeGroup("com.yarnpkg") } - } - } -} +enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS") From 1ebac4b7b0301ef37f94db16308bb99903a4927a Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Tue, 14 Mar 2023 20:34:50 +0100 Subject: [PATCH 03/11] tidy up libs.versions.toml --- gradle/libs.versions.toml | 54 ++++++++++++++++----------------------- 1 file changed, 22 insertions(+), 32 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b7ce4e2205..6b6f9fac40 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,12 +1,6 @@ [versions] -## compilation ## -jvm = "11" kotlin = "1.8.10" -kotlin-languageLevel = "1.4" - - -## libs ## kotlin-plugin = "213-1.8.10-release-430-IJ6777.52" kotlinx-coroutines = "1.6.3" kotlinx-html = "0.7.5" @@ -20,6 +14,7 @@ freemarker = "2.3.31" jetbrainsMarkdown = "0.3.1" +soywiz-korte = "2.7.0" apache-maven = "3.5.0" apache-mavenArtifact = "3.8.5" @@ -28,10 +23,11 @@ apache-mavenPluginTools = "3.5.2" eclipse-jgit = "5.12.0.202106070339-r" -## test ## +## test dependency versions ## junit = "5.9.2" +assertk = "0.25" -## gradle plugins ## +## Gradle plugins ## gradlePlugin-shadow = "7.1.2" gradlePlugin-binaryCompatibilityValidator = "0.12.1" gradlePlugin-nexusPublish = "1.1.0" @@ -42,9 +38,18 @@ gradlePlugin-gradle = "4.0.1" ## NPM ## node = "16.13.0" + [libraries] -## Kotlin ## +eclipse-jgit = { module = "org.eclipse.jgit:org.eclipse.jgit", version.ref = "eclipse-jgit" } +freemarker = { module = "org.freemarker:freemarker", version.ref = "freemarker" } +jetbrainsIntelliJ-core = { module = "com.jetbrains.intellij.idea:intellij-core", version.ref = "idea" } +jetbrainsIntelliJ-jpsStandalone = { module = "com.jetbrains.intellij.idea:jps-standalone", version.ref = "idea" } +jetbrainsMarkdown = { module = "org.jetbrains:markdown", version.ref = "jetbrainsMarkdown" } +jsoup = { module = "org.jsoup:jsoup", version.ref = "jsoup" } +soywiz-korte = { module = "com.soywiz.korlibs.korte:korte", version.ref = "soywiz-korte" } + +## Kotlin libs ## kotlin-bom = { module = "org.jetbrains.kotlin:kotlin-bom", version.ref = "kotlin" } kotlin-compiler = { module = "org.jetbrains.kotlin:kotlin-compiler", version.ref = "kotlin" } @@ -59,28 +64,18 @@ kotlinx-html = { module = "org.jetbrains.kotlinx:kotlinx-html", version.ref = "k kotlinx-coroutines-bom = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-bom", version.ref = "kotlinx-coroutines" } kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" } +## Kotlin Plugins ## kotlinPlugin-common = { module = "org.jetbrains.kotlin:common", version.ref = "kotlin.plugin" } kotlinPlugin-idea = { module = "org.jetbrains.kotlin:idea", version.ref = "kotlin.plugin" } kotlinPlugin-core = { module = "org.jetbrains.kotlin:core", version.ref = "kotlin.plugin" } kotlinPlugin-native = { module = "org.jetbrains.kotlin:native", version.ref = "kotlin.plugin" } -jsoup = { module = "org.jsoup:jsoup", version.ref = "jsoup" } -jetbrainsMarkdown = { module = "org.jetbrains:markdown", version.ref = "jetbrainsMarkdown" } -freemarker = { module = "org.freemarker:freemarker", version.ref = "freemarker" } -soywiz-korte = { module = "com.soywiz.korlibs.korte:korte", version = "2.7.0" } - -jetbrainsIntelliJ-core = { module = "com.jetbrains.intellij.idea:intellij-core", version.ref = "idea" } -jetbrainsIntelliJ-jpsStandalone = { module = "com.jetbrains.intellij.idea:jps-standalone", version.ref = "idea" } - ## Jackson ## jackson-bom = { module = "com.fasterxml.jackson.module:jackson-module-kotlin", version.ref = "jackson" } jackson-kotlin = { module = "com.fasterxml.jackson.module:jackson-module-kotlin", version.ref = "jackson" } jackson-xml = { module = "com.fasterxml.jackson.dataformat:jackson-dataformat-xml", version.ref = "jackson" } - jackson-databind = { module = "com.fasterxml.jackson.core:jackson-databind", version.ref = "jacksonDatabind" } - - ## Apache Maven ## apache-mavenArchiver = { module = "org.apache.maven:maven-archiver", version.ref = "apache-mavenArchiver" } apache-mavenCore = { module = "org.apache.maven:maven-core", version.ref = "apache-maven" } @@ -89,25 +84,17 @@ apache-mavenPluginApi = { module = "org.apache.maven:maven-plugin-api", version. apache-mavenArtifact = { module = "org.apache.maven:maven-artifact", version.ref = "apache-mavenArtifact" } -eclipse-jgit = { module = "org.eclipse.jgit:org.eclipse.jgit", version.ref = "eclipse-jgit" } - -## logging ## - - -############# -### test ### -############# +#### test dependencies #### -## junit ## +assertk = { module = "com.willowtreeapps.assertk:assertk", version.ref = "assertk" } ## junit ## junit-bom = { module = "org.junit:junit-bom", version.ref = "junit" } junit-jupiter = { module = "org.junit.jupiter:junit-jupiter" } -assertk = { module = "com.willowtreeapps.assertk:assertk", version = "0.25" } -### Gradle plugins ### -# The Maven coordinates of Gradle plugins that are used as +#### Gradle plugins dependencies #### +# The Maven coordinates of Gradle plugins that are either used in convention plugins, or in Dokka subprojects gradlePlugin-dokka = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "gradlePlugin-dokka" } gradlePlugin-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" } @@ -116,6 +103,9 @@ gradlePlugin-android = { module = "com.android.tools.build:gradle", version.ref [plugins] +# Gradle Plugins that are applied directly to subprojects +# (Before defining plugins here, first consider creating convention plugins instead, +# and define the Maven coordinates above to be used in build-logic/build.gradle.kts) kotlinx-binaryCompatibilityValidator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "gradlePlugin-binaryCompatibilityValidator" } shadow = { id = "com.github.johnrengelman.shadow", version.ref = "gradlePlugin-shadow" } From bf3af3a2620757922244a25910aaaa73a9e41704 Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Tue, 14 Mar 2023 20:41:21 +0100 Subject: [PATCH 04/11] tidy up versioning example --- .../parentProject/childProjectA/build.gradle.kts | 4 +--- .../parentProject/childProjectB/build.gradle.kts | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/examples/gradle/dokka-versioning-multimodule-example/parentProject/childProjectA/build.gradle.kts b/examples/gradle/dokka-versioning-multimodule-example/parentProject/childProjectA/build.gradle.kts index 2e3ca6ab49..bf1513f894 100644 --- a/examples/gradle/dokka-versioning-multimodule-example/parentProject/childProjectA/build.gradle.kts +++ b/examples/gradle/dokka-versioning-multimodule-example/parentProject/childProjectA/build.gradle.kts @@ -1,3 +1 @@ -dependencies { - -} +// intentionally empty - build config is set in the root build.gradle.kts diff --git a/examples/gradle/dokka-versioning-multimodule-example/parentProject/childProjectB/build.gradle.kts b/examples/gradle/dokka-versioning-multimodule-example/parentProject/childProjectB/build.gradle.kts index 2e3ca6ab49..bf1513f894 100644 --- a/examples/gradle/dokka-versioning-multimodule-example/parentProject/childProjectB/build.gradle.kts +++ b/examples/gradle/dokka-versioning-multimodule-example/parentProject/childProjectB/build.gradle.kts @@ -1,3 +1 @@ -dependencies { - -} +// intentionally empty - build config is set in the root build.gradle.kts From 6ba58c61b1d718734f9f68a15d7e4b0263c4950e Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Tue, 14 Mar 2023 20:44:32 +0100 Subject: [PATCH 05/11] remove versions from gradle.properties --- gradle.properties | 12 ------------ kotlin-analysis/intellij-dependency/build.gradle.kts | 2 -- 2 files changed, 14 deletions(-) diff --git a/gradle.properties b/gradle.properties index a8eb1eff42..67b76a66bb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,19 +1,7 @@ # Project Settings dokka_version=1.8.20-SNAPSHOT dokka_integration_test_parallelism=2 -# Versions -kotlin_version=1.8.10 -coroutines_version=1.6.3 -kotlinx_html_version=0.7.5 -kotlin_plugin_version=213-1.8.10-release-430-IJ6777.52 -jsoup_version=1.15.3 -idea_version=213.6777.52 language_version=1.4 -# jackson 2.13.X does not support kotlin language version 1.4, check before updating -jackson_version=2.12.7 -# fixes CVE-2022-42003 -jackson_databind_version=2.12.7.1 -freemarker_version=2.3.31 # Code style kotlin.code.style=official # Gradle settings diff --git a/kotlin-analysis/intellij-dependency/build.gradle.kts b/kotlin-analysis/intellij-dependency/build.gradle.kts index baf47b6f93..e715ac3d3e 100644 --- a/kotlin-analysis/intellij-dependency/build.gradle.kts +++ b/kotlin-analysis/intellij-dependency/build.gradle.kts @@ -35,8 +35,6 @@ fun jpsModel() = zipTree(jpsStandalone.singleFile).matching { } dependencies { -// val kotlin_plugin_version: String = libs.versions.kotlin.plugin.get() - api(libs.kotlinPlugin.common) api(libs.kotlinPlugin.idea) { isTransitive = false From 37937d4315621b2ac69f637878e80e6328edf40e Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Thu, 16 Mar 2023 12:44:46 +0100 Subject: [PATCH 06/11] suppress unstable Configuration.invoke() + dependency catalog (this code will probably be refactored later in https://github.com/Kotlin/dokka/issues/2889) --- kotlin-analysis/intellij-dependency/build.gradle.kts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kotlin-analysis/intellij-dependency/build.gradle.kts b/kotlin-analysis/intellij-dependency/build.gradle.kts index e715ac3d3e..b4e46030c2 100644 --- a/kotlin-analysis/intellij-dependency/build.gradle.kts +++ b/kotlin-analysis/intellij-dependency/build.gradle.kts @@ -42,9 +42,11 @@ dependencies { api(libs.kotlinPlugin.core) api(libs.kotlinPlugin.native) + @Suppress("UnstableApiUsage") intellijCore(libs.jetbrainsIntelliJ.core) implementation(intellijCoreAnalysis()) + @Suppress("UnstableApiUsage") jpsStandalone(libs.jetbrainsIntelliJ.jpsStandalone) implementation(jpsModel()) } From 865ceb15b4f99f9b16bd6d9a4f6338efa4a73aed Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Thu, 16 Mar 2023 12:59:00 +0100 Subject: [PATCH 07/11] refactor maven-cli-setup.gradle.kts - re-use Maven versions from version-catalog - update naming to be more consistent --- build-logic/build.gradle.kts | 4 ++++ .../conventions/maven-cli-setup.gradle.kts | 18 +++++++------- .../internal/gradleKotlinDslAccessors.kt | 24 +++++++++++++++++++ integration-tests/maven/build.gradle.kts | 2 +- runners/maven-plugin/build.gradle.kts | 19 +++++++-------- 5 files changed, 47 insertions(+), 20 deletions(-) create mode 100644 build-logic/src/main/kotlin/org/jetbrains/internal/gradleKotlinDslAccessors.kt diff --git a/build-logic/build.gradle.kts b/build-logic/build.gradle.kts index 10d9f44320..5272534d20 100644 --- a/build-logic/build.gradle.kts +++ b/build-logic/build.gradle.kts @@ -12,4 +12,8 @@ dependencies { implementation(libs.gradlePlugin.dokka) implementation(libs.gradlePlugin.kotlin) implementation(libs.gradlePlugin.shadow) + + // workaround for accessing version-catalog in convention plugins + // https://github.com/gradle/gradle/issues/15383#issuecomment-779893192 + implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location)) } diff --git a/build-logic/src/main/kotlin/org/jetbrains/conventions/maven-cli-setup.gradle.kts b/build-logic/src/main/kotlin/org/jetbrains/conventions/maven-cli-setup.gradle.kts index ec59da7bfa..4beeab2143 100644 --- a/build-logic/src/main/kotlin/org/jetbrains/conventions/maven-cli-setup.gradle.kts +++ b/build-logic/src/main/kotlin/org/jetbrains/conventions/maven-cli-setup.gradle.kts @@ -15,7 +15,7 @@ plugins { base } -abstract class SetupMavenProperties { +abstract class MavenCliSetupExtension { abstract val mavenVersion: Property abstract val mavenPluginToolsVersion: Property abstract val mavenBuildDir: DirectoryProperty @@ -34,10 +34,10 @@ abstract class SetupMavenProperties { abstract val mvn: RegularFileProperty } -val setupMavenProperties = - extensions.create("setupMavenProperties", SetupMavenProperties::class).apply { - mavenVersion.convention(providers.gradleProperty("mavenVersion")) - mavenPluginToolsVersion.convention(providers.gradleProperty("mavenPluginToolsVersion")) +val mavenCliSetupExtension = + extensions.create("mavenCliSetup", MavenCliSetupExtension::class).apply { + mavenVersion.convention(libs.versions.apache.maven) + mavenPluginToolsVersion.convention(libs.versions.apache.mavenPluginTools) mavenBuildDir.convention(layout.buildDirectory.dir("maven")) mavenInstallDir.convention(layout.buildDirectory.dir("apache-maven")) @@ -64,7 +64,7 @@ val mavenBinary by configurations.registering { isVisible = false defaultDependencies { - addLater(setupMavenProperties.mavenVersion.map { mavenVersion -> + addLater(mavenCliSetupExtension.mavenVersion.map { mavenVersion -> project.dependencies.create( group = "org.apache.maven", name = "apache-maven", @@ -77,8 +77,8 @@ val mavenBinary by configurations.registering { } tasks.clean { - delete(setupMavenProperties.mavenBuildDir) - delete(setupMavenProperties.mavenInstallDir) + delete(mavenCliSetupExtension.mavenBuildDir) + delete(mavenCliSetupExtension.mavenInstallDir) } val installMavenBinary by tasks.registering(Sync::class) { @@ -99,5 +99,5 @@ val installMavenBinary by tasks.registering(Sync::class) { } includeEmptyDirs = false } - into(setupMavenProperties.mavenInstallDir) + into(mavenCliSetupExtension.mavenInstallDir) } diff --git a/build-logic/src/main/kotlin/org/jetbrains/internal/gradleKotlinDslAccessors.kt b/build-logic/src/main/kotlin/org/jetbrains/internal/gradleKotlinDslAccessors.kt new file mode 100644 index 0000000000..fff553d32f --- /dev/null +++ b/build-logic/src/main/kotlin/org/jetbrains/internal/gradleKotlinDslAccessors.kt @@ -0,0 +1,24 @@ +@file:Suppress("PackageDirectoryMismatch") + +package org.gradle.kotlin.dsl // for convenience use a default package for gradle.kts scripts + +import org.gradle.api.Project +import org.gradle.accessors.dm.LibrariesForLibs + +/* + * Utility functions for accessing Gradle extensions that are created by convention plugins. + * + * (Gradle can't generate the nice DSL accessors for the project that defines them) + * + * These functions are not needed outside the convention plugins project and should be marked as + * `internal` + */ + + +/** + * workaround for accessing version-catalog in convention plugins + * + * See https://github.com/gradle/gradle/issues/15383#issuecomment-779893192 + */ +internal val Project.libs : LibrariesForLibs + get() = extensions.getByType() diff --git a/integration-tests/maven/build.gradle.kts b/integration-tests/maven/build.gradle.kts index aeb15ea051..99a98649c2 100644 --- a/integration-tests/maven/build.gradle.kts +++ b/integration-tests/maven/build.gradle.kts @@ -15,7 +15,7 @@ tasks.integrationTest { dependsOnMavenLocalPublication() dependsOn(tasks.installMavenBinary) - val mvn = setupMavenProperties.mvn + val mvn = mavenCliSetup.mvn inputs.file(mvn) val dokka_version: String by project diff --git a/runners/maven-plugin/build.gradle.kts b/runners/maven-plugin/build.gradle.kts index 32cb30cfaf..d91b888933 100644 --- a/runners/maven-plugin/build.gradle.kts +++ b/runners/maven-plugin/build.gradle.kts @@ -27,9 +27,8 @@ val generatePom by tasks.registering(Sync::class) { val pomTemplateFile = layout.projectDirectory.file("pom.template.xml") - val mavenVersion = setupMavenProperties.mavenVersion.get() - val mavenPluginToolsVersion = setupMavenProperties.mavenPluginToolsVersion.get( - ) + val mavenVersion = mavenCliSetup.mavenVersion.orNull + val mavenPluginToolsVersion = mavenCliSetup.mavenPluginToolsVersion.orNull from(pomTemplateFile) { rename { it.replace(".template.xml", ".xml") } @@ -53,7 +52,7 @@ val prepareMavenPluginBuildDir by tasks.registering(Sync::class) { from(generatePom) - into(setupMavenProperties.mavenBuildDir) + into(mavenCliSetup.mavenBuildDir) } val helpMojo by tasks.registering(Exec::class) { @@ -61,11 +60,11 @@ val helpMojo by tasks.registering(Exec::class) { dependsOn(tasks.installMavenBinary, prepareMavenPluginBuildDir) - workingDir(setupMavenProperties.mavenBuildDir) - executable(setupMavenProperties.mvn.get()) + workingDir(mavenCliSetup.mavenBuildDir) + executable(mavenCliSetup.mvn.get()) args("-e", "-B", "org.apache.maven.plugins:maven-plugin-plugin:helpmojo") - outputs.dir(setupMavenProperties.mavenBuildDir) + outputs.dir(mavenCliSetup.mavenBuildDir) doLast("normalize maven-plugin-help.properties") { // The maven-plugin-help.properties file contains a timestamp by default. @@ -90,8 +89,8 @@ val pluginDescriptor by tasks.registering(Exec::class) { dependsOn(tasks.installMavenBinary, prepareMavenPluginBuildDir) - workingDir(setupMavenProperties.mavenBuildDir) - executable(setupMavenProperties.mvn.get()) + workingDir(mavenCliSetup.mavenBuildDir) + executable(mavenCliSetup.mvn.get()) args( "-e", "-B", @@ -104,7 +103,7 @@ val pluginDescriptor by tasks.registering(Exec::class) { tasks.jar { dependsOn(pluginDescriptor, helpMojo) metaInf { - from(setupMavenProperties.mavenBuildDir.map { it.dir("classes/java/main/META-INF") }) + from(mavenCliSetup.mavenBuildDir.map { it.dir("classes/java/main/META-INF") }) } manifest { attributes("Class-Path" to configurations.runtimeClasspath.map { configuration -> From b087a7d98703d45fe6e21dda48c28747571b688c Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Thu, 16 Mar 2023 13:00:44 +0100 Subject: [PATCH 08/11] fix api/implementation dependency on :core in gradle plugin --- runners/gradle-plugin/build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runners/gradle-plugin/build.gradle.kts b/runners/gradle-plugin/build.gradle.kts index dbddec248f..51645992f5 100644 --- a/runners/gradle-plugin/build.gradle.kts +++ b/runners/gradle-plugin/build.gradle.kts @@ -8,7 +8,7 @@ plugins { } dependencies { - implementation(projects.core) + api(projects.core) compileOnly(libs.gradlePlugin.kotlin) compileOnly(libs.gradlePlugin.android) From f4c3b29c031e6d937172282c0a82d49a1a191b1c Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Thu, 16 Mar 2023 13:23:04 +0100 Subject: [PATCH 09/11] revert kxs submodule version --- .../gradle/projects/serialization/kotlinx-serialization | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integration-tests/gradle/projects/serialization/kotlinx-serialization b/integration-tests/gradle/projects/serialization/kotlinx-serialization index 6333daf8bb..daa95c79ff 160000 --- a/integration-tests/gradle/projects/serialization/kotlinx-serialization +++ b/integration-tests/gradle/projects/serialization/kotlinx-serialization @@ -1 +1 @@ -Subproject commit 6333daf8bb4ee7e7c8cd66619c7c66cc8c69dddf +Subproject commit daa95c79ffadc0eedbbb4a481a00556b78212e43 From 0e2f177ad81a241660785edcccce4ee208657197 Mon Sep 17 00:00:00 2001 From: aSemy <897017+aSemy@users.noreply.github.com> Date: Thu, 16 Mar 2023 17:31:17 +0100 Subject: [PATCH 10/11] add -jvm suffix to dependencies helps with compatibility with older Kotlin versions, probably not needed once support for Kotlin 1.4 is dropped Co-authored-by: Ignat Beresnev --- gradle/libs.versions.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 6b6f9fac40..36e0c8a86a 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -47,7 +47,7 @@ jetbrainsIntelliJ-core = { module = "com.jetbrains.intellij.idea:intellij-core", jetbrainsIntelliJ-jpsStandalone = { module = "com.jetbrains.intellij.idea:jps-standalone", version.ref = "idea" } jetbrainsMarkdown = { module = "org.jetbrains:markdown", version.ref = "jetbrainsMarkdown" } jsoup = { module = "org.jsoup:jsoup", version.ref = "jsoup" } -soywiz-korte = { module = "com.soywiz.korlibs.korte:korte", version.ref = "soywiz-korte" } +soywiz-korte = { module = "com.soywiz.korlibs.korte:korte-jvm", version.ref = "soywiz-korte" } ## Kotlin libs ## kotlin-bom = { module = "org.jetbrains.kotlin:kotlin-bom", version.ref = "kotlin" } @@ -58,8 +58,8 @@ kotlin-common = { module = "org.jetbrains.kotlin:common", version.ref = "kotlin" kotlin-core = { module = "org.jetbrains.kotlin:core", version.ref = "kotlin" } kotlin-native = { module = "org.jetbrains.kotlin:native", version.ref = "kotlin" } -kotlinx-cli = { module = "org.jetbrains.kotlinx:kotlinx-cli", version = "0.3.4" } -kotlinx-html = { module = "org.jetbrains.kotlinx:kotlinx-html", version.ref = "kotlinx-html" } +kotlinx-cli = { module = "org.jetbrains.kotlinx:kotlinx-cli-jvm", version = "0.3.4" } +kotlinx-html = { module = "org.jetbrains.kotlinx:kotlinx-html-jvm", version.ref = "kotlinx-html" } kotlinx-coroutines-bom = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-bom", version.ref = "kotlinx-coroutines" } kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" } From 5717321032d018511e19468f49cac25d5e65f355 Mon Sep 17 00:00:00 2001 From: Adam <897017+aSemy@users.noreply.github.com> Date: Thu, 16 Mar 2023 17:45:09 +0100 Subject: [PATCH 11/11] move kotlinx-cli version to a separate version --- gradle/libs.versions.toml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 36e0c8a86a..0587660f20 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -4,16 +4,18 @@ kotlin = "1.8.10" kotlin-plugin = "213-1.8.10-release-430-IJ6777.52" kotlinx-coroutines = "1.6.3" kotlinx-html = "0.7.5" -jsoup = "1.15.3" +kotlinx-cli = "0.3.4" + idea = "213.6777.52" +jetbrainsMarkdown = "0.3.1" + +jsoup = "1.15.3" jackson = "2.12.7" # jackson 2.13.X does not support kotlin language version 1.4, check before updating jacksonDatabind = "2.12.7.1" # fixes CVE-2022-42003 freemarker = "2.3.31" -jetbrainsMarkdown = "0.3.1" - soywiz-korte = "2.7.0" apache-maven = "3.5.0" @@ -58,7 +60,7 @@ kotlin-common = { module = "org.jetbrains.kotlin:common", version.ref = "kotlin" kotlin-core = { module = "org.jetbrains.kotlin:core", version.ref = "kotlin" } kotlin-native = { module = "org.jetbrains.kotlin:native", version.ref = "kotlin" } -kotlinx-cli = { module = "org.jetbrains.kotlinx:kotlinx-cli-jvm", version = "0.3.4" } +kotlinx-cli = { module = "org.jetbrains.kotlinx:kotlinx-cli-jvm", version.ref = "kotlinx-cli" } kotlinx-html = { module = "org.jetbrains.kotlinx:kotlinx-html-jvm", version.ref = "kotlinx-html" } kotlinx-coroutines-bom = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-bom", version.ref = "kotlinx-coroutines" }