Skip to content

Commit

Permalink
centralise versions in Gradle Version Catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
aSemy committed Feb 22, 2023
1 parent 4d8649d commit d59d0eb
Show file tree
Hide file tree
Showing 22 changed files with 186 additions and 116 deletions.
26 changes: 6 additions & 20 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,31 +1,17 @@
import java.util.*

plugins {
`kotlin-dsl`
}

repositories {
gradlePluginPortal()
}

// TODO define versions in Gradle Version Catalog
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("com.github.jengelman.gradle.plugins:shadow:2.0.4")
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.7.10")
implementation("com.gradle.publish:plugin-publish-plugin:0.20.0")
implementation(libs.gradlePlugin.kotlin)
implementation(libs.gradlePlugin.shadow)
implementation(libs.gradlePlugin.binaryCompatibilityValidator)
implementation(libs.gradlePlugin.nexusPublish)
implementation(libs.gradlePlugin.dokka)
implementation(libs.gradlePlugin.gradlePluginPublish)
}
23 changes: 23 additions & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1 +1,24 @@
rootProject.name = "buildSrc"

pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
}
}

@Suppress("UnstableApiUsage")
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.PREFER_SETTINGS)

repositories {
mavenCentral()
gradlePluginPortal()
}

versionCatalogs {
create("libs") {
from(files("../gradle/libs.versions.toml"))
}
}
}
16 changes: 6 additions & 10 deletions core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,20 @@ 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.kotlinxCoroutines.core)

testImplementation(project(":core:test-api"))
testImplementation(kotlin("test-junit"))
Expand Down
12 changes: 0 additions & 12 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,19 +1,7 @@
# Project Settings
dokka_version=1.8.0-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
Expand Down
86 changes: 86 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
[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"

## test ##
junit = "5.9.2"

## infra ##

## 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"

[libraries]
#kotlin-compiler = { module = "", version.ref = "" }

## 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" }

kotlinxCoroutines-bom = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-bom", version.ref = "kotlinx-coroutines" }
kotlinxCoroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines" }

kotlinxHtml = { module = "org.jetbrains.kotlinx:kotlinx-html", version.ref = "kotlinx-html" }
jsoup = { module = "org.jsoup:jsoup", version.ref = "jsoup" }
jetbrainsMarkdown = { module = "org.jetbrains:markdown", version.ref = "jetbrainsMarkdown" }
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" }

## 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" }

## logging ##

#############
### test ###
#############

## junit ##

## junit ##
junit-bom = { group = "org.junit", name = "junit-bom", version.ref = "junit" }
junit-jupiter = { group = "org.junit.jupiter", name = "junit-jupiter" }

################
### plugins ###
################

gradlePlugin-binaryCompatibilityValidator = { module = "org.jetbrains.kotlinx:binary-compatibility-validator", version.ref = "gradlePlugin-binaryCompatibilityValidator" }
gradlePlugin-dokka = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "gradlePlugin-dokka" }
gradlePlugin-gradlePluginPublish = { module = "com.gradle.publish:plugin-publish-plugin", version.ref = "gradlePlugin-gradlePluginPublish" }
gradlePlugin-kotlin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin" }
gradlePlugin-nexusPublish = { module = "io.github.gradle-nexus:publish-plugin", version.ref = "gradlePlugin-nexusPublish" }
gradlePlugin-shadow = { module = "gradle.plugin.com.github.johnrengelman:shadow", version.ref = "gradlePlugin-shadow" }
4 changes: 2 additions & 2 deletions integration-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ dependencies {
implementation(kotlin("stdlib"))
api(project(":test-utils"))
val coroutines_version: String by project
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")
implementation(libs.kotlinxCoroutines.core)
val jsoup_version: String by project
implementation("org.jsoup:jsoup:$jsoup_version")
implementation(libs.jsoup)
implementation("org.eclipse.jgit:org.eclipse.jgit:5.12.0.202106070339-r")
}
2 changes: 1 addition & 1 deletion integration-tests/gradle/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies {
implementation(gradleTestKit())

val jsoup_version: String by project
implementation("org.jsoup:jsoup:$jsoup_version")
implementation(libs.jsoup)
}

tasks.integrationTest {
Expand Down
3 changes: 1 addition & 2 deletions kotlin-analysis/compiler-dependency/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions kotlin-analysis/intellij-dependency/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ fun jpsModel() = zipTree(jpsStandalone.singleFile).matching {
}

dependencies {
val kotlin_plugin_version: String by project
val kotlin_plugin_version: String = libs.versions.kotlin.plugin.get()

api("org.jetbrains.kotlin:common:$kotlin_plugin_version")
api("org.jetbrains.kotlin:idea:$kotlin_plugin_version") {
isTransitive = false
}
api("org.jetbrains.kotlin:core:$kotlin_plugin_version")
api("org.jetbrains.kotlin:native:$kotlin_plugin_version")

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())
}

Expand Down
19 changes: 7 additions & 12 deletions plugins/all-modules-page/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,23 +24,18 @@ dependencies {
testImplementation(project(":plugins:gfm:gfm-template-processing"))
testImplementation(project(":core:content-matcher-test-utils"))

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.kotlinxCoroutines.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")

val jsoup_version: String by project
implementation("org.jsoup:jsoup:$jsoup_version")
implementation(libs.kotlinxHtml)
implementation(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)
}
3 changes: 2 additions & 1 deletion plugins/android-documentation/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ dependencies {
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(platform(libs.junit.bom))
testImplementation(libs.junit.jupiter)
}

registerDokkaArtifactPublication("androidDocumentationPlugin") {
Expand Down
5 changes: 3 additions & 2 deletions plugins/base/base-test-utils/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ dependencies {
compileOnly(project(":plugins:base"))
implementation(project(":core:test-api"))
val jsoup_version: String by project
implementation("org.jsoup:jsoup:$jsoup_version")
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(platform(libs.junit.bom))
testImplementation(libs.junit.jupiter)
}

registerDokkaArtifactPublication("dokkaBaseTestUtils") {
Expand Down
20 changes: 8 additions & 12 deletions plugins/base/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,35 +11,31 @@ dependencies {
implementation(kotlin("stdlib"))
implementation(kotlin("reflect"))

val coroutines_version: String by project
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")
implementation(libs.kotlinxCoroutines.core)

compileOnly(project(":kotlin-analysis"))
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(libs.jackson.kotlin)
val jackson_databind_version: String by project
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"))

val kotlinx_html_version: String by project
implementation("org.jetbrains.kotlinx:kotlinx-html-jvm:$kotlinx_html_version")
implementation(libs.kotlinxHtml)

testImplementation(project(":kotlin-analysis"))
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)
}

val projectDistDir = project(":plugins:base:frontend").file("dist")
Expand Down
9 changes: 4 additions & 5 deletions plugins/gfm/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ dependencies {
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")
implementation(libs.jackson.kotlin)
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)

val jackson_databind_version: String by project
constraints {
implementation("com.fasterxml.jackson.core:jackson-databind:$jackson_databind_version") {
implementation(libs.jackson.databind) {
because("CVE-2022-42003")
}
}
Expand Down
6 changes: 3 additions & 3 deletions plugins/gfm/gfm-template-processing/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ dependencies {
implementation(project(":plugins:all-modules-page"))
implementation(project(":plugins:templating"))

val coroutines_version: String by project
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutines_version")
implementation(libs.kotlinxCoroutines.core)

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("dokkaGfmTemplateProcessing") {
Expand Down
Loading

0 comments on commit d59d0eb

Please sign in to comment.