Skip to content

Commit 10bd417

Browse files
committed
added includeCoreLibrariesJson parameter
1 parent 168d87e commit 10bd417

File tree

3 files changed

+24
-22
lines changed

3 files changed

+24
-22
lines changed

CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,9 @@ This library is built with Gradle.
112112
making local publishing faster: `./gradlew publishToMavenLocal -PskipKodex`.
113113
This, however, publishes the library with "broken" KDocs,
114114
so it's only meant for faster iterations during development.
115+
* The parameter `-PincludeCoreLibrariesJson` makes the build include the `libraries.json` file in the `:core` module.
116+
This file allows loading dataframe-jupyter when dataframe-core is present on its own in a Kotlin Notebook.
117+
Usually only done when publishing.
115118

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

core/build.gradle.kts

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -281,41 +281,31 @@ val generateLibrariesJson by tasks.registering {
281281
}
282282
}
283283

284-
// If `changeProcessResourcesTask` is run, modify the processResources task such that before running,
285-
// a META-INF libraries.json file is added to the resources.
284+
// If `includeCoreLibrariesJson` is set, modify the processResources task such that it includes
285+
// a META-INF libraries.json file.
286286
// This file allows loading dataframe-jupyter when dataframe-core is present on its own in a Kotlin Notebook.
287287
// This is usually only done when publishing.
288-
val changeProcessResourcesTask by tasks.registering {
289-
doFirst {
290-
tasks.processResources {
291-
from(generatedJupyterResourcesDir) {
292-
into("") // keep META-INF/... structure as generated
293-
}
294-
doLast {
295-
logger.lifecycle("$this includes generated META-INF/kotlin-jupyter-libraries/libraries.json")
296-
}
288+
tasks.processResources {
289+
if (project.hasProperty("includeCoreLibrariesJson")) {
290+
dependsOn(generateLibrariesJson)
291+
from(generatedJupyterResourcesDir) {
292+
into("") // keep META-INF/... structure as generated
293+
}
294+
doLast {
295+
logger.lifecycle("$this includes generated META-INF/kotlin-jupyter-libraries/libraries.json")
297296
}
298297
}
299298
}
300-
tasks.processResources {
301-
mustRunAfter(changeProcessResourcesTask)
302-
dependsOn(generateLibrariesJson)
303-
}
304299

305300
// if `processKDocsMain` runs, the Jar tasks must run after it so the generated-sources are there
306301
tasks.withType<Jar> {
307302
mustRunAfter(changeJarTask, tasks.generateKeywordsSrc, processKDocsMain)
308303
}
309304

310305
// modify all publishing tasks to depend on `changeJarTask` so the sources are swapped out with generated sources
311-
// also `changeProcessResourcesTask`, so libraries.json is included in the resources
312306
tasks.configureEach {
313-
if (name.startsWith("publish")) {
314-
dependsOn(changeProcessResourcesTask)
315-
316-
if (!project.hasProperty("skipKodex")) {
317-
dependsOn(processKDocsMain, changeJarTask)
318-
}
307+
if (!project.hasProperty("skipKodex") && name.startsWith("publish")) {
308+
dependsOn(processKDocsMain, changeJarTask)
319309
}
320310
}
321311

gradle.properties

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,12 @@ ksp.useKSP2=false
2222
kotlin.dataframe.debug=false
2323

2424
kotlin.incremental=false
25+
26+
# Can speed up build time but stops KDocs from being preprocessed.
27+
# It can also be turned on from the command line with `-PskipKodex`
28+
# skipKodex=true
29+
30+
# If `true`, builds include the core/src/main/resources/META-INF/kotlin-jupyter-libraries/libraries.json file.
31+
# This file allows loading dataframe-jupyter when dataframe-core is present on its own in a Kotlin Notebook.
32+
# This is usually only done when publishing and can be turned on from the command line with `-PincludeCoreLibrariesJson`
33+
# includeCoreLibrariesJson=true

0 commit comments

Comments
 (0)