Skip to content

Commit 35bc538

Browse files
committed
Merge branch 'refs/heads/main' into bg
2 parents 1c3999f + bdf6a58 commit 35bc538

146 files changed

Lines changed: 4894 additions & 1430 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
# Default: normalize all text files to LF in the repository and on checkout.
2+
# Git auto-detects binary files and leaves them untouched.
3+
* text=auto eol=lf
4+
5+
# ─── Explicitly text – source & build ────────────────────────────────────────
6+
*.java text eol=lf
7+
*.kt text eol=lf
8+
*.kts text eol=lf
9+
*.groovy text eol=lf
10+
*.gradle text eol=lf
11+
12+
# ─── Configuration & data ─────────────────────────────────────────────────────
13+
*.properties text eol=lf
14+
*.toml text eol=lf
15+
*.xml text eol=lf
16+
*.json text eol=lf
17+
*.yaml text eol=lf
18+
*.yml text eol=lf
19+
*.csv text eol=lf
20+
*.html text eol=lf
21+
*.css text eol=lf
22+
*.txt text eol=lf
23+
*.md text eol=lf
24+
*.svg text eol=lf
25+
*.MF text eol=lf
26+
27+
# Gradle dependency-lock files
28+
*.lockfile text eol=lf
29+
30+
# ─── Scripts ──────────────────────────────────────────────────────────────────
31+
# Unix shell scripts must always use LF so they stay executable on Linux/macOS.
32+
*.sh text eol=lf
33+
gradlew text eol=lf
34+
35+
# CI pipeline scripts
36+
Jenkinsfile text eol=lf
37+
38+
# Windows batch files must keep CRLF so cmd.exe can parse them.
39+
*.bat text eol=crlf
40+
41+
# ─── Binary files ─────────────────────────────────────────────────────────────
42+
# Raster / animated images
43+
*.png binary
44+
*.apng binary
45+
*.jpg binary
46+
*.jpeg binary
47+
*.webp binary
48+
*.gif binary
49+
*.ico binary
50+
51+
# Archives & compiled artifacts
52+
*.jar binary
53+
*.zip binary
54+
*.class binary
55+
56+
# Cryptographic / certificate files
57+
*.der binary
58+
59+
# Minecraft schematic
60+
*.litematic binary
61+
62+
# Compiled / intermediate build artefacts
63+
*.bin binary
64+
*.probe binary
65+

.github/workflows/gradle.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,9 @@ jobs:
4848
name: HMCL-${{ env.SHORT_SHA }}-sh
4949
path: HMCL/build/libs/HMCL-*.sh
5050
archive: false
51+
- name: Upload DEB
52+
uses: actions/upload-artifact@v7
53+
with:
54+
name: HMCL-${{ env.SHORT_SHA }}-deb
55+
path: HMCL/build/libs/HMCL-*.deb
56+
archive: false

