Skip to content

Commit 7229d8f

Browse files
authored
Merge pull request #1034 from Kotlin/skip-kodex-project-property
Allow running Gradle tasks with -PskipKodex to publish locally faster
2 parents c95438d + 2e95534 commit 7229d8f

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ This library is built with Gradle.
108108
things up during development.
109109
* Make sure to pass the extra parameter `-Pkotlin.dataframe.debug=true` to enable debug mode. This flag will
110110
make sure some extra checks are run, which are important but too heavy for production.
111+
* The parameter `-PskipKodex` allows you to skip [kdoc processing](KDOC_PREPROCESSING.md),
112+
making local publishing faster: `./gradlew publishToMavenLocal -PskipKodex`.
113+
This, however, publishes the library with "broken" KDocs,
114+
so it's only meant for faster iterations during development.
111115

112116
You can import this project into IDEA, but you have to delegate the build actions
113117
to Gradle (in Preferences -> Build, Execution, Deployment -> Build Tools -> Gradle -> Runner)

KDOC_PREPROCESSING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ This can be seen in action in the `core:processKDocsMain` and `core:changeJarTas
5757
`processKDocsMain` task is executed first, which processes the KDocs in the source files and writes them to the
5858
`generated-sources` folder. The `changeJarTask` task then makes sure that any `Jar` task in the `core` module uses the
5959
`generated-sources` folder as the source directory instead of the normal `src` folder.
60+
It's possible to optionally skip this step, for example, when you publish the library locally during development,
61+
by providing the `-PskipKodex` project property: `./gradlew publishToMavenLocal -PskipKodex`
6062

6163
`core:processKDocsMain` can also be run separately if you just want to see the result of the KDoc processing by KoDEx.
6264

core/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ idea {
237237
// the target of `processKdocMain`, and they are returned to normal afterward.
238238
// This is usually only done when publishing
239239
val changeJarTask by tasks.creating {
240-
outputs.upToDateWhen { false }
240+
outputs.upToDateWhen { project.hasProperty("skipKodex") }
241241
doFirst {
242242
tasks.withType<Jar> {
243243
doFirst {
@@ -266,7 +266,7 @@ tasks.withType<Jar> {
266266

267267
// modify all publishing tasks to depend on `changeJarTask` so the sources are swapped out with generated sources
268268
tasks.configureEach {
269-
if (name.startsWith("publish")) {
269+
if (!project.hasProperty("skipKodex") && name.startsWith("publish")) {
270270
dependsOn(processKDocsMain, changeJarTask)
271271
}
272272
}

0 commit comments

Comments
 (0)