Skip to content

Commit b975267

Browse files
committed
Initial Commit
0 parents  commit b975267

File tree

14 files changed

+1171
-0
lines changed

14 files changed

+1171
-0
lines changed

.gitattributes

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
* text eol=lf
2+
*.bat text eol=crlf
3+
*.java text eol=lf
4+
*.gradle text eol=crlf

.github/workflows/publish.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
branches: [ 'master' ]
6+
paths-ignore:
7+
- '.github/workflows/**'
8+
- 'README.md'
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
build:
15+
uses: MinecraftForge/SharedActions/.github/workflows/gradle.yml@v0
16+
with:
17+
java: 25
18+
gradle_tasks: 'check publish'
19+
artifact_name: 'jar-stubify'
20+
secrets:
21+
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
22+
PROMOTE_ARTIFACT_WEBHOOK: ${{ secrets.PROMOTE_ARTIFACT_WEBHOOK }}
23+
PROMOTE_ARTIFACT_USERNAME: ${{ secrets.PROMOTE_ARTIFACT_USERNAME }}
24+
PROMOTE_ARTIFACT_PASSWORD: ${{ secrets.PROMOTE_ARTIFACT_PASSWORD }}
25+
MAVEN_USER: ${{ secrets.MAVEN_USER }}
26+
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
27+
GRADLE_CACHE_KEY: ${{ secrets.GRADLE_CACHE_KEY }}

.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**/.gradle/
2+
/**/.classpath
3+
/**/.project
4+
/**/.settings/
5+
/**/bin/
6+
/**/test/
7+
/**/build/
8+
/repo/
9+
/cache/
10+
/_old_mdks_/
11+
12+
# Tool Output - Jonathan uses the run directory
13+
/run/
14+
/output/
15+
16+
# Jonathan's IntelliJ Fuckery
17+
/.idea/
18+
/output.jar
19+
/output.jar.cache
20+
/parchment.tsrg

LICENSE

Lines changed: 504 additions & 0 deletions
Large diffs are not rendered by default.

LICENSE-header.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Copyright (c) Forge Development LLC
2+
SPDX-License-Identifier: LGPL-2.1-only

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Jar Stubify
2+
3+
A simple tool that converts a jar into an 'api only' jar.
4+
All data files will be deleted, and all class files will have their code stubed out.
5+
The intended use is creating stub jar files for projects that can be used to compile.
6+
This uses the ClassFile API and so needs java 25+
7+
8+
## Usage
9+
10+
```shell
11+
java -jar jar-stubify.jar --input minecraft-1.21.11.jar --output minecraft-1.21.11-api.jar
12+
```
13+
14+
> [!WARNING]
15+
> **There is no public API for this tool!** This is designed to solely be a CLI tool, which means that all of the implementations are internal. We reserve the right to change the internal implementation at any time.

build.gradle

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
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+
}

gradle.properties

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
org.gradle.caching=true
2+
org.gradle.parallel=true
3+
org.gradle.configureondemand=true
4+
5+
org.gradle.configuration-cache=true
6+
org.gradle.configuration-cache.parallel=true
7+
org.gradle.configuration-cache.problems=warn
8+
9+
net.minecraftforge.gradleutils.ide.automatic.sources=true
10+
net.minecraftforge.gradleutils.compilation.defaults=true

gradle/wrapper/gradle-wrapper.jar

44.6 KB
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
distributionBase=GRADLE_USER_HOME
2+
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.1.0-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
6+
zipStoreBase=GRADLE_USER_HOME
7+
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)