Skip to content

Commit

Permalink
rework build script
Browse files Browse the repository at this point in the history
  • Loading branch information
TexBlock committed Aug 7, 2024
1 parent e2493fe commit d7e3711
Show file tree
Hide file tree
Showing 14 changed files with 49 additions and 260 deletions.
28 changes: 7 additions & 21 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,26 +32,12 @@ jobs:
chmod +x gradlew
./gradlew mergeJars
- name: Upload artifacts (fabric)
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: fabric
path: ${{ github.workspace }}/fabric/build/libs

- name: Upload artifacts (forge)
uses: actions/upload-artifact@v4
with:
name: forge
path: ${{ github.workspace }}/forge/build/libs

- name: Upload artifacts (neoforge)
uses: actions/upload-artifact@v4
with:
name: neoforge
path: ${{ github.workspace }}/neoforge/build/libs

- name: Upload artifacts (Forgix merged jar)
uses: actions/upload-artifact@v4
with:
name: merged
path: ${{ github.workspace }}/build/libs/forgix
name: artifacts
path: |
${{ github.workspace }}/fabric/build/libs
${{ github.workspace }}/forge/build/libs
${{ github.workspace }}/neoforge/build/libs
${{ github.workspace }}/build/merged
11 changes: 1 addition & 10 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,2 @@
## Changelog
- use native api
- fix mod publish
- add mod info translation (Only Fabric & NeoForge)
- new icon

## Changelog
- 使用加载器本地API (不再使用Architectury API)
- 修复模组上传问题
- 添加模组信息翻译 (仅Fabric & NeoForge)
- 新图标
- forgix -> modfusioner
36 changes: 14 additions & 22 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ plugins {
id "dev.architectury.loom" version "1.6-SNAPSHOT" apply false
id "com.github.johnrengelman.shadow" version "8.+" apply false
id "com.hypherionmc.modutils.modpublisher" version "2.+"
id "io.github.pacifistmc.forgix" version "1.+"
id "com.hypherionmc.modutils.modfusioner" version "1.0.+"
}

architectury {
Expand Down Expand Up @@ -42,29 +42,23 @@ allprojects {
}
}

forgix {
group = rootProject.maven_group
mergedJarName = "${rootProject.archives_base_name}-${rootProject.version}.jar"
outputDir = "build/libs/forgix"
fusioner {
packageGroup = rootProject.maven_group
mergedJarName = "${rootProject.archives_base_name}"
outputDirectory = "build/merged"
jarVersion = rootProject.version

forge {
projectName = "forge"
jarLocation = "build/libs/${rootProject.archives_base_name}-forge-${rootProject.version}.jar"
neoforge {
projectName = "neoforge"
inputTaskName = "remapJar"
}

fabric {
projectName = "fabric"
jarLocation = "build/libs/${rootProject.archives_base_name}-fabric-${rootProject.version}.jar"
}

custom {
projectName = "neoforge"
jarLocation = "build/libs/${rootProject.archives_base_name}-neoforge-${ rootProject.version }.jar"
inputTaskName = "remapJar"
}
}

mergeJars.dependsOn(build)

publisher {
apiKeys {
curseforge(System.getenv("CURSEFORGE_TOKEN"))
Expand All @@ -76,11 +70,11 @@ publisher {
versionType = "release"
changelog = file("CHANGELOG.md").getText('UTF-8')
version = "$rootProject.version"
displayName = "VM Translation Update 1.20~1.20.4 ${rootProject.mod_version}"
gameVersions = ["1.20", "1.20.1", "1.20.2", "1.20.3", "1.20.4"]
displayName = "VM Translation Update 1.20.4 ${rootProject.mod_version}"
gameVersions = ["1.20.4"]
curseEnvironment = "client"
loaders = ["fabric", "quilt", "forge", "neoforge"]
artifact = (forgix.getOutputDir() + "/" + forgix.getMergedJarName())
loaders = ["fabric", "quilt", "neoforge"]
artifact = fusejars

modrinthDepends {
required "cloth-config"
Expand All @@ -90,5 +84,3 @@ publisher {
required "cloth-config"
}
}

publishMod.dependsOn(mergeJars)
14 changes: 0 additions & 14 deletions common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,3 @@ dependencies {
modImplementation "net.fabricmc:fabric-loader:${rootProject.fabric_loader_version}"
modApi "me.shedaniel.cloth:cloth-config:${rootProject.clothconfig_version}"
}

publishing {
publications {
mavenCommon(MavenPublication) {
artifactId = rootProject.archives_base_name
from components.java
}
}

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
}
}
36 changes: 11 additions & 25 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@ architectury {
project.archivesBaseName = rootProject.archivesBaseName + "-fabric"

configurations {
common
shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this.
common {
canBeResolved = true
canBeConsumed = false
}
compileClasspath.extendsFrom common
runtimeClasspath.extendsFrom common
developmentFabric.extendsFrom common
shadowBundle {
canBeResolved = true
canBeConsumed = false
}
}

repositories {
Expand All @@ -25,7 +31,7 @@ dependencies {
modApi("com.terraformersmc:modmenu:${rootProject.modmenu_version}") { transitive false }

common(project(path: ":common", configuration: "namedElements")) { transitive false }
shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
shadowBundle(project(path: ":common", configuration: "transformProductionFabric")) { transitive false }
}

processResources {
Expand All @@ -39,12 +45,12 @@ processResources {
shadowJar {
exclude "architectury.common.json"

configurations = [project.configurations.shadowCommon]
configurations = [project.configurations.shadowBundle]
archiveClassifier.set("dev-shadow")
}

remapJar {
input.set shadowJar.archiveFile
inputFile.set shadowJar.archiveFile
dependsOn shadowJar
archiveClassifier.set(null)
}
Expand All @@ -58,23 +64,3 @@ sourcesJar {
dependsOn commonSources
from commonSources.archiveFile.map { zipTree(it) }
}

components.java {
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
skip()
}
}

publishing {
publications {
mavenFabric(MavenPublication) {
artifactId = rootProject.archives_base_name + "-" + project.name
from components.java
}
}

// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
}
}
74 changes: 0 additions & 74 deletions forge/build.gradle

This file was deleted.

1 change: 0 additions & 1 deletion forge/gradle.properties

This file was deleted.

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions forge/src/main/resources/pack.mcmeta

This file was deleted.

4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ enabled_platforms=fabric,forge,neoforge
yarn_mappings=1.20.4+build.3

archives_base_name=VMTranslationUpdate
mod_version=2.4.0
mod_version=3.0.1
maven_group=top.vmctcn.vmtranslationupdate

clothconfig_version=13.0.121
Expand All @@ -16,7 +16,7 @@ modmenu_version=9.2.0-beta.2

forge_version=1.20.4-49.0.50

neoforge_version=20.4.234
neoforge_version=20.4.237

curseforge_id=890229
modrinth_id=wvCSIW08
Loading

0 comments on commit d7e3711

Please sign in to comment.