mirror of https://github.com/FabricMC/yarn.git
Make named jar use jetbrain annotations (#2094)
* Make named jar use jetbrain annotations and subsequent javadoc tweaks Signed-off-by: liach <liach@users.noreply.github.com> * Thanks modmuss Signed-off-by: liach <liach@users.noreply.github.com> Co-authored-by: liach <liach@users.noreply.github.com>
This commit is contained in:
parent
b4973c0b60
commit
d9f1375826
27
build.gradle
27
build.gradle
|
@ -64,7 +64,7 @@ dependencies {
|
||||||
enigmaRuntime "cuchaz:enigma-swing:${project.enigma_version}"
|
enigmaRuntime "cuchaz:enigma-swing:${project.enigma_version}"
|
||||||
enigmaRuntime "net.fabricmc:stitch:${project.stitch_version}"
|
enigmaRuntime "net.fabricmc:stitch:${project.stitch_version}"
|
||||||
javadocClasspath "net.fabricmc:fabric-loader:${project.fabric_loader_version}"
|
javadocClasspath "net.fabricmc:fabric-loader:${project.fabric_loader_version}"
|
||||||
javadocClasspath "com.google.code.findbugs:jsr305:3.0.2"
|
javadocClasspath "org.jetbrains:annotations:${project.jetbrains_annotations_version}"
|
||||||
decompileClasspath "org.benf:cfr:0.150"
|
decompileClasspath "org.benf:cfr:0.150"
|
||||||
mappingPoetJar 'net.fabricmc:mappingpoet:0.2.6'
|
mappingPoetJar 'net.fabricmc:mappingpoet:0.2.6'
|
||||||
}
|
}
|
||||||
|
@ -582,10 +582,22 @@ task mapNamedJar(dependsOn: ["mergeV2", mapIntermediaryJar]) {
|
||||||
//Force the task to always run
|
//Force the task to always run
|
||||||
outputs.upToDateWhen { false }
|
outputs.upToDateWhen { false }
|
||||||
|
|
||||||
|
def jsrToJetbrains = [
|
||||||
|
"javax/annotation/Nullable": "org/jetbrains/annotations/Nullable",
|
||||||
|
"javax/annotation/Nonnull": "org/jetbrains/annotations/NotNull",
|
||||||
|
"javax/annotation/concurrent/Immutable": "org/jetbrains/annotations/Unmodifiable"
|
||||||
|
]
|
||||||
|
|
||||||
doLast {
|
doLast {
|
||||||
logger.lifecycle(":mapping minecraft to named")
|
logger.lifecycle(":mapping minecraft to named")
|
||||||
|
|
||||||
mapJar(namedJar, intermediaryJar, mergeV2.output, libraries, "intermediary", "named")
|
mapJar(namedJar, intermediaryJar, mergeV2.output, libraries, "intermediary", "named") {
|
||||||
|
it.withMappings { out ->
|
||||||
|
jsrToJetbrains.each { e ->
|
||||||
|
out.acceptClass e.key, e.value
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -732,8 +744,7 @@ javadoc {
|
||||||
'https://guava.dev/releases/21.0/api/docs/',
|
'https://guava.dev/releases/21.0/api/docs/',
|
||||||
'https://www.javadoc.io/doc/com.google.code.gson/gson/2.8.0/',
|
'https://www.javadoc.io/doc/com.google.code.gson/gson/2.8.0/',
|
||||||
'https://logging.apache.org/log4j/2.x/log4j-api/apidocs/',
|
'https://logging.apache.org/log4j/2.x/log4j-api/apidocs/',
|
||||||
// jsr305 need to come before jdk or the anno links are broken
|
"https://javadoc.io/doc/org.jetbrains/annotations/${project.jetbrains_annotations_version}/",
|
||||||
'https://www.javadoc.io/doc/com.google.code.findbugs/jsr305/3.0.2/',
|
|
||||||
'https://javadoc.lwjgl.org/',
|
'https://javadoc.lwjgl.org/',
|
||||||
'http://fastutil.di.unimi.it/docs/',
|
'http://fastutil.di.unimi.it/docs/',
|
||||||
'https://netty.io/4.1/api/',
|
'https://netty.io/4.1/api/',
|
||||||
|
@ -817,16 +828,18 @@ publishing {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void mapJar(File output, File input, File mappings, File libraries, String from, String to,
|
||||||
void mapJar(File output, File input, File mappings, File libraries, String from, String to) {
|
Action<TinyRemapper.Builder> action = { }) {
|
||||||
if (output.exists()) {
|
if (output.exists()) {
|
||||||
output.delete()
|
output.delete()
|
||||||
}
|
}
|
||||||
|
|
||||||
def remapper = TinyRemapper.newRemapper()
|
def remapperBuilder = TinyRemapper.newRemapper()
|
||||||
.withMappings(TinyUtils.createTinyMappingProvider(mappings.toPath(), from, to))
|
.withMappings(TinyUtils.createTinyMappingProvider(mappings.toPath(), from, to))
|
||||||
.renameInvalidLocals(true)
|
.renameInvalidLocals(true)
|
||||||
.rebuildSourceFilenames(true)
|
.rebuildSourceFilenames(true)
|
||||||
|
action.execute(remapperBuilder)
|
||||||
|
def remapper = remapperBuilder
|
||||||
.build()
|
.build()
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -5,3 +5,4 @@ enigma_version=0.23.0
|
||||||
stitch_version=0.5.1+build.77
|
stitch_version=0.5.1+build.77
|
||||||
# Loader is only used by javadoc generation/linking
|
# Loader is only used by javadoc generation/linking
|
||||||
fabric_loader_version=0.11.1
|
fabric_loader_version=0.11.1
|
||||||
|
jetbrains_annotations_version=20.1.0
|
||||||
|
|
Loading…
Reference in New Issue