Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

build config: Use buildSrc convention plugins to configure the Dokka subprojects #2704

Merged
merged 65 commits into from
Mar 7, 2023
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
3f77497
try setting up buildSrc convention plugins
aSemy Oct 11, 2022
b591e34
finish creating buildSrc plugins
aSemy Oct 13, 2022
16657a2
Merge remote-tracking branch 'origin/master' into feat/buildsrc_conve…
aSemy Oct 13, 2022
a8abe34
create MavenProjectLocal helper
aSemy Oct 13, 2022
2dd31cf
dokka-gradle-plugin: warn on duplicate resources
aSemy Oct 13, 2022
58bc1c8
dokka-gradle-plugin: fix kotlin-dsl compatibility
aSemy Oct 13, 2022
89a504f
disable empty subproject :plugins:base:search-component
aSemy Oct 13, 2022
7a1a430
formatting
aSemy Oct 13, 2022
968a123
re-add dependencies that were in :dokka:plugins subproject {} block
aSemy Oct 13, 2022
63a7da4
re-add project(":integration-tests") dependency to integration-tests …
aSemy Oct 13, 2022
766af55
fix dokka-integration-test integrationTest configurations
aSemy Oct 13, 2022
770a27b
replace println with logger.lifecycle
aSemy Oct 18, 2022
ae0f4e1
update description for base plugin (else it provides a default descri…
aSemy Oct 18, 2022
bba37c7
rm commented out code
aSemy Oct 18, 2022
549c11c
update test code after applying kotlin-dsl plugin
aSemy Oct 18, 2022
9bfedff
tidy up gradle-plugin build.gradle.kts
aSemy Oct 18, 2022
54e68e3
add repositoriesMode
aSemy Oct 18, 2022
a1cfab1
move repositories to settings.gradle.kts
aSemy Oct 18, 2022
d2e05d0
Declare the Node.js & Yarn download repositories
aSemy Oct 18, 2022
572494c
[gradle plugin] revert applying kotlin-dsl plugin, do that in #2702
aSemy Oct 18, 2022
ae95fed
Merge branch 'master' into feat/buildsrc_convention_plugins
aSemy Jan 9, 2023
616a093
Merge remote-tracking branch 'origin/master' into feat/buildsrc_conve…
aSemy Jan 28, 2023
2c25467
simplify binary-compatibility-validator plugin config
aSemy Jan 29, 2023
452f141
update binary compatibility plugin version
aSemy Jan 29, 2023
8693c58
rm ./runners/build.gradle.kts
aSemy Jan 29, 2023
c40cd18
tidy up Maven runner build config
aSemy Jan 29, 2023
4510cb9
Merge remote-tracking branch 'origin/master' into feat/buildsrc_conve…
aSemy Feb 1, 2023
34d21e8
move 'pluginManagement' up a level
aSemy Feb 1, 2023
88b7cc3
ignoredProjects: use += instead of addAll
aSemy Feb 1, 2023
ebb3e3d
add link to explain the Node/Yarn repos
aSemy Feb 1, 2023
de9eff1
formatting
aSemy Feb 1, 2023
1711af3
update javadocJar task
aSemy Feb 1, 2023
75764f6
Merge remote-tracking branch 'origin/master' into feat/buildsrc_conve…
aSemy Feb 22, 2023
0264c73
remove NonCacheableIntegrationTest - moved to buildSrc convention
aSemy Feb 22, 2023
4d8649d
update Kotlin version
aSemy Feb 22, 2023
712d79f
update TODO
aSemy Feb 22, 2023
68895d0
add gradle-plugin api dump
aSemy Feb 23, 2023
33cb1d7
add api-dump project paths
aSemy Feb 23, 2023
05c284e
move respositories specific only to :kotlin-analysis:intellij-dependency
aSemy Feb 23, 2023
932b343
add NonCacheableIntegrationTest back (it was lost during a merge?)
aSemy Feb 23, 2023
a367a26
remove javadocJar task from gradle-plugin (it was moved to the conven…
aSemy Feb 23, 2023
1949bda
fix javadocJar in gradle-plugin
aSemy Feb 23, 2023
e2a8edd
restore gradle-plugin/gradle.properties
aSemy Feb 23, 2023
6603d55
tidy up javadoc/maven-publish build config
aSemy Feb 23, 2023
e488262
restrict the node/yarn repos to only supply node/yarn
aSemy Feb 23, 2023
de1250a
update repositoriesMode PREFER_SETTINGS & comment
aSemy Feb 23, 2023
4ed2fc0
update link to faq
aSemy Feb 23, 2023
7a25d7f
fix double javadoc jar artifact
aSemy Feb 23, 2023
e301770
fix tasks.register -> tasks.registering
aSemy Feb 23, 2023
d516114
rm old shadow plugin dependency
aSemy Feb 23, 2023
f348661
replace star import with explicit import
aSemy Feb 24, 2023
6801a77
restore Dokka version to 1.7.20
aSemy Feb 28, 2023
0b6a9db
move common Java config into a new convention plugin, and apply it in…
aSemy Feb 28, 2023
7c49e09
tidy up compiler args
aSemy Feb 28, 2023
27c639c
restore suppress-version-warnings
aSemy Feb 28, 2023
bccbdd7
Merge remote-tracking branch 'origin/master' into feat/buildsrc_conve…
aSemy Feb 28, 2023
7212695
remove unused import
aSemy Feb 28, 2023
f1dcf92
update API dump
aSemy Feb 28, 2023
8fb0319
remove unnecessary MavenPublishPlugin check
aSemy Mar 1, 2023
4024f36
centralise repos in buildSrc
aSemy Mar 7, 2023
ff45720
set jvmToolchain in buildSrc
aSemy Mar 7, 2023
2e78b7b
Merge branch 'master' into feat/buildsrc_convention_plugins
aSemy Mar 7, 2023
1bbbd9b
set test Java Launcher toolchain to 11
aSemy Mar 7, 2023
d06036f
rm unnecessary task (clean already deletes buildDir contents)
aSemy Mar 7, 2023
ac58931
change java-version from 12 to 11 in snapshot workflows
aSemy Mar 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 5 additions & 63 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,74 +1,16 @@
import org.jetbrains.*
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
kotlin("jvm") apply false
id("java")
id("org.jetbrains.dokka") version "1.7.20"
org.jetbrains.conventions.base
id("org.jetbrains.dokka")
id("io.github.gradle-nexus.publish-plugin")
}

val dokka_version: String by project

allprojects {
configureDokkaVersion()
group = "org.jetbrains.dokka"
version = dokka_version

group = "org.jetbrains.dokka"
version = dokka_version


val language_version: String by project
tasks.withType(KotlinCompile::class).all {
kotlinOptions {
freeCompilerArgs = freeCompilerArgs + listOf(
"-opt-in=kotlin.RequiresOptIn",
"-Xjsr305=strict",
"-Xskip-metadata-version-check",
// need 1.4 support, otherwise there might be problems with Gradle 6.x (it's bundling Kotlin 1.4)
"-Xsuppress-version-warnings"
)
allWarningsAsErrors = true
languageVersion = language_version
apiVersion = language_version
jvmTarget = "1.8"
}
}

repositories {
mavenCentral()
}
}

subprojects {
apply {
plugin("org.jetbrains.kotlin.jvm")
plugin("java")
plugin("signing")
plugin("org.jetbrains.dokka")
}

// Gradle metadata
java {
@Suppress("UnstableApiUsage")
withSourcesJar()
targetCompatibility = JavaVersion.VERSION_1_8
}

tasks {
val dokkaOutputDir = "$buildDir/dokka"

dokkaHtml {
onlyIf { !isLocalPublication }
outputDirectory.set(file(dokkaOutputDir))
}

register<Jar>("javadocJar") {
archiveClassifier.set("javadoc")
dependsOn(dokkaHtml)
from(dokkaOutputDir)
}
}
}

println("Publication version: $dokka_version")
tasks.register<ValidatePublications>("validatePublications")
Expand All @@ -82,7 +24,7 @@ nexusPublishing {
}
}