.github/workflows/release.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,16 +46,20 @@ jobs:
4646
wget "$HMCL_CI_DOWNLOAD_BASE_URI/HMCL-$HMCL_VERSION.jar.sha256"
4747
wget "$HMCL_CI_DOWNLOAD_BASE_URI/HMCL-$HMCL_VERSION.sh"
4848
wget "$HMCL_CI_DOWNLOAD_BASE_URI/HMCL-$HMCL_VERSION.sh.sha256"
49+
wget "$HMCL_CI_DOWNLOAD_BASE_URI/HMCL-$HMCL_VERSION.deb"
50+
wget "$HMCL_CI_DOWNLOAD_BASE_URI/HMCL-$HMCL_VERSION.deb.sha256"
4951
- name: Verify artifacts
5052
if: ${{ env.continue == 'true' }}
5153
run: |
5254
export JAR_SHA256=$(cat HMCL-$HMCL_VERSION.jar.sha256 | tr -d '\n')
5355
export EXE_SHA256=$(cat HMCL-$HMCL_VERSION.exe.sha256 | tr -d '\n')
5456
export SH_SHA256=$(cat HMCL-$HMCL_VERSION.sh.sha256 | tr -d '\n')
57+
export DEB_SHA256=$(cat HMCL-$HMCL_VERSION.deb.sha256 | tr -d '\n')
5558
5659
echo "$JAR_SHA256 HMCL-$HMCL_VERSION.jar" | sha256sum -c
5760
echo "$EXE_SHA256 HMCL-$HMCL_VERSION.exe" | sha256sum -c
5861
echo "$SH_SHA256 HMCL-$HMCL_VERSION.sh" | sha256sum -c
62+
echo "$DEB_SHA256 HMCL-$HMCL_VERSION.deb" | sha256sum -c
5963
- name: Generate release note
6064
if: ${{ env.continue == 'true' }}
6165
run: |
@@ -67,6 +71,7 @@ jobs:
6771
echo "| [HMCL-$HMCL_VERSION.exe]($GH_DOWNLOAD_BASE_URL/v$HMCL_VERSION/HMCL-$HMCL_VERSION.exe) | \`$(cat HMCL-$HMCL_VERSION.exe.sha256)\` |" >> RELEASE_NOTE
6872
echo "| [HMCL-$HMCL_VERSION.jar]($GH_DOWNLOAD_BASE_URL/v$HMCL_VERSION/HMCL-$HMCL_VERSION.jar) | \`$(cat HMCL-$HMCL_VERSION.jar.sha256)\` |" >> RELEASE_NOTE
6973
echo "| [HMCL-$HMCL_VERSION.sh]($GH_DOWNLOAD_BASE_URL/v$HMCL_VERSION/HMCL-$HMCL_VERSION.sh) | \`$(cat HMCL-$HMCL_VERSION.sh.sha256)\` |" >> RELEASE_NOTE
74+
echo "| [HMCL-$HMCL_VERSION.deb]($GH_DOWNLOAD_BASE_URL/v$HMCL_VERSION/HMCL-$HMCL_VERSION.deb) | \`$(cat HMCL-$HMCL_VERSION.deb.sha256)\` |" >> RELEASE_NOTE
7075
7176
# CNB Release Note
7277
echo "[更新日志](https://docs.hmcl.net/changelog/${{ matrix.channel }}.html#HMCL-$HMCL_VERSION)" >> CNB_RELEASE_NOTE
@@ -76,6 +81,8 @@ jobs:
7681
echo "| [HMCL-$HMCL_VERSION.exe]($CNB_DOWNLOAD_BASE_URL/v$HMCL_VERSION/HMCL-$HMCL_VERSION.exe) | \`$(cat HMCL-$HMCL_VERSION.exe.sha256)\` |" >> CNB_RELEASE_NOTE
7782
echo "| [HMCL-$HMCL_VERSION.jar]($CNB_DOWNLOAD_BASE_URL/v$HMCL_VERSION/HMCL-$HMCL_VERSION.jar) | \`$(cat HMCL-$HMCL_VERSION.jar.sha256)\` |" >> CNB_RELEASE_NOTE
7883
echo "| [HMCL-$HMCL_VERSION.sh]($CNB_DOWNLOAD_BASE_URL/v$HMCL_VERSION/HMCL-$HMCL_VERSION.sh) | \`$(cat HMCL-$HMCL_VERSION.sh.sha256)\` |" >> CNB_RELEASE_NOTE
84+
echo "| [HMCL-$HMCL_VERSION.deb]($CNB_DOWNLOAD_BASE_URL/v$HMCL_VERSION/HMCL-$HMCL_VERSION.deb) | \`$(cat HMCL-$HMCL_VERSION.deb.sha256)\` |" >> CNB_RELEASE_NOTE
85+
7986
env:
8087
GH_DOWNLOAD_BASE_URL: https://github.com/${{ github.repository }}/releases/download
8188
CNB_DOWNLOAD_BASE_URL: https://cnb.cool/HMCL-dev/HMCL/-/releases/download
@@ -86,6 +93,7 @@ jobs:
8693
"HMCL-${{ env.HMCL_VERSION }}.exe" \
8794
"HMCL-${{ env.HMCL_VERSION }}.jar" \
8895
"HMCL-${{ env.HMCL_VERSION }}.sh" \
96+
"HMCL-${{ env.HMCL_VERSION }}.deb" \
8997
--target "${{ env.HMCL_COMMIT_SHA }}" \
9098
--title "${{ env.HMCL_TAG_NAME }}" \
9199
--notes-file RELEASE_NOTE \
@@ -120,6 +128,9 @@ jobs:
120128
121129
echo "Uploading HMCL-$HMCL_VERSION.sh"
122130
~/go/bin/git-cnb release asset-upload --repo="$CNB_REPO" --tag-name "$HMCL_TAG_NAME" --file-name "HMCL-$HMCL_VERSION.sh"
131+
132+
echo "Uploading HMCL-$HMCL_VERSION.deb"
133+
~/go/bin/git-cnb release asset-upload --repo="$CNB_REPO" --tag-name "$HMCL_TAG_NAME" --file-name "HMCL-$HMCL_VERSION.deb"
123134
env:
124135
CNB_TOKEN: ${{ secrets.CNB_SYNC_TOKEN }}
125136
CNB_REPO: HMCL-dev/HMCL

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,10 @@ language-subtag-registry
6464
# test
6565
/hmcl.json
6666
/.hmcl.json
67-
/.hmcl/
67+
/.hmcl/
68+
69+
# AI
70+
/.gemini/
71+
!/.gemini/config.yaml
72+
.codex
73+
/.gradle-*/

