cli icon indicating copy to clipboard operation
cli copied to clipboard

perf(autolinking): get platform's specific properties

Open szymonrybczak opened this issue 3 months ago • 1 comments

Summary:

This Pull Request implements fetching only platform's specific properties. It means when passing --platform option to config command, config logic will only get platform's properties, because it doesn't make sense to get informations about Android platform when running native_modules.rb, and same deal with native_modules.gradle.

I did some benchmarks in project with 50 linked dependencies, and results are:

Command Result
Standalone config 7.62s
config --platform ios 0.66s
config --platform android 7.43s

So it means that linking dependencies during pod install got ~7 seconds faster in this specific scenario. If there are more dependencies to be linked, the results are higher.

Test Plan:

  1. Clone the repository and do all the required steps from the Contributing guide
  2. Run this command:
node /path/to/react-native-cli/packages/cli/build/bin.js config

Same output as before, if there are tools that depends on config's command response they won't be affected by this change. 3. Run this command:

node /path/to/react-native-cli/packages/cli/build/bin.js config --platform ios

Returns only ios as in platforms field, and also for each entry in dependencies only ios platform should be presented. And this should be valid for any other platform that is available with linked dependency. 4. Installing Cocoapods inside ios/ folder should work in the same way as before. 5. Android app should build correctly and link all native dependencies.

Checklist

  • [x] Documentation is up to date to reflect these changes.
  • [x] Follows commit message convention described in CONTRIBUTING.md

szymonrybczak avatar May 06 '24 20:05 szymonrybczak