tasks.maybeCreate("dokkaPublish").run {
val dokkaPublish by tasks.registering {
if (publicationChannels.any { it.isMavenRepository() }) {
finalizedBy(tasks.named("closeAndReleaseSonatypeStagingRepository"))
}
Expand Down
9 changes: 9 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,16 @@ repositories {
}

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:1.7.20")
implementation("com.github.jengelman.gradle.plugins:shadow:2.0.4")
aSemy marked this conversation as resolved.
Show resolved Hide resolved
implementation("gradle.plugin.com.github.johnrengelman:shadow:7.1.2")
implementation("org.jetbrains.kotlinx:binary-compatibility-validator:0.10.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")
}
1 change: 1 addition & 0 deletions buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
rootProject.name = "buildSrc"
12 changes: 12 additions & 0 deletions buildSrc/src/main/kotlin/org/jetbrains/conventions/base.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package org.jetbrains.conventions

plugins {
base
}

description = "common Gradle configuration that should be applied to all projets"

if (project != rootProject) {
project.group = rootProject.group
project.version = rootProject.version
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package org.jetbrains.conventions

import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent

plugins {
id("org.jetbrains.conventions.kotlin-jvm")
}

val integrationTestSourceSet = sourceSets.create("integrationTest") {
compileClasspath += sourceSets.main.get().output
runtimeClasspath += sourceSets.main.get().output
}

val integrationTest by tasks.registering(Test::class) {
IgnatBeresnev marked this conversation as resolved.
Show resolved Hide resolved
maxHeapSize = "2G"
description = "Runs integration tests."
group = "verification"
useJUnit()


testClassesDirs = integrationTestSourceSet.output.classesDirs
classpath = integrationTestSourceSet.runtimeClasspath

setForkEvery(1)
project.properties["dokka_integration_test_parallelism"]?.toString()?.toIntOrNull()?.let { parallelism ->
maxParallelForks = parallelism
}
environment(
"isExhaustive",
project.properties["dokka_integration_test_is_exhaustive"]?.toString()?.toBoolean()
?: System.getenv("DOKKA_INTEGRATION_TEST_IS_EXHAUSTIVE")?.toBoolean()
?: false.toString()
)

testLogging {
exceptionFormat = TestExceptionFormat.FULL
events(TestLogEvent.SKIPPED, TestLogEvent.FAILED)
showExceptions = true
showCauses = true
showStackTraces = true
}
}

tasks.check {
dependsOn(integrationTest)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package org.jetbrains.conventions

import org.jetbrains.configureDokkaVersion
import org.jetbrains.isLocalPublication
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id("org.jetbrains.conventions.base")
kotlin("jvm")
id("org.jetbrains.dokka")
}

configureDokkaVersion()

tasks.dokkaHtml {
onlyIf { !isLocalPublication }
outputDirectory.set(layout.buildDirectory.dir("dokka").map { it.asFile })
}

val javadocJar by tasks.registering(Jar::class) {
archiveClassifier.set("javadoc")
from(tasks.dokkaHtml)
}
IgnatBeresnev marked this conversation as resolved.
Show resolved Hide resolved

val language_version: String by project

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
freeCompilerArgs = freeCompilerArgs + listOf(
"-opt-in=kotlin.RequiresOptIn",
"-Xjsr305=strict",
"-Xskip-metadata-version-check",
// need 1.4 support, otherwise there might be problems with Gradle 6.x (it's bundling Kotlin 1.4)
"-Xsuppress-version-warnings"
)
allWarningsAsErrors = true
languageVersion = language_version
apiVersion = language_version
jvmTarget = "1.8"
}
}

