加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
build.gradle 3.13 KB
一键复制 编辑 原始数据 按行查看 历史
XiLaiTL 提交于 2024-09-19 23:44 . feat(*): change chain gradle
allprojects {
apply plugin: "java"
apply plugin: "maven-publish"
archivesBaseName = rootProject.archives_base_name
version = rootProject.mod_version
group = rootProject.maven_group
repositories {
// Add repositories to retrieve artifacts from in here.
// You should only use this when depending on other mods because
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories.
}
tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
options.release = 22
}
java {
withSourcesJar()
}
}
def versions = ['1.16.5','1.18.2','1.19.2','1.19.4','1.20.1','1.20.4','1.20.6','1.21.0'];
def apis = { ver->
if(ver in ['1.20.6','1.21.0']) ['neoforge','fabric']
else if(ver == '1.20.4') ['fabric','neoforge']
else ['forge','fabric']
}
versions.forEach {ver->
apis(ver).forEach {api->
tasks.register("runClient-${ver}-${api}"){
dependsOn(":${ver}:${api}:runClient")
}
tasks.register("build-jar-${ver}-${api}",Copy){
dependsOn(":${ver}:${api}:build")
with{
from("./${ver}/${api}/build/libs/yuushya-${mod_version}.jar")
rename {"yuushya-${ver}-${api}-${mod_version}.jar"}
into("./build/libs")
duplicatesStrategy(DuplicatesStrategy.INHERIT)
}
}
}
}
tasks.register("build-jar"){
versions.forEach {ver->
apis(ver).forEach { api ->
dependsOn "build-jar-${ver}-${api}"
}
}
}
tasks.register("clean-all"){
dependsOn(":common:clean")
versions.forEach { ver ->
(["common"]+apis(ver)).forEach { api ->
dependsOn(":${ver}:${api}:clean")
}
}
}
tasks.register("build-tools",Copy){
from("./buildSrc/build/libs/buildSrc-0.0.0.jar")
rename {"yuushya-tool.jar"}
into("./build/tools")
}
def build_tasks = versions.collectMany {ver-> apis(ver).collect {api-> "build-jar-${ver}-${api}"}}
tasks.register("gen-chain-1"){
dependsOn("clean-all")
finalizedBy(['1.16.5','1.18.2','1.19.2','1.19.4','1.20.1','1.20.4'].collect{":common:gen-${it}"})
}
tasks.register("gen-chain-2"){
dependsOn(":common:clean")
finalizedBy([":common:gen-1.20.6"])
}
tasks.register("gen-chain-3"){
dependsOn(":common:clean")
finalizedBy([":common:gen-1.21.0"])
}
tasks.register("build-chain1",SequenceTask,build_tasks.subList(0, build_tasks.size()/2 as int))
tasks.register("build-chain2",SequenceTask,build_tasks.subList(build_tasks.size()/2 as int,build_tasks.size()))
tasks.register("test-chain",SequenceTask,[
":common:clean",
":common:gen-1.20.1",
":1.20.1:fabric:runClient"
])
tasks.register("build-chain-1.21.0",SequenceTask,[
":common:clean",
":common:gen-1.21.0",
"build-jar-1.21.0-neoforge"
])
tasks.register("build-fabric-chain-1.21.0",SequenceTask,[
":common:clean",
":common:gen-1.21.0",
"build-jar-1.21.0-fabric"
])
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化