Skip to content

refactor(linux): split phpvm.sh into linux/src modules built by build.sh - #33

Merged
devhardiyanto merged 1 commit into
mainfrom
split-linux-modules
Jul 30, 2026
Merged

refactor(linux): split phpvm.sh into linux/src modules built by build.sh#33
devhardiyanto merged 1 commit into
mainfrom
split-linux-modules

Conversation

@devhardiyanto

Copy link
Copy Markdown
Owner

What

linux/phpvm.sh (1914 baris) dipecah jadi 16 modul di linux/src/, digabung balik jadi satu file terkirim oleh build.sh baru. Mirror pola B8 yang sudah jalan di Windows sejak 1.13.0. Bump 1.14.0 → 1.15.0.

Why

Sejak paritas v1.14.0, phpvm.sh justru lebih besar dari file Windows yang generated. Satu file 1914 baris bikin tiap perubahan harus di-scroll dulu; sisi Windows sudah membuktikan modul + drift gate = ongkos rendah, bukan utang.

How

  • Concat di build time, bukan source per-modul: install.sh dan phpvm upgrade menarik satu file mentah dari raw.githubusercontent/.../main/linux/phpvm.sh — multi-file akan memecah model distribusi dan menghilangkan atomicity upgrade. Alasannya identik dengan Windows.
  • Di bash urutan definisi fungsi tidak load-bearing (body baru dievaluasi saat dipanggil). Yang mengikat hanya dua ujung: konstanta (00-header.sh) di depan, blok init source-time (99-entry.sh) di akhir. Modul di antaranya disusun murni demi keterbacaan.
  • Penomoran meniru Windows supaya navigasi antar dua implementasi transfer. Yang khas Linux (20-os, 25-openssl, 30-deps, 35-buildlog) muncul karena Linux build-from-source; Windows punya 35-cacert yang Linux tak butuh.
  • ShellCheck tetap hanya ke file generated — modul adalah fragment, bukan skrip standalone. Drift gate yang mengikat keduanya.

Changes

  • linux/src/*.sh — 16 modul (00-header99-entry)
  • build.sh (root) — concat + --check untuk drift; linux/phpvm.sh jadi generated (banner DO NOT EDIT + penanda # --- src/<modul> per modul)
  • .github/workflows/ci.yml — step bash ./build.sh --check sebelum ShellCheck
  • README.md — section Development mencakup dua build (Windows + Linux)
  • Bump 1.14.0 → 1.15.0: version.txt, linux/install.sh, linux/src/00-header.sh, windows/install.ps1, windows/src/00-header.ps1 + dua file generated

Testing Done

  • Pure move terbukti: multiset baris non-kosong file generated vs phpvm.sh sebelumnya → 1680 == 1680, diff kosong. (Byte-per-byte tak dipakai karena modul memang menyusun ulang urutan fungsi.)
  • bats 112/112
  • Pester 168/168 (Windows tak tersentuh selain bump versi)
  • bash ./build.sh --check + pwsh ./build.ps1 -Check OK · bash -n + zsh -n OK
  • zsh smoke: 4 failure di mesin dev msys2 — pre-existing, output file lama dan file baru identik (quirk grep Windows). Gate sebenarnya = job zsh di CI ubuntu.

phpvm.sh reaches 1914 lines while its Windows twin has been modular since
1.13.0. Mirror that split: 16 modules in linux/src/, concatenated back into
the single shipped phpvm.sh by build.sh, with a --check drift gate in CI.
Distribution is unchanged - install.sh and `phpvm upgrade` still fetch one
raw file, which is why this concatenates at build time rather than sourcing
modules at load time.

Unlike PowerShell, bash resolves function bodies at call time, so only the
ends of the file are load-bearing: constants first, source-time init last.
The modules in between are ordered for readability.

Pure move - verified by comparing the multiset of non-blank lines against
the previous phpvm.sh (1680 == 1680). Bump 1.14.0 -> 1.15.0.

devhardiyanto
@devhardiyanto
devhardiyanto merged commit 2e11692 into main Jul 30, 2026
5 checks passed
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.

1 participant