// Gradle metadata
java {
withSourcesJar()
IgnatBeresnev marked this conversation as resolved.
Show resolved Hide resolved
targetCompatibility = JavaVersion.VERSION_1_8
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package org.jetbrains.conventions

plugins {
id("org.jetbrains.conventions.base")
`maven-publish`
signing
}

publishing {
publications.withType<MavenPublication>().configureEach {
repositories {
// Publish to a project-local Maven directory, for verification. To test, run:
// ./gradlew publishAllPublicationsToMavenProjectLocalRepository
// and check $rootDir/build/maven-project-local
maven(rootProject.layout.buildDirectory.dir("maven-project-local")) {
name = "MavenProjectLocal"
}
}
}
}
3 changes: 2 additions & 1 deletion core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import org.jetbrains.dokkaVersion
import org.jetbrains.registerDokkaArtifactPublication

plugins {
`maven-publish`
org.jetbrains.conventions.`kotlin-jvm`
org.jetbrains.conventions.`maven-publish`
}

dependencies {
Expand Down
4 changes: 4 additions & 0 deletions core/content-matcher-test-utils/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
plugins {
org.jetbrains.conventions.`kotlin-jvm`
}

dependencies {
implementation(project(":core:test-api"))
implementation(kotlin("stdlib-jdk8"))
Expand Down
3 changes: 2 additions & 1 deletion core/test-api/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import org.jetbrains.registerDokkaArtifactPublication

plugins {
`maven-publish`
org.jetbrains.conventions.`kotlin-jvm`
org.jetbrains.conventions.`maven-publish`
}

dependencies {
Expand Down
114 changes: 59 additions & 55 deletions integration-tests/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,61 +1,65 @@
import org.gradle.api.tasks.testing.logging.TestExceptionFormat
import org.gradle.api.tasks.testing.logging.TestLogEvent
//import org.gradle.api.tasks.testing.logging.TestExceptionFormat
//import org.gradle.api.tasks.testing.logging.TestLogEvent

subprojects {
sourceSets {
create("integrationTest") {
compileClasspath += sourceSets.main.get().output
runtimeClasspath += sourceSets.main.get().output
}
}

configurations.getByName("integrationTestImplementation") {
extendsFrom(configurations.implementation.get())
}

configurations.getByName("integrationTestRuntimeOnly") {
extendsFrom(configurations.runtimeOnly.get())
}

dependencies {
implementation(project(":integration-tests"))
}

val integrationTest by tasks.register<Test>("integrationTest") {
maxHeapSize = "2G"
description = "Runs integration tests."
group = "verification"
useJUnit()


testClassesDirs = sourceSets["integrationTest"].output.classesDirs
classpath = sourceSets["integrationTest"].runtimeClasspath

setForkEvery(1)
project.properties["dokka_integration_test_parallelism"]?.toString()?.toIntOrNull()?.let { parallelism ->
maxParallelForks = parallelism
}
environment(
"isExhaustive",
project.properties["dokka_integration_test_is_exhaustive"]?.toString()?.toBoolean()
?: System.getenv("DOKKA_INTEGRATION_TEST_IS_EXHAUSTIVE")?.toBoolean()
?: false.toString()
)

testLogging {
exceptionFormat = TestExceptionFormat.FULL
events(TestLogEvent.SKIPPED, TestLogEvent.FAILED)
showExceptions = true
showCauses = true
showStackTraces = true
}
}

tasks.check {
dependsOn(integrationTest)
}
plugins {
org.jetbrains.conventions.`kotlin-jvm`
}

//subprojects {
// sourceSets {
// create("integrationTest") {
// compileClasspath += sourceSets.main.get().output
// runtimeClasspath += sourceSets.main.get().output
// }
// }
//
// configurations.getByName("integrationTestImplementation") {
// extendsFrom(configurations.implementation.get())
// }
//
// configurations.getByName("integrationTestRuntimeOnly") {
// extendsFrom(configurations.runtimeOnly.get())
// }
//
// dependencies {
// implementation(project(":integration-tests"))
// }
//
// val integrationTest by tasks.register<Test>("integrationTest") {
// maxHeapSize = "2G"
// description = "Runs integration tests."
// group = "verification"
// useJUnit()
//
//
// testClassesDirs = sourceSets["integrationTest"].output.classesDirs
// classpath = sourceSets["integrationTest"].runtimeClasspath
//
// setForkEvery(1)
// project.properties["dokka_integration_test_parallelism"]?.toString()?.toIntOrNull()?.let { parallelism ->
// maxParallelForks = parallelism
// }
// environment(
// "isExhaustive",
// project.properties["dokka_integration_test_is_exhaustive"]?.toString()?.toBoolean()
// ?: System.getenv("DOKKA_INTEGRATION_TEST_IS_EXHAUSTIVE")?.toBoolean()
// ?: false.toString()
// )
//
// testLogging {
// exceptionFormat = TestExceptionFormat.FULL
// events(TestLogEvent.SKIPPED, TestLogEvent.FAILED)
// showExceptions = true
// showCauses = true
// showStackTraces = true
// }
// }
//
// tasks.check {
// dependsOn(integrationTest)
// }
//}

dependencies {
implementation(kotlin("stdlib"))
api(project(":test-utils"))
Expand Down
Loading