-
Notifications
You must be signed in to change notification settings - Fork 420
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
IgnatBeresnev
merged 65 commits into
Kotlin:master
from
aSemy:feat/buildsrc_convention_plugins
Mar 7, 2023
Merged
Changes from 51 commits
Commits
Show all changes
65 commits
Select commit
Hold shift + click to select a range
3f77497
try setting up buildSrc convention plugins
aSemy b591e34
finish creating buildSrc plugins
aSemy 16657a2
Merge remote-tracking branch 'origin/master' into feat/buildsrc_conve…
aSemy a8abe34
create MavenProjectLocal helper
aSemy 2dd31cf
dokka-gradle-plugin: warn on duplicate resources
aSemy 58bc1c8
dokka-gradle-plugin: fix kotlin-dsl compatibility
aSemy 89a504f
disable empty subproject :plugins:base:search-component
aSemy 7a1a430
formatting
aSemy 968a123
re-add dependencies that were in :dokka:plugins subproject {} block
aSemy 63a7da4
re-add project(":integration-tests") dependency to integration-tests …
aSemy 766af55
fix dokka-integration-test integrationTest configurations
aSemy 770a27b
replace println with logger.lifecycle
aSemy ae0f4e1
update description for base plugin (else it provides a default descri…
aSemy bba37c7
rm commented out code
aSemy 549c11c
update test code after applying kotlin-dsl plugin
aSemy 9bfedff
tidy up gradle-plugin build.gradle.kts
aSemy 54e68e3
add repositoriesMode
aSemy a1cfab1
move repositories to settings.gradle.kts
aSemy d2e05d0
Declare the Node.js & Yarn download repositories
aSemy 572494c
[gradle plugin] revert applying kotlin-dsl plugin, do that in #2702
aSemy ae95fed
Merge branch 'master' into feat/buildsrc_convention_plugins
aSemy 616a093
Merge remote-tracking branch 'origin/master' into feat/buildsrc_conve…
aSemy 2c25467
simplify binary-compatibility-validator plugin config
aSemy 452f141
update binary compatibility plugin version
aSemy 8693c58
rm ./runners/build.gradle.kts
aSemy c40cd18
tidy up Maven runner build config
aSemy 4510cb9
Merge remote-tracking branch 'origin/master' into feat/buildsrc_conve…
aSemy 34d21e8
move 'pluginManagement' up a level
aSemy 88b7cc3
ignoredProjects: use += instead of addAll
aSemy ebb3e3d
add link to explain the Node/Yarn repos
aSemy de9eff1
formatting
aSemy 1711af3
update javadocJar task
aSemy 75764f6
Merge remote-tracking branch 'origin/master' into feat/buildsrc_conve…
aSemy 0264c73
remove NonCacheableIntegrationTest - moved to buildSrc convention
aSemy 4d8649d
update Kotlin version
aSemy 712d79f
update TODO
aSemy 68895d0
add gradle-plugin api dump
aSemy 33cb1d7
add api-dump project paths
aSemy 05c284e
move respositories specific only to :kotlin-analysis:intellij-dependency
aSemy 932b343
add NonCacheableIntegrationTest back (it was lost during a merge?)
aSemy a367a26
remove javadocJar task from gradle-plugin (it was moved to the conven…
aSemy 1949bda
fix javadocJar in gradle-plugin
aSemy e2a8edd
restore gradle-plugin/gradle.properties
aSemy 6603d55
tidy up javadoc/maven-publish build config
aSemy e488262
restrict the node/yarn repos to only supply node/yarn
aSemy de1250a
update repositoriesMode PREFER_SETTINGS & comment
aSemy 4ed2fc0
update link to faq
aSemy 7a25d7f
fix double javadoc jar artifact
aSemy e301770
fix tasks.register -> tasks.registering
aSemy d516114
rm old shadow plugin dependency
aSemy f348661
replace star import with explicit import
aSemy 6801a77
restore Dokka version to 1.7.20
aSemy 0b6a9db
move common Java config into a new convention plugin, and apply it in…
aSemy 7c49e09
tidy up compiler args
aSemy 27c639c
restore suppress-version-warnings
aSemy bccbdd7
Merge remote-tracking branch 'origin/master' into feat/buildsrc_conve…
aSemy 7212695
remove unused import
aSemy f1dcf92
update API dump
aSemy 8fb0319
remove unnecessary MavenPublishPlugin check
aSemy 4024f36
centralise repos in buildSrc
aSemy ff45720
set jvmToolchain in buildSrc
aSemy 2e78b7b
Merge branch 'master' into feat/buildsrc_convention_plugins
aSemy 1bbbd9b
set test Java Launcher toolchain to 11
aSemy d06036f
rm unnecessary task (clean already deletes buildDir contents)
aSemy ac58931
change java-version from 12 to 11 in snapshot workflows
aSemy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rootProject.name = "buildSrc" |
29 changes: 0 additions & 29 deletions
29
buildSrc/src/main/kotlin/org/jetbrains/binaryCompatibility.kt
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
buildSrc/src/main/kotlin/org/jetbrains/conventions/base.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package org.jetbrains.conventions | ||
|
||
plugins { | ||
base | ||
} | ||
|
||
// common Gradle configuration that should be applied to all projects | ||
|
||
if (project != rootProject) { | ||
project.group = rootProject.group | ||
project.version = rootProject.version | ||
} | ||
aSemy marked this conversation as resolved.
Show resolved
Hide resolved
|
75 changes: 75 additions & 0 deletions
75
buildSrc/src/main/kotlin/org/jetbrains/conventions/dokka-integration-test.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
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 integrationTestImplementation by configurations.getting { | ||
extendsFrom(configurations.implementation.get()) | ||
} | ||
|
||
val integrationTestRuntimeOnly by configurations.getting { | ||
extendsFrom(configurations.runtimeOnly.get()) | ||
} | ||
|
||
/** | ||
* Dokka's integration test task is not cacheable because the HTML outputs | ||
* it produces when running the tests are used for showcasing resulting documentation, | ||
* which does not work well with caching. | ||
* | ||
* At the moment there are two problems that do not allow to make it cacheable: | ||
* | ||
* 1. The task's inputs are such that changes in Dokka's code do not invalidate the cache, | ||
* because it is run with the same version of Dokka (`"DOKKA_VERSION"`) on the same | ||
* test project inputs. | ||
* 2. The tests generate HTML output which is then used to showcase documentation. | ||
* The outputs are usually copied to a location from which it will be served. | ||
* However, if the test is cacheable, it produces no outputs, so no documentation | ||
* to showcase. It needs to be broken into two separate tasks: one cacheable for running | ||
* the tests and producing HTML output, and another non-cacheable for copying the output. | ||
* | ||
* @see [org.jetbrains.dokka.it.TestOutputCopier] for more details on showcasing documentation | ||
*/ | ||
@DisableCachingByDefault(because = "Contains incorrect inputs/outputs configuration, see the KDoc for details") | ||
abstract class NonCacheableIntegrationTest : Test() | ||
|
||
val integrationTest by tasks.registering(NonCacheableIntegrationTest::class) { | ||
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) | ||
} |
13 changes: 13 additions & 0 deletions
13
buildSrc/src/main/kotlin/org/jetbrains/conventions/dokka.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package org.jetbrains.conventions | ||
|
||
import org.gradle.kotlin.dsl.invoke | ||
import org.jetbrains.isLocalPublication | ||
|
||
plugins { | ||
id("org.jetbrains.dokka") | ||
} | ||
|
||
tasks.dokkaHtml { | ||
onlyIf { !isLocalPublication } | ||
outputDirectory.set(layout.buildDirectory.dir("dokka").map { it.asFile }) | ||
} |
35 changes: 35 additions & 0 deletions
35
buildSrc/src/main/kotlin/org/jetbrains/conventions/kotlin-jvm.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.jetbrains.conventions | ||
|
||
import org.jetbrains.configureDokkaVersion | ||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile | ||
|
||
plugins { | ||
id("org.jetbrains.conventions.base") | ||
kotlin("jvm") | ||
} | ||
|
||
configureDokkaVersion() | ||
|
||
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 | ||
} |
30 changes: 30 additions & 0 deletions
30
buildSrc/src/main/kotlin/org/jetbrains/conventions/maven-publish.gradle.kts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package org.jetbrains.conventions | ||
|
||
plugins { | ||
id("org.jetbrains.conventions.base") | ||
`maven-publish` | ||
signing | ||
id("org.jetbrains.conventions.dokka") | ||
} | ||
|
||
val javadocJar by tasks.registering(Jar::class) { | ||
group = JavaBasePlugin.DOCUMENTATION_GROUP | ||
description = "Assembles a Javadoc JAR using Dokka HTML" | ||
archiveClassifier.set("javadoc") | ||
from(tasks.dokkaHtml) | ||
} | ||
|
||
publishing { | ||
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" | ||
} | ||
} | ||
|
||
publications.withType<MavenPublication>().configureEach { | ||
artifact(javadocJar) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not opposed to bumping this, but I want to try and limit this PR as much as possible. I think it would be better to update in a separate PR.