AGENTS.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Java Code Style Requirements
2+
3+
These rules apply to all Java code written or modified in this repository.
4+
5+
## Nullability
6+
7+
- Annotate every class with JetBrains Annotations `@NotNullByDefault`.
8+
- Any type, field, parameter, return value, local variable, or generic type argument that may be `null` must be explicitly annotated with `@Nullable`.
9+
- Nullability must never be implicit.
10+
11+
## Immutability
12+
13+
- Immutable arrays and collections must be explicitly annotated with JetBrains Annotations `@Unmodifiable` or `@UnmodifiableView` as appropriate.
14+
- For arrays, use type-use syntax such as `String @Unmodifiable []`.
15+
16+
## Documentation
17+
18+
- Every class, field, and method must have documentation.
19+
- Documentation must use `///` Markdown-style Javadoc comments.
20+
- Keep documentation accurate and specific to the actual behavior, constraints, and side effects.
21+
- Add concise implementation comments inside complex logic whenever they materially improve readability or explain non-obvious behavior.
22+
23+
## Gradle
24+
25+
- When invoking Gradle in this repository, always set `GRADLE_USER_HOME` to the workspace-local `.gradle-user-home` directory.
26+
- Prefer commands such as `./gradlew -g .gradle-user-home ...` or the equivalent environment-variable-based configuration.
27+
- When running Gradle `test` tasks, use a higher timeout of ten minutes.

