mirror of
https://github.com/GayPizzaSpecifications/foundation.git
synced 2025-08-02 13:10:55 +00:00
Initial update manifest generation.
This commit is contained in:
parent
b410fdf9e0
commit
3b47ec75bb
@ -5,7 +5,7 @@ variables:
|
||||
|
||||
build:
|
||||
stage: build
|
||||
script: gradle --build-cache shadowJar
|
||||
script: gradle --build-cache assemble
|
||||
cache:
|
||||
key: "$CI_COMMIT_REF_NAME"
|
||||
policy: push
|
||||
@ -14,4 +14,5 @@ build:
|
||||
- .gradle
|
||||
artifacts:
|
||||
paths:
|
||||
- "build/manifests/update.json"
|
||||
- "**/build/libs/*-plugin.jar"
|
||||
|
@ -1,4 +1,6 @@
|
||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
|
||||
import org.jetbrains.kotlin.com.google.gson.Gson
|
||||
import java.io.FileWriter
|
||||
|
||||
plugins {
|
||||
java
|
||||
@ -24,6 +26,40 @@ allprojects {
|
||||
}
|
||||
}
|
||||
|
||||
val manifestsDir = buildDir.resolve("manifests")
|
||||
manifestsDir.mkdirs()
|
||||
val gson = Gson()
|
||||
|
||||
tasks.create("updateManifests") {
|
||||
// TODO: not using task dependencies, outputs, blah blah blah.
|
||||
doLast {
|
||||
val updateFile = manifestsDir.resolve("update.json")
|
||||
val writer = FileWriter(updateFile)
|
||||
writer.use {
|
||||
val rootPath = rootProject.rootDir.toPath()
|
||||
val updateManifest = subprojects.mapNotNull { project ->
|
||||
val files = project.tasks.getByName("shadowJar").outputs
|
||||
val paths = files.files.map { rootPath.relativize(it.toPath()).toString() }
|
||||
|
||||
if (paths.isNotEmpty()) project.name to mapOf(
|
||||
"version" to project.version,
|
||||
"artifacts" to paths,
|
||||
)
|
||||
else null
|
||||
}.toMap()
|
||||
|
||||
gson.toJson(
|
||||
updateManifest,
|
||||
writer
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.assemble {
|
||||
dependsOn("updateManifests")
|
||||
}
|
||||
|
||||
subprojects {
|
||||
plugins.apply("org.jetbrains.kotlin.jvm")
|
||||
plugins.apply("org.jetbrains.kotlin.plugin.serialization")
|
||||
@ -70,4 +106,8 @@ subprojects {
|
||||
tasks.withType<ShadowJar> {
|
||||
archiveClassifier.set("plugin")
|
||||
}
|
||||
|
||||
tasks.assemble {
|
||||
dependsOn("shadowJar")
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user