Skip to content

fix: don't include untouched files in build output#244

Open
bouclem wants to merge 1 commit into
MCPHackers:mainfrom
bouclem:fix/build-includes-untouched-files
Open

fix: don't include untouched files in build output#244
bouclem wants to merge 1 commit into
MCPHackers:mainfrom
bouclem:fix/build-includes-untouched-files

Conversation

@bouclem
Copy link
Copy Markdown

@bouclem bouclem commented May 26, 2026

Fixes #237.

Two bugs were causing unmodified files to leak into build output (e.g. user reports gui/items.png, terrain.png, ItemArmor$EnumArmorMaterial.class, TileEntityFurnace$1.class ending up in the zip even though they weren't touched after the MD5 update).

Bug 1 - Inner classes always extracted in TaskReobfuscate

The FileUtil.extract filter stripped $... from the obfuscated entry name, then looked the result up in reversedNames (a map keyed by obfuscated outer-class names). Inner classes have entries like ItemArmor$EnumArmorMaterial, and stripping the inner suffix gives ItemArmor - which isn't in the obfuscated map. The lookup returned null, the code fell back to using the obfuscated name as the deobf name, the hash lookup also missed, and extract was forced to true unconditionally.

Fix: resolve the deobfuscated name first (try the full entry name, then fall back to the outer class), then strip the inner-class suffix from that deobf name to build the hash key.

Bug 2 - Asset files never compared against MD5

TaskBuild walked every non-class file under bin/ and packed it into the build zip with no hash check, so any asset that was just a copy of the original (e.g. an unmodified terrain.png left over from the source layout) was always bundled. TaskUpdateMD5 already records hashes for these files, the build step just wasn't reading them.

Fix: in TaskBuild, read the original MD5 file once and only include assets whose current hash differs from the recorded one (or that have no recorded hash, i.e. genuinely new files).

Testing

  • gradlew build passes
  • No new dependencies
  • Same code path on the happy case (modified files still get packaged); only unmodified files are now excluded

Fixes MCPHackers#237. Two bugs caused unmodified files to leak into the build:

TaskReobfuscate's extract filter looked up the obfuscated outer-class name in the deobfuscated-by-obf map, which always missed for inner classes. The hash lookup then returned null and forced extract=true, so unchanged inner classes were always reobfuscated and bundled. Resolve the deobfuscated name first, then strip the inner-class suffix for the hash key.

TaskBuild packed every non-class file under bin/ into the build zip without consulting the recorded hashes. Now compares each asset against the original MD5 file and only includes new or modified ones, matching the behavior already used for classes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UpdateMD5 not considering all files

1 participant