fabric/fabric-data-generation-api-v1/build.gradle

115 lines
2.9 KiB
Groovy
Raw Normal View History

archivesBaseName = "fabric-data-generation-api-v1"
version = getSubprojectVersion(project)
moduleDependencies(project, [
'fabric-api-base',
'fabric-registry-sync-v0',
'fabric-networking-api-v1',
'fabric-resource-conditions-api-v1'
])
dependencies {
}
sourceSets {
testmod {
resources {
srcDirs += [
'src/testmod/generated'
]
}
}
}
loom {
accessWidenerPath = file("src/main/resources/fabric-data-generation-api-v1.accesswidener")
runs {
datagen {
inherit testmodServer
name "Data Generation"
vmArg "-Dfabric-api.datagen"
vmArg "-Dfabric-api.datagen.output-dir=${file("src/testmod/generated")}"
vmArg "-Dfabric-api.datagen.strict-validation"
ideConfigGenerated = true
runDir "build/datagen"
}
datagenClient {
client()
name "Data Generation"
vmArg "-Dfabric-api.datagen"
vmArg "-Dfabric-api.datagen.output-dir=${file("src/testmod/generated")}"
vmArg "-Dfabric-api.datagen.strict-validation"
ideConfigGenerated = true
runDir "build/datagen"
source sourceSets.testmod
}
}
}
test.dependsOn runDatagen
import org.objectweb.asm.ClassReader
import org.objectweb.asm.Opcodes
import org.objectweb.asm.tree.ClassNode
import java.util.zip.ZipFile
task generateAccessWidener() {
doLast {
File inputJar = loom.namedMinecraftProvider.parentMinecraftProvider.mergedJar.toFile()
String accessWidener = file("template.accesswidener").text + "\n"
visitMethods(inputJar, "net/minecraft/data/server/RecipeProvider.class") { name, desc, owner ->
if (it.name == "generate")
return
accessWidener += "transitive-accessible\tmethod\t${owner}\t${name}\t${desc}\n"
}
visitMethods(inputJar, "net/minecraft/data/client/BlockStateModelGenerator.class") { name, desc, owner ->
if (desc == "()V")
// Skip over methods that dont take any arguments, as they are specific to minecraft.
return
accessWidener += "transitive-accessible\tmethod\t${owner}\t${name}\t${desc}\n"
}
visitMethods(inputJar, "net/minecraft/data/server/BlockLootTableGenerator.class") { name, desc, owner ->
accessWidener += "transitive-accessible\tmethod\t${owner}\t${name}\t${desc}\n"
}
file("src/main/resources/fabric-data-generation-api-v1.accesswidener").text = accessWidener
}
}
def visitMethods(File input, String className, closure) {
def clazz = getClassNode(input, className)
clazz.methods.forEach {
if ((it.access & Opcodes.ACC_SYNTHETIC) != 0 || (it.access & Opcodes.ACC_PUBLIC) != 0)
return
if (it.name.startsWith("<"))
return
closure(it.name, it.desc, clazz.name)
}
}
ClassNode getClassNode(File input, String className) {
new ZipFile(input).withCloseable { ZipFile zip ->
zip.getInputStream(zip.getEntry(className)).withCloseable { is ->
ClassReader reader = new ClassReader(is)
ClassNode classNode = new ClassNode()
reader.accept(classNode, 0)
return classNode
}
}
}
Add fabric-convention-tags-v1 (#2063) * Add framework for common-tags-v1 * Add javadoc to fabric tool tags * Fix wrong package arrangement * Add some more tags * Add more biome tags Thanks to TelepathicGrunt for the suggestions * Update fabric-common-tags-api-v1/src/main/java/net/fabricmc/fabric/api/tags/v1/CommonEnchantmentTags.java Co-authored-by: haykam821 <24855774+haykam821@users.noreply.github.com> * Update fabric-common-tags-api-v1/src/main/java/net/fabricmc/fabric/api/tags/v1/CommonEnchantmentTags.java Co-authored-by: haykam821 <24855774+haykam821@users.noreply.github.com> * Clarify enchantment tags * Add no-shulker tag * Add minecart tag * Begin work on datagen and populating tags * Add bucket tags * First pass at populating biome tags * Add boat tag * Fix missing inclusion of f:shears into c:shears * Hide fabric tool tags in datagen * Add weapon damage enhancement tag * Change impl package name to be inline with rest of fapi * Rename enchantment tags * Some cleanup * Populate blocktag datagen Remove crops tag * Add javadoc links to vanilla counterparts * Move datagen to its own sourceset * Fix package names for checkstyle * Populate more entries * Remove exclusion tag * Add license headers Fix checkstyle * Add missing nether quarts to ores tag * Use `worldgen/biome` instead of `biomes` for biome tags Co-authored-by: haykam821 <24855774+haykam821@users.noreply.github.com> * Manually include all biomes for overworld * Remove ancient debris from NetheriteOres * Add and populate glass tags * Add and populate movement enhancement * Break up item tags * Add armour damage reduction tag * Add missing ore and related tags * Fix quartz tags * Add floral tag * Add golden carrot * Correct some biome tag issues * Separate SNOWY_PLAINS and PLAINS * Add SNOWY tag and remove snowy biomes from ICY * Correct enchantment tag Remove silk touch tag * Fix more biome issues * Add deep and shllow ocean tags * Add no-move tag * Remove netherite ores * Add shulker tags * Add raw ore * Add dye tags * Fif dye tags * Fix typo * Document some biome tags where the naming may not be clear * Remove tag mirroring for blocks and items * Rename module Remove unused methods * Rename impl package * Rename packages and module * Rename folder * Rename api classes * Add generateResources task to cover all resource generation tasks. * Add generated tags to repo * Fix ocean tag excluding shallow ocean * Iterate registry to generate foods tag * Remove cache, add to gitignore * Rename generated folder Co-authored-by: haykam821 <24855774+haykam821@users.noreply.github.com> Co-authored-by: modmuss50 <modmuss50@gmail.com>
2022-04-17 14:23:48 -04:00
generateResources.dependsOn generateAccessWidener