Incremental build correctness: stale artifacts, destructive renames and undeclared build-phase I/O

Aperta
#422 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
64/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Tranquilla
Stack tecnologico
cmake, typescript

Direzione di ricerca

Inizia dal TODO di pulizia in packages/cmake-rn/src/cli.ts, quindi esamina createFramework in packages/host/src/node/prebuilds/apple.ts e la configurazione di PBXShellScriptBuildPhase in packages/host/src/node/cli/apple.ts. Confronta la gestione di Apple con packages/host/src/node/prebuilds/android.ts. Il lavoro è completo quando gli output obsoleti vengono rimossi, l’input Apple rimane nella directory di build di CMake e la fase Xcode dichiara i propri input e output, così che le build senza modifiche possano saltarla.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Apple 🍎 CMake RN Host 🏡

Three TODOs that individually look like nits but share a cause: the pipeline moves and renames build outputs, and none of the tooling around it knows that.

Stale build artifacts are no longer cleaned

https://github.com/callstackincubator/react-native-node-api/blob/29a527d87fa8cb965b0048b1b4c1cff2b0eab281/packages/cmake-rn/src/cli.ts#L306-L313

The cleanup is commented out with "Consider if this is still important 😬", and its own comment answers the question: it is important because we rename the output files. If a previous build left libfoo.so and the current one produces a differently named artifact, the stale file survives in outputPath and can be picked up downstream. Either restore it, or work out what made it unnecessary and delete the dead code with a note — leaving it commented out means neither.

createFramework renames its input instead of copying

https://github.com/callstackincubator/react-native-node-api/blob/29a527d87fa8cb965b0048b1b4c1cff2b0eab281/packages/host/src/node/prebuilds/apple.ts#L106-L110

fs.promises.rename moves the library out of the CMake build directory and into the framework, then rewrites its install name. From CMake's point of view its own output has vanished, so the next build has to relink — and any second consumer of that artifact finds it missing. Copying costs one file write and makes the step idempotent.

The Android side has the same shape but already copies (prebuilds/android.ts), so this is an inconsistency as much as a bug.

The Xcode build phase declares no inputs or outputs

https://github.com/callstackincubator/react-native-node-api/blob/29a527d87fa8cb965b0048b1b4c1cff2b0eab281/packages/host/src/node/cli/apple.ts#L87-L94

A PBXShellScriptBuildPhase without inputPaths/outputPaths runs on every single build, and Xcode says so in the build log. Declaring them lets Xcode skip the phase when nothing changed — the difference between a no-op incremental build and re-running the addon pipeline on every ⌘B. This one interacts with the two above: declaring outputs is only sound once the artifacts stay where they are claimed to be.

Lingua principale
TypeScript
Stelle
188
Fork
10
Merge medio
2g 17h
PR unite (30g)
3

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di callstackincubator/react-native-node-api

Tutte le issue di callstackincubator/react-native-node-api

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.