mirror of
				https://github.com/GayPizzaSpecifications/foundation.git
				synced 2025-11-04 11:39:39 +00:00 
			
		
		
		
	Initial update manifest generation.
This commit is contained in:
		@ -5,7 +5,7 @@ variables:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
build:
 | 
					build:
 | 
				
			||||||
  stage: build
 | 
					  stage: build
 | 
				
			||||||
  script: gradle --build-cache shadowJar
 | 
					  script: gradle --build-cache assemble
 | 
				
			||||||
  cache:
 | 
					  cache:
 | 
				
			||||||
    key: "$CI_COMMIT_REF_NAME"
 | 
					    key: "$CI_COMMIT_REF_NAME"
 | 
				
			||||||
    policy: push
 | 
					    policy: push
 | 
				
			||||||
@ -14,4 +14,5 @@ build:
 | 
				
			|||||||
      - .gradle
 | 
					      - .gradle
 | 
				
			||||||
  artifacts:
 | 
					  artifacts:
 | 
				
			||||||
    paths:
 | 
					    paths:
 | 
				
			||||||
 | 
					      - "build/manifests/update.json"
 | 
				
			||||||
      - "**/build/libs/*-plugin.jar"
 | 
					      - "**/build/libs/*-plugin.jar"
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,6 @@
 | 
				
			|||||||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
 | 
					import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
 | 
				
			||||||
 | 
					import org.jetbrains.kotlin.com.google.gson.Gson
 | 
				
			||||||
 | 
					import java.io.FileWriter
 | 
				
			||||||
 | 
					
 | 
				
			||||||
plugins {
 | 
					plugins {
 | 
				
			||||||
  java
 | 
					  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 {
 | 
					subprojects {
 | 
				
			||||||
  plugins.apply("org.jetbrains.kotlin.jvm")
 | 
					  plugins.apply("org.jetbrains.kotlin.jvm")
 | 
				
			||||||
  plugins.apply("org.jetbrains.kotlin.plugin.serialization")
 | 
					  plugins.apply("org.jetbrains.kotlin.plugin.serialization")
 | 
				
			||||||
@ -70,4 +106,8 @@ subprojects {
 | 
				
			|||||||
  tasks.withType<ShadowJar> {
 | 
					  tasks.withType<ShadowJar> {
 | 
				
			||||||
    archiveClassifier.set("plugin")
 | 
					    archiveClassifier.set("plugin")
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  tasks.assemble {
 | 
				
			||||||
 | 
					    dependsOn("shadowJar")
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user