Version port script and compile check for pull requests #19

Merged
selimaj-dev merged 1 commits from port-tooling into master 2026-09-26 00:52:58 +00:00
Owner

Closes #17 and #18. Follows up #8, which kept separate version modules and made porting cheaper with tooling instead.

Summary

scripts/port.sh (#17)

Ports a change made under one version's versions/<mc>/src to the other versions:

  1. Source: uncommitted changes, auto-detected when exactly one version has them, or a commit with --commit <rev>. New untracked files are included by marking them git add -N.
  2. Diff: taken with --full-index. For each target version, only the file headers are rewritten to point at that version's folder.
  3. Already applied: targets where the patch applies in reverse are skipped ("already has this change"), so re-running is safe.
  4. Merge: the rest is applied with git apply --3way. It's clean where files match, and gives normal conflict markers only where a version's code really differs (ours = the version's code, theirs = the ported change).
  5. Report: each version is listed as applied / CONFLICTS (with files) / already has this change / FAILED, and the script exits 1 if anything needs attention.

Options: --from, --to v1,v2, --commit, --dry-run. Only src/ is ported; build.gradle and gradle.properties are version-specific on purpose. It's compatible with macOS's bash 3.2.

.gitea/workflows/check.yml (#18)

Runs ./gradlew compileJava --continue for every version on pull requests and on pushes to master, with the common submodule. It catches missed or bad ports, including code that ported cleanly as text but uses an API a version doesn't have. --continue reports every failing version in one run.

VERSION_GUIDE.md

The one-line stub now documents the layout, porting a change (script usage and outcomes), and adding a new Minecraft version.

Testing

The port script was tested in a throwaway clone:

  • An edit to a region of TabListMixin shared by all versions applied cleanly to all 7 other versions.
  • An edit to the version-specific line (profile.name()) applied to 1.21.9 and 1.21.10, and conflicted on 1.21.4–1.21.8 with the correct ours/theirs markers. Exit code 1.
  • A new file was created in every version.
  • A re-run gave "already has this change" everywhere.
  • --dry-run, --commit HEAD --to 1.21.4,1.21.9, an unknown version, and nothing to port all behaved as intended.

The check workflow's first run is this PR.

🤖 Generated with Claude Code

Closes #17 and #18. Follows up #8, which kept separate version modules and made porting cheaper with tooling instead. ## Summary ### `scripts/port.sh` (#17) Ports a change made under one version's `versions/<mc>/src` to the other versions: 1. **Source:** uncommitted changes, auto-detected when exactly one version has them, or a commit with `--commit <rev>`. New untracked files are included by marking them `git add -N`. 2. **Diff:** taken with `--full-index`. For each target version, only the file headers are rewritten to point at that version's folder. 3. **Already applied:** targets where the patch applies in reverse are skipped ("already has this change"), so re-running is safe. 4. **Merge:** the rest is applied with `git apply --3way`. It's clean where files match, and gives normal conflict markers only where a version's code really differs (`ours` = the version's code, `theirs` = the ported change). 5. **Report:** each version is listed as applied / CONFLICTS (with files) / already has this change / FAILED, and the script exits 1 if anything needs attention. Options: `--from`, `--to v1,v2`, `--commit`, `--dry-run`. Only `src/` is ported; `build.gradle` and `gradle.properties` are version-specific on purpose. It's compatible with macOS's bash 3.2. ### `.gitea/workflows/check.yml` (#18) Runs `./gradlew compileJava --continue` for every version on pull requests and on pushes to `master`, with the `common` submodule. It catches missed or bad ports, including code that ported cleanly as text but uses an API a version doesn't have. `--continue` reports every failing version in one run. ### `VERSION_GUIDE.md` The one-line stub now documents the layout, porting a change (script usage and outcomes), and adding a new Minecraft version. ## Testing The port script was tested in a throwaway clone: - An edit to a region of `TabListMixin` shared by all versions **applied cleanly to all 7** other versions. - An edit to the version-specific line (`profile.name()`) **applied to 1.21.9 and 1.21.10, and conflicted on 1.21.4–1.21.8** with the correct `ours`/`theirs` markers. Exit code 1. - A new file was created in every version. - A re-run gave "already has this change" everywhere. - `--dry-run`, `--commit HEAD --to 1.21.4,1.21.9`, an unknown version, and nothing to port all behaved as intended. **The check workflow's first run is this PR.** 🤖 Generated with [Claude Code](https://claude.com/claude-code)
selimaj-dev added 1 commit 2026-09-26 00:52:24 +00:00
Add a version port script and a compile check for pull requests
Check / compile (pull_request) Successful in 18m7s
f73f7e733c
- scripts/port.sh ports a change made under versions/<from>/src to the
  other versions with `git apply --3way`: clean where files match,
  normal conflicts only where a version really differs. Supports
  uncommitted changes or --commit, --to, --dry-run, and detects changes
  already applied.
- .gitea/workflows/check.yml compiles every version on pull requests and
  pushes to master (--continue reports all failing versions).
- VERSION_GUIDE.md documents the layout, porting, and adding a version.

Closes #17, closes #18

Co-Authored-By: Claude Opus 5.5 <[email protected]>
selimaj-dev merged commit 41f9be8595 into master 2026-09-26 00:52:58 +00:00
selimaj-dev deleted branch port-tooling 2026-09-26 02:14:50 +00:00
Sign in to join this conversation.