HMCL/build.gradle.kts

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import org.jackhuang.hmcl.gradle.l10n.CreateLanguageList
66
import org.jackhuang.hmcl.gradle.l10n.CreateLocaleNamesResourceBundle
77
import org.jackhuang.hmcl.gradle.l10n.UpsideDownTranslate
88
import org.jackhuang.hmcl.gradle.mod.ParseModDataTask
9+
import org.jackhuang.hmcl.gradle.pack.CreateDeb
10+
import org.jackhuang.hmcl.gradle.pack.ReleaseType
911
import org.jackhuang.hmcl.gradle.utils.PropertiesUtils
1012
import java.net.URI
1113
import java.nio.file.FileSystems
@@ -56,7 +58,7 @@ dependencies {
5658
implementation(project(":HMCLCore"))
5759
implementation(project(":HMCLBoot"))
5860
implementation("libs:JFoenix")
59-
implementation(libs.twelvemonkeys.imageio.webp)
61+
implementation(libs.jwebp)
6062
implementation(libs.fxsvgimage)
6163
implementation(libs.java.info)
6264
implementation(libs.monet.fx)
@@ -195,7 +197,7 @@ tasks.shadowJar {
195197
exclude("META-INF/services/javax.imageio.spi.ImageInputStreamSpi")
196198

197199
listOf(
198-
"aix-*", "sunos-*", "openbsd-*", "dragonflybsd-*", "freebsd-*", "linux-*", "darwin-*",
200+
"aix-*", "sunos-*", "openbsd-*", "dragonflybsd-*", "freebsd-*", "linux-*",
199201
"*-ppc", "*-ppc64le", "*-s390x", "*-armel",
200202
).forEach { exclude("com/sun/jna/$it/**") }
201203

@@ -251,20 +253,22 @@ tasks.processResources {
251253
}
252254
}
253255

256+
fun artifactFile(ext: String) = jarPath.resolveSibling(jarPath.nameWithoutExtension + '.' + ext)
257+
254258
val makeExecutables by tasks.registering {
255259
val extensions = listOf("exe", "sh")
256260

257261
dependsOn(tasks.jar)
258262

259263
inputs.file(jarPath)
260-
outputs.files(extensions.map { File(jarPath.parentFile, jarPath.nameWithoutExtension + '.' + it) })
264+
outputs.files(extensions.map { artifactFile(it) })
261265

262266
doLast {
263267
val jarContent = jarPath.readBytes()
264268

265269
ZipFile(jarPath).use { zipFile ->
266270
for (extension in extensions) {
267-
val output = File(jarPath.parentFile, jarPath.nameWithoutExtension + '.' + extension)
271+
val output = artifactFile(extension)
268272
val entry = zipFile.getEntry("assets/HMCLauncher.$extension")
269273
?: throw GradleException("HMCLauncher.$extension not found")
270274

@@ -279,8 +283,31 @@ val makeExecutables by tasks.registering {
279283
}
280284
}
281285

286+
val makeDeb by tasks.registering(CreateDeb::class) {
287+
dependsOn(makeExecutables)
288+
289+
val debFile = layout.file(provider { artifactFile("deb") })
290+
291+
val debChannel = when (versionType) {
292+
"stable" -> ReleaseType.STABLE
293+
"dev" -> ReleaseType.DEVELOPMENT
294+
else -> ReleaseType.NIGHTLY
295+
}
296+
297+
version.set(project.version.toString())
298+
releaseType.set(debChannel)
299+
appShFile.set(layout.file(provider { artifactFile("sh") }))
300+
iconFile.set(layout.projectDirectory.file("image/hmcl.png"))
301+
outputFile.set(debFile)
302+
303+
doLast {
304+
createChecksum(debFile.get().asFile)
305+
}
306+
}
307+
282308
tasks.build {
283309
dependsOn(makeExecutables)
310+
dependsOn(makeDeb)
284311
}
285312

286313
fun parseToolOptions(options: String?): MutableList<String> {
@@ -377,12 +404,14 @@ val upgradeTerracottaConfig = tasks.register<TerracottaConfigUpgradeTask>("upgra
377404
val destination = layout.projectDirectory.file("src/main/resources/assets/terracotta.json")
378405
val source = layout.projectDirectory.file("terracotta-template.json");
379406

380-
classifiers.set(listOf(
381-
"windows-x86_64", "windows-arm64",
382-
"macos-x86_64", "macos-arm64",
383-
"linux-x86_64", "linux-arm64", "linux-loongarch64", "linux-riscv64",
384-
"freebsd-x86_64"
385-
))
407+
classifiers.set(
408+
listOf(
409+
"windows-x86_64", "windows-arm64",
410+
"macos-x86_64", "macos-arm64",
411+
"linux-x86_64", "linux-arm64", "linux-loongarch64", "linux-riscv64",
412+
"freebsd-x86_64"
413+
)
414+
)
386415

387416
version.set(libs.versions.terracotta)
388417
downloadURL.set($$"https://github.com/burningtnt/Terracotta/releases/download/v${version}/terracotta-${version}-${classifier}-pkg.tar.gz")

HMCL/image/8mi-tech.png

10 KB
Loading

0 commit comments

Comments
 (0)