|
| 1 | +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar |
| 2 | +import com.github.jengelman.gradle.plugins.shadow.transformers.PropertiesFileTransformer |
| 3 | + |
| 4 | +plugins { |
| 5 | + id 'java' |
| 6 | + id 'idea' |
| 7 | + id 'eclipse' |
| 8 | + id 'maven-publish' |
| 9 | + alias libs.plugins.gradleutils |
| 10 | + alias libs.plugins.gitversion |
| 11 | + alias libs.plugins.changelog |
| 12 | + alias libs.plugins.licenser |
| 13 | + alias libs.plugins.shadow |
| 14 | +} |
| 15 | + |
| 16 | +gradleutils.displayName = 'Jar Stubify' |
| 17 | +description = 'A tool to convert jar files into api only stubs.' |
| 18 | +group = 'net.minecraftforge' |
| 19 | +version = gitversion.tagOffset |
| 20 | + |
| 21 | +println "Version: $version" |
| 22 | + |
| 23 | +java.toolchain.languageVersion = JavaLanguageVersion.of(25) |
| 24 | + |
| 25 | +dependencies { |
| 26 | + compileOnly libs.nulls |
| 27 | + |
| 28 | + implementation libs.jopt |
| 29 | +} |
| 30 | + |
| 31 | +license { |
| 32 | + header = rootProject.file('LICENSE-header.txt') |
| 33 | + newLine false |
| 34 | +} |
| 35 | + |
| 36 | +tasks.named('jar', Jar) { |
| 37 | + manifest { |
| 38 | + attributes([ |
| 39 | + 'Main-Class' : 'net.minecraftforge.stubify.Main', |
| 40 | + 'Automatic-Module-Name': 'net.minecraftforge.stubify' |
| 41 | + ]) |
| 42 | + |
| 43 | + gradleutils.manifestDefaults(it, 'net/minecraftforge/stubify/') |
| 44 | + } |
| 45 | + |
| 46 | + archiveClassifier = 'slim' |
| 47 | +} |
| 48 | + |
| 49 | +tasks.named('shadowJar', ShadowJar) { |
| 50 | + archiveClassifier = '' |
| 51 | + minimize() |
| 52 | + relocate('joptsimple', 'net.minecraftforge.stubify.shadow.joptsimple') |
| 53 | + // Rewrite JOpt's message files, so that help text is displayed nicely. |
| 54 | + transform(PropertiesFileTransformer) { |
| 55 | + paths = [ 'Messages.properties$' ] |
| 56 | + keyTransformer = { key -> 'net.minecraftforge.stubify.shadow.' + key } |
| 57 | + } |
| 58 | +} |
| 59 | + |
| 60 | +changelog { |
| 61 | + fromBase() |
| 62 | +} |
| 63 | + |
| 64 | +publishing { |
| 65 | + repositories { |
| 66 | + maven gradleutils.publishingForgeMaven |
| 67 | + } |
| 68 | + |
| 69 | + publications.register('mavenJava', MavenPublication) { |
| 70 | + from components.shadow |
| 71 | + |
| 72 | + changelog.publish(it) |
| 73 | + gradleutils.promote(it) |
| 74 | + |
| 75 | + pom { pom -> |
| 76 | + name = gradleutils.displayName |
| 77 | + description = project.description |
| 78 | + |
| 79 | + gradleutils.pom.addRemoteDetails(pom) |
| 80 | + |
| 81 | + licenses { |
| 82 | + license gradleutils.pom.licenses.LGPLv2_1 |
| 83 | + } |
| 84 | + |
| 85 | + developers { |
| 86 | + developer gradleutils.pom.developers.LexManos |
| 87 | + } |
| 88 | + } |
| 89 | + } |
| 90 | +} |
0 commit comments