Skip to content

Commit

Permalink
feat: allow setting additional manifest entries for bundler jars
Browse files Browse the repository at this point in the history
  • Loading branch information
MiniDigger committed Nov 17, 2024
1 parent 6408556 commit cc10bd9
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import org.gradle.api.artifacts.component.ProjectComponentIdentifier
import org.gradle.api.artifacts.result.ResolvedArtifactResult
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.MapProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.*
import org.gradle.kotlin.dsl.*
Expand Down Expand Up @@ -72,6 +73,10 @@ abstract class CreateBundlerJar : ZippedTask() {
@get:Classpath
abstract val vanillaBundlerJar: RegularFileProperty

@get:Input
@get:Optional
abstract val additionalManifestEntries: MapProperty<String, String>

@get:OutputFile
abstract val libraryChangesJson: RegularFileProperty

Expand Down Expand Up @@ -106,6 +111,12 @@ abstract class CreateBundlerJar : ZippedTask() {
}
}

if (additionalManifestEntries.isPresent) {
modifyManifest(rootDir.resolve("META-INF/MANIFEST.MF")) {
additionalManifestEntries.get().forEach { (k, v) -> mainAttributes.putValue(k, v) }
}
}

rootDir.resolve("META-INF/main-class").writeText(mainClass.get())

// copy version.json file
Expand Down

0 comments on commit cc10bd9

Please sign in to comment.