Skip to content

Commit bbbea8e

Browse files
committed
Keep release jars clean and use UTF-8
Remove Windows folder metadata and use UTF-8/LF for sources and Javadocs on every platform.
1 parent bc4e4db commit bbbea8e

5 files changed

Lines changed: 21 additions & 19 deletions

File tree

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ libs/*
3131
!/libs/README.txt
3232

3333
.DS_Store
34+
[Dd]esktop.ini
35+
[Tt]humbs.db
3436

3537
# Local working notes and generated validation reports
3638
AGENTS.md

‎CHANGELOG.txt‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,7 @@
3434
- Connect this target to the shared release action, using one verified bundle
3535
for Maven, CurseForge and GitHub. Keep publication behind explicit confirmation.
3636
- Normalize changed text files to LF and fix the stray import whitespace.
37+
- Leave Windows folder metadata out of downloads and use UTF-8 for sources
38+
and Javadocs on every platform.
3739

3840
2.5.0 for 1.10.2

‎build.gradle‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,23 @@ tasks.withType(Javadoc).configureEach {
3434
failOnError = false
3535
options.encoding = 'UTF-8'
3636
options.addStringOption('Xdoclint:none', '-quiet')
37+
options.addStringOption('docencoding', 'UTF-8')
38+
options.addStringOption('charset', 'UTF-8')
3739
options.addBooleanOption('notimestamp', true)
3840
}
3941
tasks.withType(AbstractArchiveTask).configureEach {
4042
preserveFileTimestamps = false
4143
reproducibleFileOrder = true
4244
includeEmptyDirs = false
45+
exclude '**/desktop.ini', '**/Thumbs.db', '**/.DS_Store'
4346
}
4447
// Mapped dependency bytes no longer match their original signatures. Keep the
4548
// verified downloads intact and strip signatures only from renamed copies.
4649
tasks.withType(net.minecraftforge.renamer.gradle.RenameJar).configureEach {
4750
additionalArgs.addAll('--strip-sigs', 'ALL', '--disable-abstract-param')
4851
}
4952

50-
def textPatterns = ['cfg', 'info', 'java', 'json', 'lang', 'mcmeta', 'md', 'properties', 'txt', 'xml']
53+
def textPatterns = ['cfg', 'css', 'html', 'info', 'java', 'js', 'json', 'lang', 'mcmeta', 'md', 'properties', 'txt', 'xml']
5154
.collect { "**/*.${it}".toString() }
5255
def normalizeText = { details ->
5356
details.filter(FixCrLfFilter, eol: FixCrLfFilter.CrLf.newInstance('lf'),
@@ -141,6 +144,7 @@ renamer.mappings.from minecraft.dependency.toSrgFile
141144

142145
tasks.named('processResources', ProcessResources) {
143146
filteringCharset = 'UTF-8'
147+
exclude '**/desktop.ini', '**/Thumbs.db', '**/.DS_Store'
144148
inputs.property 'version', project.version
145149
inputs.property 'mcversion', project.minecraft_version
146150
filesMatching('mcmod.info') { expand version: project.version, mcversion: project.minecraft_version }
@@ -158,7 +162,10 @@ tasks.named('jar', Jar) {
158162
'FMLCorePluginContainsFMLMod': 'true', 'FMLCorePlugin': project.coreplugin)
159163
}
160164
['sourcesJar', 'javadocJar'].each { name ->
161-
tasks.named(name, Jar) { filesMatching(textPatterns, normalizeText) }
165+
tasks.named(name, Jar) {
166+
filteringCharset = 'UTF-8'
167+
filesMatching(textPatterns, normalizeText)
168+
}
162169
}
163170

164171
ext.baseMetalsBuild = [developmentOutput: developmentOutput].asImmutable()

‎gradle/release/artifacts.gradle‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ def auditJars = { File directory ->
6868
if (path.startsWith('review/') || path.contains('probe') || path.contains('fixture')
6969
|| path.contains('agent-notes') || path.contains('agents.md') || path.contains('.codex')
7070
|| path.contains('.agents') || path.contains('claude') || path.contains('gemini')
71+
|| path.tokenize('/').any { it in ['desktop.ini', 'thumbs.db', '.ds_store'] }
7172
|| path.startsWith('tools/') || path.startsWith('reference/')
7273
|| path.startsWith('com/mcmoddev/lib/oregen/')
7374
|| path.startsWith('com/mcmoddev/orespawn/')
@@ -79,6 +80,13 @@ def auditJars = { File directory ->
7980
if (!entry.directory && !(date.toString() in ['1980-01-01T00:00', '1980-02-01T00:00'])) {
8081
throw new GradleException("Volatile archive timestamp: ${entry.name}")
8182
}
83+
if (!entry.directory && path ==~ /.*\.(java|html|css|js|json|lang|mcmeta|md|txt|xml|cfg|info|properties)/) {
84+
def decoder = java.nio.charset.StandardCharsets.UTF_8.newDecoder()
85+
.onMalformedInput(java.nio.charset.CodingErrorAction.REPORT)
86+
.onUnmappableCharacter(java.nio.charset.CodingErrorAction.REPORT)
87+
String content = decoder.decode(java.nio.ByteBuffer.wrap(zip.getInputStream(entry).bytes)).toString()
88+
if (content.contains('\r')) throw new GradleException("Non-LF text in ${entry.name}")
89+
}
8290
if (!entry.directory && path ==~ /.*\.(class|java|html|json|info|xml|properties|txt|md|lang|cfg)/) {
8391
String content = new String(zip.getInputStream(entry).bytes,
8492
java.nio.charset.StandardCharsets.ISO_8859_1)

‎src/main/resources/assets/basemetals/models/block/desktop.ini‎

Lines changed: 0 additions & 17 deletions
This file was deleted.

0 commit comments

Comments
 (0)