@@ -281,41 +281,31 @@ val generateLibrariesJson by tasks.registering {
281
281
}
282
282
}
283
283
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.
286
286
// This file allows loading dataframe-jupyter when dataframe-core is present on its own in a Kotlin Notebook.
287
287
// 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" )
297
296
}
298
297
}
299
298
}
300
- tasks.processResources {
301
- mustRunAfter(changeProcessResourcesTask)
302
- dependsOn(generateLibrariesJson)
303
- }
304
299
305
300
// if `processKDocsMain` runs, the Jar tasks must run after it so the generated-sources are there
306
301
tasks.withType<Jar > {
307
302
mustRunAfter(changeJarTask, tasks.generateKeywordsSrc, processKDocsMain)
308
303
}
309
304
310
305
// 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
312
306
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)
319
309
}
320
310
}
321
311
0 commit comments