Skip to content

React-RCTAppDelegate unstable checksum in Podfile.lock (new architecture) #39971

Description

@heath-clink

Description

We observed that the checksum for React-RCTAppDelegate in Podfile.lock was unstable, in that it changes from one developer to another. This causes a problem with our CI which uses the --deployment flag to pod install, causing it to fail because the checksum for React-RCTAppDelegate appears to have changed.

Tracked it down to ios/Pods/Local Podspecs/React-RCTAppDelegate.podspec.json which contains a fully-qualified path like /Users/redacted-username/depots/myapp/etc which will be different for different users/environments, and so the checksum of that file will be different for those different users.

React Native Version

0.72.5

Output of npx react-native info

info Fetching system and libraries information...
System:
OS: macOS 13.5.2
CPU: (10) arm64 Apple M1 Max
Memory: 114.30 MB / 32.00 GB
Shell:
version: 3.2.57
path: /bin/bash
Binaries:
Node:
version: 18.17.0
path: ~/.nvm/versions/node/v18.17.0/bin/node
Yarn:
version: 1.22.19
path: ~/.nvm/versions/node/v18.17.0/bin/yarn
npm:
version: 9.6.7
path: ~/.nvm/versions/node/v18.17.0/bin/npm
Watchman:
version: 2023.08.28.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.12.1
path: /Users/username-redacted/.rbenv/shims/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 22.2
- iOS 16.2
- macOS 13.1
- tvOS 16.1
- watchOS 9.1
Android SDK: Not Found
IDEs:
Android Studio: 2022.3 AI-223.8836.35.2231.10406996
Xcode:
version: 14.2/14C18
path: /usr/bin/xcodebuild
Languages:
Java:
version: 11.0.20
path: /Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home/bin/javac
Ruby:
version: 2.6.10
path: /Users/username-redacted/.rbenv/shims/ruby
npmPackages:
"@react-native-community/cli": Not Found
react:
installed: 18.2.0
wanted: 18.2.0
react-native:
installed: 0.72.5
wanted: 0.72.5
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: true

Steps to reproduce

  1. mkdir example1 example2
  2. (cd example1 && npx react-native@latest init AwesomeProject)
  3. (cd example2 && npx react-native@latest init AwesomeProject)
  4. (cd example1/AwesomeProject/ios && RCT_NEW_ARCH_ENABLED=1 bundle exec pod install)
  5. (cd example2/AwesomeProject/ios && RCT_NEW_ARCH_ENABLED=1 bundle exec pod install)
  6. diff example?/AwesomeProject/ios/Podfile.lock
  7. Observe different checksums for React-RCTAppDelegate, should be the same.
  8. diff example?/AwesomeProject/ios/Pods/Local\ Podspecs/React-RCTAppDelegate.podspec.json
  9. Observe differing paths, which is the cause of differing checksums

Snack, screenshot, or link to a repository

no reproducer needed, just follow the steps to reproduce

Activity

  1. github-actions commented on Oct 6, 2023

    @github-actions
    ⚠️ Missing Reproducible Example
    ℹ️ We could not detect a reproducible example in your issue report. Please provide either:
    • If your bug is UI related: a Snack
    • If your bug is build/update related: use our Reproducer Template. A reproducer needs to be in a GitHub repository under your username.
  2. added
    Needs: ReproThis issue could be improved with a clear list of steps to reproduce the issue.
    on Oct 6, 2023
  3. heath-clink commented on Oct 6, 2023

    @heath-clink
    Author

    This patch replaces ENV['APP_PATH] with ${REACT_NATIVE_PATH}/../... This fixes the issue in my environment but there may be a better way to implement the fix.

    --- a/node_modules/react-native/Libraries/AppDelegate/React-RCTAppDelegate.podspec
    +++ b/node_modules/react-native/Libraries/AppDelegate/React-RCTAppDelegate.podspec
    @@ -101,10 +101,10 @@ Pod::Spec.new do |s|
           :script => "
     WITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"
     source $WITH_ENVIRONMENT
    -${NODE_BINARY} ${REACT_NATIVE_PATH}/scripts/codegen/generate-legacy-interop-components.js -p #{ENV['APP_PATH']} -o ${REACT_NATIVE_PATH}/Libraries/AppDelegate
    +${NODE_BINARY} ${REACT_NATIVE_PATH}/scripts/codegen/generate-legacy-interop-components.js -p ${REACT_NATIVE_PATH}/../.. -o ${REACT_NATIVE_PATH}/Libraries/AppDelegate
           ",
           :execution_position => :before_compile,
    -      :input_files => ["#{ENV['APP_PATH']}/react-native.config.js"],
    +      :input_files => ["${REACT_NATIVE_PATH}/../../react-native.config.js"],
           :output_files => ["${REACT_NATIVE_PATH}/Libraries/AppDelegate/RCTLegacyInteropComponents.mm"],
         }
       end
    
  4. cortinico commented on Oct 13, 2023

    @cortinico
    Contributor

    Duplicates #31121

  5. heath-clink commented on Oct 13, 2023

    @heath-clink
    Author

    This is NOT a duplicate of #31121. That was fixed by commits which are already in currently released react-native versions. This is a different podspec file than the one in #31121.

  6. github-actions commented on Oct 16, 2023

    @github-actions
  7. cortinico commented on Oct 16, 2023

    @cortinico
    Contributor

    This is NOT a duplicate of #31121. That was fixed by commits which are already in currently released react-native versions. This is a different podspec file than the one in #31121.

    Thanks for the clarification @heath-clink.
    @cipolleschi can you take a look at this one?

  8. cipolleschi commented on Oct 16, 2023

    @cipolleschi
    Contributor

    The problem here is that the script needs to access to the root project.
    The ENV['APP_PATH'] is the right environment variable that allow us to retrieve that.

    The suggested patch works for you but is not general enough to be applied to everyone.

    I think that the proper approach is to:

    1. fetch the ENV['APP_PATH'] value to get the path to the app
    2. fetch the pods path, where the pods are installed
    3. compute the relative path from the pods path to the app path
    4. use that as base relative path.

    I'll try to put up something.

  9. added a commit that references this issue on Nov 7, 2023
  10. github-actions commented on Apr 14, 2024

    @github-actions

    This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 7 days.

  11. added
    StaleThere has been a lack of activity on this issue and it may be closed soon.
    on Apr 14, 2024
  12. github-actions commented on Apr 23, 2024

    @github-actions

    This issue was closed because it has been stalled for 7 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions