plugins { id 'java' id 'com.github.johnrengelman.shadow' id 'maven-publish' } group = 'org.taumc.jst' jar { manifest { attributes 'Main-Class': 'net.neoforged.jst.cli.Main' } } java { withSourcesJar() withJavadocJar() } configurations { include include.extendsFrom(implementation) } dependencies { implementation project(":api") implementation "info.picocli:picocli:$picocli_version" implementation 'org.slf4j:slf4j-simple:2.0.13' include project(":parchment") include project(":accesstransformers") include project(':interfaceinjection') include project(':unpick') include project(':remapper') testImplementation platform("org.junit:junit-bom:$junit_version") testImplementation 'org.junit.jupiter:junit-jupiter' testImplementation "org.assertj:assertj-core:$assertj_version" } test { useJUnitPlatform() } shadowJar { configurations = [project.configurations.include] mergeServiceFiles() } assemble.configure { dependsOn shadowJar } // This skips the shadowjar from being published as part of the normal publication components.java.withVariantsFromConfiguration(configurations.shadowRuntimeElements) { skip() } abstract class ComponentMaker { @Inject abstract SoftwareComponentFactory getFactory() } final componentFactory = objects.newInstance(ComponentMaker).factory final shadowComponent = componentFactory.adhoc("shadow") project.components.add(shadowComponent) tasks.named('shadowJar', Jar) { archiveClassifier = '' archiveBaseName ='jst-cli-bundle' } shadowComponent.addVariantsFromConfiguration(configurations.shadowRuntimeElements) { it.mapToMavenScope("runtime") } tasks.register('sourcesBundleJar', Jar) { it.archiveClassifier = 'sources' it.archiveBaseName = 'jst-cli-bundle' } tasks.register('javadocBundleJar', Jar) { it.archiveClassifier = 'javadoc' it.archiveBaseName = 'jst-cli-bundle' } publishing { publications { // This publication only contains the unshaded jar with dependencies in the pom.xml plain(MavenPublication) { artifactId = 'jst-cli' from components.java pom { name = 'JST CLI' description = 'The JavaSourceTransformer CLI' rootProject.taumcPom(it) } } // This publication only contains the shaded standalone jar create('bundle', MavenPublication) { artifactId = 'jst-cli-bundle' from components.shadow artifact(tasks.sourcesBundleJar) artifact(tasks.javadocBundleJar) pom { name = 'JST CLI bundle' description = 'The JavaSourceTransformer CLI bundle, containing all builtin plugins shadowed' rootProject.taumcPom(it) } } } }