Skip to content

Commit b6a97dc

Browse files
committed
updated project script
1 parent dc5bce5 commit b6a97dc

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/rn-tester/RNTester-SPM.xcodeproj/project.pbxproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@
261261
);
262262
runOnlyForDeploymentPostprocessing = 0;
263263
shellPath = /bin/sh;
264-
shellScript = "set -euo pipefail\n\nSTAMP=\"$SRCROOT/build/generated/autolinking/.spm-sync-stamp\"\nSTALE=0\n\n# Check 0: xcframework artifacts missing (fresh clone)\nif [ ! -f \"$SRCROOT/build/xcframeworks/artifacts.json\" ] || \\\n [ ! -d \"$SRCROOT/build/xcframeworks/React.xcframework\" ]; then\n STALE=1\nfi\n\n# Find project root (where package.json lives — may be an ancestor of SRCROOT)\nPROJECT_ROOT=\"$SRCROOT\"\nwhile [ \"$PROJECT_ROOT\" != \"/\" ] && [ ! -f \"$PROJECT_ROOT/package.json\" ]; do\n PROJECT_ROOT=\"$(dirname \"$PROJECT_ROOT\")\"\ndone\nif [ ! -f \"$PROJECT_ROOT/package.json\" ]; then\n PROJECT_ROOT=\"$SRCROOT\"\nfi\n\n# Check 1: dependency inputs (covers app projects after any package manager install)\nfor INPUT in \\\n \"$PROJECT_ROOT/package.json\" \\\n \"$PROJECT_ROOT/react-native.config.js\"; do\n if [ -f \"$INPUT\" ] && [ \"$INPUT\" -nt \"$STAMP\" ]; then\n STALE=1\n break\n fi\ndone\n\n# Check workspace lockfiles and package-manager metadata. These cover package\n# managers that do not reliably bump node_modules mtimes, and Yarn PnP projects\n# that do not have node_modules at all.\nif [ \"$STALE\" -eq 0 ]; then\n DIR=\"$PROJECT_ROOT\"\n while [ \"$DIR\" != \"/\" ]; do\n for INPUT in \\\n \"$DIR/package-lock.json\" \\\n \"$DIR/npm-shrinkwrap.json\" \\\n \"$DIR/yarn.lock\" \\\n \"$DIR/pnpm-lock.yaml\" \\\n \"$DIR/bun.lock\" \\\n \"$DIR/bun.lockb\" \\\n \"$DIR/.pnp.cjs\" \\\n \"$DIR/.pnp.loader.mjs\"; do\n if [ -f \"$INPUT\" ] && [ \"$INPUT\" -nt \"$STAMP\" ]; then\n STALE=1\n break\n fi\n done\n if [ \"$STALE\" -eq 1 ]; then\n break\n fi\n DIR=\"$(dirname \"$DIR\")\"\n done\nfi\n\n# Check node_modules mtime. In monorepos, node_modules may be hoisted to any\n# ancestor between the app package and the workspace root.\nif [ \"$STALE\" -eq 0 ]; then\n DIR=\"$PROJECT_ROOT\"\n while [ \"$DIR\" != \"/\" ]; do\n NM_DIR=\"$DIR/node_modules\"\n if [ -d \"$NM_DIR\" ] && [ \"$NM_DIR\" -nt \"$STAMP\" ]; then\n STALE=1\n break\n fi\n DIR=\"$(dirname \"$DIR\")\"\n done\nfi\n\n# Also check the app root directly when SRCROOT is not the package root.\nif [ \"$STALE\" -eq 0 ] && [ \"$SRCROOT\" != \"$PROJECT_ROOT\" ]; then\n if [ -d \"$SRCROOT/node_modules\" ] && [ \"$SRCROOT/node_modules\" -nt \"$STAMP\" ]; then\n STALE=1\n fi\nfi\n\n# Check 2: codegen spec files changed via git (covers monorepo after git pull)\nif [ \"$STALE\" -eq 0 ] && [ -f \"$STAMP\" ]; then\n STAMP_TIME=$(stat -f %m \"$STAMP\" 2>/dev/null || stat -c %Y \"$STAMP\" 2>/dev/null || echo 0)\n LATEST_SPEC_COMMIT=$(git -C \"$SRCROOT\" log -1 --format=%ct -- '*.js' '*.ts' 2>/dev/null || echo 0)\n if [ \"$LATEST_SPEC_COMMIT\" -gt \"$STAMP_TIME\" ]; then\n STALE=1\n fi\nfi\n\nif [ ! -f \"$STAMP\" ]; then\n STALE=1\nfi\n\nif [ \"$STALE\" -eq 0 ]; then\n exit 0\nfi\n\necho \"SPM sync inputs changed — re-syncing (codegen + autolinking)...\"\n\nWITH_ENVIRONMENT=\"../react-native/scripts/xcode/with-environment.sh\"\nSYNC_SCRIPT=\"../react-native/scripts/spm/sync-spm-autolinking.js\"\n\nif [ -f \"$WITH_ENVIRONMENT\" ]; then\n # with-environment.sh references PODS_ROOT and $1, which may be unset.\n # Temporarily disable nounset to avoid failures when sourcing.\n export PODS_ROOT=\"${PODS_ROOT:-$SRCROOT}\"\n set +u\n . \"$WITH_ENVIRONMENT\"\n set -u\nfi\n\nif command -v node >/dev/null 2>&1; then\n node \"$SYNC_SCRIPT\" --app-root \"$SRCROOT\" --react-native-root \"$SRCROOT/../react-native\" || {\n echo \"warning: SPM sync failed — build may use stale codegen/autolinking\"\n exit 0\n }\nelse\n echo \"warning: node not found — skipping SPM sync\"\n exit 0\nfi\n";
264+
shellScript = "set -euo pipefail\n\nSTAMP=\"$SRCROOT/build/generated/autolinking/.spm-sync-stamp\"\nSTALE=0\n\n# Check 0: xcframework artifacts missing (fresh clone)\nif [ ! -f \"$SRCROOT/build/xcframeworks/artifacts.json\" ] || \\\n [ ! -d \"$SRCROOT/build/xcframeworks/React.xcframework\" ]; then\n STALE=1\nfi\n\n# Find project root (where package.json lives — may be an ancestor of SRCROOT)\nPROJECT_ROOT=\"$SRCROOT\"\nwhile [ \"$PROJECT_ROOT\" != \"/\" ] && [ ! -f \"$PROJECT_ROOT/package.json\" ]; do\n PROJECT_ROOT=\"$(dirname \"$PROJECT_ROOT\")\"\ndone\nif [ ! -f \"$PROJECT_ROOT/package.json\" ]; then\n PROJECT_ROOT=\"$SRCROOT\"\nfi\n\n# Check 1: dependency inputs (covers app projects after any package manager install)\nfor INPUT in \\\n \"$PROJECT_ROOT/package.json\" \\\n \"$PROJECT_ROOT/react-native.config.js\"; do\n if [ -f \"$INPUT\" ] && [ \"$INPUT\" -nt \"$STAMP\" ]; then\n STALE=1\n break\n fi\ndone\n\n# Check workspace lockfiles and package-manager metadata. These cover package\n# managers that do not reliably bump node_modules mtimes, and Yarn PnP projects\n# that do not have node_modules at all.\nif [ \"$STALE\" -eq 0 ]; then\n DIR=\"$PROJECT_ROOT\"\n while [ \"$DIR\" != \"/\" ]; do\n for INPUT in \\\n \"$DIR/package-lock.json\" \\\n \"$DIR/npm-shrinkwrap.json\" \\\n \"$DIR/yarn.lock\" \\\n \"$DIR/pnpm-lock.yaml\" \\\n \"$DIR/bun.lock\" \\\n \"$DIR/bun.lockb\" \\\n \"$DIR/.pnp.cjs\" \\\n \"$DIR/.pnp.loader.mjs\"; do\n if [ -f \"$INPUT\" ] && [ \"$INPUT\" -nt \"$STAMP\" ]; then\n STALE=1\n break\n fi\n done\n if [ \"$STALE\" -eq 1 ]; then\n break\n fi\n DIR=\"$(dirname \"$DIR\")\"\n done\nfi\n\n# Check node_modules mtime. In monorepos, node_modules may be hoisted to any\n# ancestor between the app package and the workspace root.\nif [ \"$STALE\" -eq 0 ]; then\n DIR=\"$PROJECT_ROOT\"\n while [ \"$DIR\" != \"/\" ]; do\n NM_DIR=\"$DIR/node_modules\"\n if [ -d \"$NM_DIR\" ] && [ \"$NM_DIR\" -nt \"$STAMP\" ]; then\n STALE=1\n break\n fi\n DIR=\"$(dirname \"$DIR\")\"\n done\nfi\n\n# Also check the app root directly when SRCROOT is not the package root.\nif [ \"$STALE\" -eq 0 ] && [ \"$SRCROOT\" != \"$PROJECT_ROOT\" ]; then\n if [ -d \"$SRCROOT/node_modules\" ] && [ \"$SRCROOT/node_modules\" -nt \"$STAMP\" ]; then\n STALE=1\n fi\nfi\n\n# Check 2: codegen spec files changed via git (covers monorepo after git pull)\nif [ \"$STALE\" -eq 0 ] && [ -f \"$STAMP\" ]; then\n STAMP_TIME=$(stat -f %m \"$STAMP\" 2>/dev/null || stat -c %Y \"$STAMP\" 2>/dev/null || echo 0)\n LATEST_SPEC_COMMIT=$(git -C \"$SRCROOT\" log -1 --format=%ct -- '*.js' '*.ts' 2>/dev/null || echo 0)\n if [ \"$LATEST_SPEC_COMMIT\" -gt \"$STAMP_TIME\" ]; then\n STALE=1\n fi\nfi\n\nif [ ! -f \"$STAMP\" ]; then\n STALE=1\nfi\n\nif [ \"$STALE\" -eq 0 ]; then\n exit 0\nfi\n\necho \"SPM sync inputs changed — re-syncing (codegen + autolinking)...\"\n\nWITH_ENVIRONMENT=\"../react-native/scripts/xcode/with-environment.sh\"\n\nif [ -f \"$WITH_ENVIRONMENT\" ]; then\n # with-environment.sh references PODS_ROOT and $1, which may be unset.\n # Temporarily disable nounset to avoid failures when sourcing.\n export PODS_ROOT=\"${PODS_ROOT:-$SRCROOT}\"\n set +u\n . \"$WITH_ENVIRONMENT\"\n set -u\nfi\n\ncd \"$SRCROOT\"\nif command -v npx >/dev/null 2>&1; then\n npx react-native spm sync || {\n echo \"warning: SPM sync failed — build may use stale codegen/autolinking\"\n exit 0\n }\nelse\n echo \"warning: npx not found — skipping SPM sync\"\n exit 0\nfi\n";
265265
};
266266
81FE5423A9EB4933552FBA8F /* Prepare VFS Overlay */ = {
267267
isa = PBXShellScriptBuildPhase;

0 commit comments

Comments
 (0)