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
|
// TODO: Consider if this is still important 😬 |
|
// // Delete any stale build artifacts before building |
|
// // This is important, since we might rename the output files |
|
// await fs.promises.rm(context.outputPath, { |
|
// recursive: true, |
|
// force: true, |
|
// }); |
|
await platform.build(context, baseOptions); |
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
|
}); |
|
const newLibraryPath = path.join(frameworkPath, libraryName); |
|
// TODO: Consider copying the library instead of renaming it |
|
await fs.promises.rename(libraryPath, newLibraryPath); |
|
await updateLibraryInstallName({ |
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
|
if (!foundBuildPhase) { |
|
console.log("Adding new build phase"); |
|
// TODO: Consider declaring input and output files to prevent unnecessary runs |
|
target.createBuildPhase(xcode.PBXShellScriptBuildPhase, { |
|
name: BUILD_PHASE_NAME, |
|
shellScript, |
|
}); |
|
saveProject = true; |
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.
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
react-native-node-api/packages/cmake-rn/src/cli.ts
Lines 306 to 313 in 29a527d
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.soand the current one produces a differently named artifact, the stale file survives inoutputPathand 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.createFrameworkrenames its input instead of copyingreact-native-node-api/packages/host/src/node/prebuilds/apple.ts
Lines 106 to 110 in 29a527d
fs.promises.renamemoves 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
react-native-node-api/packages/host/src/node/cli/apple.ts
Lines 87 to 94 in 29a527d
A
PBXShellScriptBuildPhasewithoutinputPaths/outputPathsruns 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.