Compare commits

...
Author SHA1 Message Date
Distiller d077bdf253 [0.70.0-rc.2] Bump version numbers 2022-08-04 15:18:45 +00:00
Sparsha SahaandLorenzo Sciandra 120b988229 Removing reactnativeutilsjni as it is built from the same sources as reactnativejni (#34339)
Summary:
This Pull Request aims at removing the making of reactnativeutilsjni as it is built from the same sources as reactnativejni. It also replaces references to reactnativeutilsjni with reactnativejni.

This should get rid of `reactnativeutilsjni.so` while reusing `reactnativejni.so` in it's place. This should give us some size improvements in the finally built apk.
## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[Android] [Changed] - Replaced reactnativeutilsjni with reactnativejni in the build process to reduce size

Pull Request resolved: https://github.com/facebook/react-native/pull/34339

Test Plan:
1. Ran the CMakelist.txt file using CMake and I could see that reactnativeutilsjni.dir is no longer generated with my changes.
2. Built the aar from this branch in Android Studio and build happened successfully.

I am not sure if we could run any more tests. Please let me know in case anymore testing is required and I can do accordingly

Reviewed By: cortinico

Differential Revision: D38400481

Pulled By: genkikondo

fbshipit-source-id: 592736e56441328389ae89135667c336ff8018e6
2022-08-04 11:55:12 +01:00
Oskar KwaśniewskiandLorenzo Sciandra 6450bc6166 Fix accessibilityState overwriting view's disabled state on Android (#34287)
Summary:
While I was working on rewriting `react-native-slider` to Fabric I found a weird bug that prevented the slider to be set as disabled (to be exact: call the method `slider.setEnabled(false)`. As it turned out the `accessibilityState` (with value: `accessibilityState={{disabled: true}}` prop occurred after the `enabled={false}` prop that I was passing to the slider, which lead to both of this props overwrite each other.

Handling of `accessibilityState` props inside view leads to always overwriting the enabled prop to true (even if we explicitly set it to `{disabled: false}`.

Workaround for this was to reorder the props, so that the `accesibilityState` occur before `disabled`, but I think it's better to not set `view.setEnabled(true)` if we are passing a disabled property.

## Changelog

[Android] [Fixed] - Fix accessibilityState overwriting view's disabled state on Android

Pull Request resolved: https://github.com/facebook/react-native/pull/34287

Test Plan:
Change order of props inside native component implementation (that `disabled` occurs before `accesibilityState`). For example: `Libraries/Components/Slider/Slider.js`

<details>
  <summary>Video showing the bug in RNTester (using Switch component)</summary>

https://user-images.githubusercontent.com/52801365/181287547-964f50e2-55dc-450f-b413-0d1c14d4bb83.mp4
</details>

Reviewed By: NickGerleman

Differential Revision: D38209232

Pulled By: dmitryrykun

fbshipit-source-id: 93d423716f89b45251be9d5aefcf01f7bd776f2c
2022-08-04 11:55:03 +01:00
LeoTMandLorenzo Sciandra 23cc0568a0 Bump Gradle to 7.5.0 (#34310)
Summary:
### Follow-up
- https://github.com/facebook/react-native/issues/34103
- https://github.com/facebook/react-native/pull/33823

#### Debug/Release further tested on RN 0.70.0-rc.0-1
- https://github.com/leotm/react-native-template-new-architecture/pull/775
- builds/runtime: locally on `macos-13` b2
- builds: in CI `ubuntu-20.04` latest (not yet beta `ubuntu-22.04`)

cc cortinico dulmandakh

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[Android] [Changed] - Bump Gradle to 7.5.0

Pull Request resolved: https://github.com/facebook/react-native/pull/34310

Test Plan: Everything builds and runs as expected.

Reviewed By: cipolleschi

Differential Revision: D38311861

Pulled By: cortinico

fbshipit-source-id: c4e9e7a9052a067ffabae87204d20190ef46b351
2022-08-03 10:23:05 +01:00
Dmitry RykunandGitHub 2176173dcc Upgrade react-native-gradle-plugin to 0.70.1 (#34330) 2022-08-02 14:27:22 +01:00
Lorenzo Sciandra 7c7ba1babd [LOCAL] update a few metro deps as follow up from the commit from main 2022-08-02 12:42:02 +01:00
Michał PierzchałaandLorenzo Sciandra c3e3a19c9e chore: upgrade RN CLI to v9.0.0-alpha.9 (#34322)
Summary:
Upgrades the React Native CLI to v9.0.0-alpha.9 with Metro 0.72 and package size improvements

cc kelset cortinico huntie

## Changelog

[General] [Changed] - Upgrade RN CLI to v9.0.0-alpha.9

Pull Request resolved: https://github.com/facebook/react-native/pull/34322

Test Plan: CI

Reviewed By: huntie

Differential Revision: D38318313

Pulled By: robhogan

fbshipit-source-id: 1a038ba90ae648307c9acb7c0c631511d344689e
2022-08-02 12:31:03 +01:00
Nicola CortiandLorenzo Sciandra ba69e7dab2 Introduce findPackageJsonFile to address issue with GenerateCodegenArtifactsTaskTest (#34321)
Summary:
While doing some testing with cipolleschi on React Native 0.70.0 we realized that custom Java Package is not properly propagated when invoking codegen for external libraries.

This PR fixes it.

## Changelog

[Internal] - Introduce findPackageJsonFile to address issue with GenerateCodegenArtifactsTaskTest

Pull Request resolved: https://github.com/facebook/react-native/pull/34321

Test Plan: Added JUnit tests + Tested locally with cipolleschi

Reviewed By: cipolleschi

Differential Revision: D38314770

Pulled By: cortinico

fbshipit-source-id: ec2de1ba59ffc8fb0644f422521ced642b38d2c7
2022-08-02 12:30:55 +01:00
Nicola CortiandLorenzo Sciandra 91fdd998d3 Improve package.json search mechanism for codegenConfig support (#34298)
Summary:
The `codegenConfig` unified configuration for New Architecture on Android relies on the Gradle plugin finding the package.json correctly. Currently we use the `root` folder to resolve the package.json. This works fine when invoking the codegen for the app module, but it doesn't work well when invoking the codegen for modules.

This extends the algo to make sure we first, look for a `package.json` in `..` and fallback to the one in the root if not found.

## Changelog

[Internal] - Improve package.json search mechanism for codegenConfig support

Pull Request resolved: https://github.com/facebook/react-native/pull/34298

Test Plan: It's hard to write a unit test for this as it's inside a lambda, I'll look into doing this though. I've tested this on RNNewArchitectureApp and it works fine.

Reviewed By: cipolleschi

Differential Revision: D38249663

Pulled By: cortinico

fbshipit-source-id: 3cfd6a31e9f75d7b19b15f77bbd5131af42be9d3
2022-08-02 12:30:46 +01:00
Alex HuntandLorenzo Sciandra 64788cc9fe Upgrade Metro dependencies to 0.72.0
Summary:
Metro release notes:  https://github.com/facebook/metro/releases/tag/v0.72.0

Changelog: [Internal]

Reviewed By: robhogan

Differential Revision: D38245699

fbshipit-source-id: d14cfda8c694f11ffacfb959cf81aa8906923648
2022-08-02 12:30:33 +01:00
Nicola CortiandLorenzo Sciandra 0fd776d889 Make sure *.ts files are considered for task avoidance in the Gradle Plugin (#34296)
Summary:
I've realized that the gradle plugin is currently looking at `.js` files for task re-execution. This means that, while the *.ts would still be considered when the codegen is invoked, an edit on one of those file, won't retrigger the codegen on Android.

This change fixes it so that we consider both `*.ts` and `*.js` files.

## Changelog

[Android] [Fixed] - Make sure *.ts files are considered for task avoidance in the Gradle Plugin

Pull Request resolved: https://github.com/facebook/react-native/pull/34296

Test Plan: Tests are attached.

Reviewed By: cipolleschi

Differential Revision: D38246125

Pulled By: cortinico

fbshipit-source-id: 80efcc9ef747c598ca040d65b25d270593c8aed2
2022-08-02 12:29:39 +01:00
Nicola CortiandLorenzo Sciandra 1c146bd420 Fix test-manual-e2e on Android/Hermes for New App Template (#34294)
Summary:
The current `test-manual-e2e.sh` script is broken on Android + Hermes + New App Template.

This commit fixes it. Specifically:
- There is no need to generate Maven Artifacts for RN Tester, as RN Tester consumes them from source.
- There is instead a need to generate Maven Artifacts for New App Template, as they need to be included inside the NPM package.
- The `:ReactAndroid:hermes-engine:installArchives` task needs to invoked to also generate the Hermes-engine .aar for bundling.

## Changelog

[Internal] - Fix test-manual-e2e on Android/Hermes for New App Template

Pull Request resolved: https://github.com/facebook/react-native/pull/34294

Test Plan: I've tested this against the `0.70-stable` branch and I was able to run an App from the New Template properly.

Reviewed By: dmitryrykun

Differential Revision: D38239238

Pulled By: cortinico

fbshipit-source-id: b3d95bad21515b12a91e29147e70ba8323896660
2022-08-02 12:29:30 +01:00
Distiller a8bb3d3f20 [0.70.0-rc.1] Bump version numbers 2022-07-28 13:01:01 +00:00
Kudo ChienandLorenzo Sciandra 5fc88e95b5 #34214 for main (#34271)
Summary:
cherry-pick changes from https://github.com/facebook/react-native/issues/34214 to main. because the `react_native_pods.rb` on main is quite different from 0.69, i have separated pr for the change.

## Changelog

[iOS] [Fixed] - Fix React-bridging headers import not found

Pull Request resolved: https://github.com/facebook/react-native/pull/34271

Test Plan: RNTester + pod install and verify pod targets to have `React-bridging` in header search paths.

Reviewed By: cipolleschi

Differential Revision: D38122074

Pulled By: dmitryrykun

fbshipit-source-id: 64569abbfa3a684f0d6b84c9e3222bfc9a171061
2022-07-27 16:34:42 +01:00
Kudo ChienandLorenzo Sciandra 70daa6e728 Fix hermes executor not available when use_frameworks is enabled (#34222)
Summary:
When in `use_frameworks!` + `hermes_enabled` mode, the React podspecs have not dependency to the `React-hermes` podspec. the `HermesExecutorFactory.h` is not available [here](https://github.com/facebook/react-native/blob/1d997ce6d67242b9f667b01365c5e719c3d3f8d7/React/AppSetup/RCTAppSetupUtils.h#L15) and [here](https://github.com/facebook/react-native/blob/1d997ce6d67242b9f667b01365c5e719c3d3f8d7/React/CxxBridge/RCTCxxBridge.mm#L44). The app will fallback to JSCRuntime and crash in release build because the JSCRuntime cannot evaluate Hermes bundles.

The pr tries to add `React-hermes` to Framework Search Paths and make the `HermesExecutorFactory.h` reachable when in use_frameworks mode.

This pr should fix the problem mentioned in [0.70 release discussion](https://github.com/reactwg/react-native-releases/discussions/26#discussioncomment-3166350).

## Changelog

[iOS] [Fixed] - Fix Hermes executor not available when `use_frameworks` is enabled

Pull Request resolved: https://github.com/facebook/react-native/pull/34222

Test Plan:
use patch-package to apply the change to a RN 0.69.1 project with the following test cases:

- old architecture + jsc
- new architecture + hermes
- old architecture + `use_frameworks! :linkage => :static` + hermes
- old architecture +`use_frameworks! :linkage => :static` + hermes + release build

Reviewed By: sammy-SC

Differential Revision: D38112717

Pulled By: cipolleschi

fbshipit-source-id: ee78527f4686400856ab9a055cf30b20900afc17
2022-07-27 16:34:32 +01:00
Lorenzo Sciandra e7461eea11 bump CLI to v9.0.0-alpha.5 (#34275)
Summary:
Bumping main to latest version of CLI available; in particular, we want to ensure to propagate this fix https://github.com/react-native-community/cli/pull/1655.

After merging, we'll cherry-pick in the `0.70-stable` branch.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[General] [Changed] - bump CLI to v9.0.0-alpha.5

Pull Request resolved: https://github.com/facebook/react-native/pull/34275

Test Plan: CI

Reviewed By: NickGerleman

Differential Revision: D38151383

Pulled By: dmitryrykun

fbshipit-source-id: afdafb496a159ad766dd322a4aab4bda6146edf0

# Conflicts:
#	yarn.lock
2022-07-27 16:34:18 +01:00
LeoTMandLorenzo Sciandra bf34be1eca Update Podfile for PRODUCTION=1 pod install (#34234)
Summary:
### Mentioned
- pr[main]: https://github.com/facebook/react-native/pull/33882
- discussion: https://github.com/reactwg/react-native-releases/discussions/21#discussioncomment-2945972
- pr[0.69-stable]: https://github.com/facebook/react-native/pull/34098

Close: https://github.com/facebook/react-native/issues/33764

Saw the issue ago couple wks too: https://github.com/leotm/react-native-template-new-architecture/issues/757
Fixed similarly: https://github.com/leotm/react-native-template-new-architecture/pull/791

## Changelog

[iOS] [Changed] - Update Podfile to allow `PRODUCTION=1 pod install`

[CATEGORY] [TYPE] - Message

Pull Request resolved: https://github.com/facebook/react-native/pull/34234

Test Plan: Everything builds and runs as expected

Reviewed By: cortinico

Differential Revision: D38029117

Pulled By: cipolleschi

fbshipit-source-id: bdb58200a999cb66f1043a2feb670f9037c8e463
2022-07-27 16:32:46 +01:00
Riccardo CipolleschiandLorenzo Sciandra b8b3f2f4e8 Destructure use_react_native! parameters and doc (#34177)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34177

This Diff destructures the parameters of the use_react_native! function. It does that in a backward compatible way, so we there should be no disruptions.

It also adds documentation to the various public method we want to export to our users.

## Changelog
[iOS][Changed] - Destruct use_reactnative parameters and ad ddocumentation

Reviewed By: cortinico

Differential Revision: D37787365

fbshipit-source-id: 27f9030db2e8c6c66b9548b4c1287eb8165ae5fc
2022-07-27 16:32:38 +01:00
Riccardo CipolleschiandLorenzo Sciandra 1ab3f58f43 Extract Codegen code from the react_native_pods to its own file (#34176)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34176

It extracts the code related to the codegen from the main `react_native_pods` script to a dedicated file, adding also tests.

## Changelog

[iOS][Changed] - Move codegen in separate files

Reviewed By: cortinico

Differential Revision: D37755818

fbshipit-source-id: 99760d1def26ddbf065fdd234e0d183c2795513c
2022-07-27 16:32:31 +01:00
Nicola CortiandLorenzo Sciandra d9280e14c3 Fix missing import on New Architecture build script in template (#34230)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/34230

The OS static class is accessed inside app/build.gradle but the import is on
the top level Gradle file. This is causing an app created from template to fail
building.

This is needed to be cherry-picked on the 0.70-stable branch.

Changelog:
[Android] [Fixed] - Fix missing import on New Architecture build script in template

Reviewed By: cipolleschi

Differential Revision: D37995897

fbshipit-source-id: aad22100cee004944c4fa0841f5ef0dfc6ea1e94
2022-07-27 16:31:13 +01:00
Mike HardyandLorenzo Sciandra fc06d9c6dd deps(android): bump soloader to 0.10.4 (#34213)
Summary:
soloader 0.10.3 will apparently cause crashes in instrumented tests, 0.10.4 appears to fix these crashes

Related: https://github.com/facebook/SoLoader/issues/94
Related: https://github.com/reactwg/react-native-releases/discussions/26#discussioncomment-3166381

## Changelog

[Android] [Changed] - Bump Soloader to 0.10.4

Pull Request resolved: https://github.com/facebook/react-native/pull/34213

Test Plan: This is hard to test since it's in the AAR etc., I'm hoping CI is sufficient as the previous soloader bump PR went through similarly

Reviewed By: cipolleschi

Differential Revision: D37960320

Pulled By: cortinico

fbshipit-source-id: ce1611d7b30df737c8525a70839b5491a6585c75
2022-07-27 16:31:04 +01:00
Dmitry Rykun d07fae9b23 Update @react-native/eslint-plugin-specs to 0.70.0 2022-07-26 17:13:29 +01:00
Dmitry Rykun afd76f69c7 Bump @react-native/eslint-plugin-specs to 0.70.0 2022-07-26 17:02:45 +01:00
Lorenzo SciandraandDmitry Rykun c40d270fdc fix npm lifecycle hook (#34273)
Summary:
In `0.70-stable` we started seeing `yarn run lint` fail; turns out, this is happening because the latest release of `react-native/eslint-plugin-specs` 0.0.4 (from https://github.com/facebook/react-native/commit/ea8d8e2f49ea3ce15faeab500b661a1cacacf8a8) is faulty: the underlying reason is that since 0.0.2 there was this local workaround in place https://github.com/facebook/react-native/commit/2d06e6a4c9261bb7790cf217b66145415301bc54 (that changes a flag from false to true) but in NPM 8 the lifecycle hook `prepublish` has [been deprecated](https://docs.npmjs.com/cli/v8/using-npm/scripts#life-cycle-scripts) so this pre publishing script to change the flag was not run (you can easily verify by checking the node_module and see `react-native-modules.js` the flag on L17 is set to false).

This PR addresses it by moving to the new lifecycle hook `prepack` (and modifies the other files accordingly).

After this PR is merged, we'll need to cherry pick it into 0.70 and do both a new release from the 0.70 branch and one from the main branch to have new versions of this module with the flag set correctly.

## Changelog

<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[General] [Fixed] - Fix eslint-plugin-specs prepack npm lifecycle hook now that we use npm 8

Pull Request resolved: https://github.com/facebook/react-native/pull/34273

Test Plan: Go in the `eslint-plugin-specs` folder, run `npm pack`, unzip the generated tar file, go into `package`, verify that L17 of `react-native-modules.js` is correctly changed to `const PACKAGE_USAGE = true;` (instead of false - which is what happen without this fix).

Reviewed By: GijsWeterings

Differential Revision: D38151433

Pulled By: dmitryrykun

fbshipit-source-id: 7c4f13dae70eb731d57cbafa90f7be05c9bb8576
2022-07-26 16:57:24 +01:00
Nicola Corti eb6767813a Hermes version bump for 0.70.0-RC1 2022-07-20 10:55:08 +01:00
Lorenzo Sciandra ccde88f4b0 Hermes pod: change logic to use the hermes tag to set the pod source correctly (#34221)
Summary:
This fix is necessarly to ensure that when working on the codebase in the `0.XX-stable` branches (ex. when you are working on a release) the Hermes podfile is correctly set against the right commit for that branch, and not latest commit from main branch of Hermes repo.

I didn't add a check to verify that the file `.hermesversion` exists because I think it's safe to assume that the file and the tag correctly exists when this step (doing a pod install on the `0.XX-stable` branch).

Once this is merged, we need to cherry pick it on both the 0.69 and 0.70 branches

## Changelog

[iOS] [Fixed] - Hermes pod: change logic to use the hermes tag to set the pod source correctly

Pull Request resolved: https://github.com/facebook/react-native/pull/34221

Test Plan:
* git clone the repo
* checkout 0.69-stable branch
* follow https://reactnative.dev/contributing/release-testing
* without this commit, when testing RNTester + iOS + Hermes the app will insta-crash on opening
* with it, the app gets build successfully

Reviewed By: cortinico

Differential Revision: D37957660

Pulled By: cipolleschi

fbshipit-source-id: 4e50099ed712b1ad8e6439822e3f530142982c1b
2022-07-19 15:37:55 +01:00
Distiller c0127265a1 [0.70.0-rc.0] Bump version numbers 2022-07-15 13:55:58 +00:00
Dmitry Rykun 8c682ddd59 Hermes version bump. 2022-07-15 13:45:19 +01:00
50 changed files with 1851 additions and 817 deletions
+10 -10
View File
@@ -3,7 +3,7 @@ GEM
specs:
CFPropertyList (3.0.5)
rexml
activesupport (6.1.5)
activesupport (6.1.6.1)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
@@ -45,7 +45,7 @@ GEM
public_suffix (~> 4.0)
typhoeus (~> 1.0)
cocoapods-deintegrate (1.0.5)
cocoapods-downloader (1.6.1)
cocoapods-downloader (1.6.3)
cocoapods-plugins (1.0.0)
nap
cocoapods-search (1.0.1)
@@ -63,29 +63,29 @@ GEM
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
httpclient (2.8.3)
i18n (1.10.0)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
json (2.6.1)
minitest (5.15.0)
json (2.6.2)
minitest (5.16.2)
molinillo (0.8.0)
nanaimo (0.3.0)
nap (1.1.0)
netrc (0.11.0)
public_suffix (4.0.6)
public_suffix (4.0.7)
rexml (3.2.5)
ruby-macho (2.5.1)
typhoeus (1.4.0)
ethon (>= 0.9.0)
tzinfo (2.0.4)
tzinfo (2.0.5)
concurrent-ruby (~> 1.0)
xcodeproj (1.21.0)
xcodeproj (1.22.0)
CFPropertyList (>= 2.3.3, < 4.0)
atomos (~> 0.1.3)
claide (>= 1.0.2, < 2.0)
colored2 (~> 3.1)
nanaimo (~> 0.3.0)
rexml (~> 3.2.4)
zeitwerk (2.5.4)
zeitwerk (2.6.0)
PLATFORMS
ruby
@@ -97,4 +97,4 @@ RUBY VERSION
ruby 2.7.5p203
BUNDLED WITH
2.3.10
2.3.11
+4 -4
View File
@@ -1,17 +1,17 @@
/**
* @generated by scripts/set-rn-version.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @format
* @generated by scripts/set-rn-version.js
* @flow strict
*/
exports.version = {
major: 0,
minor: 0,
minor: 70,
patch: 0,
prerelease: null,
prerelease: 'rc.2',
};
+7 -1
View File
@@ -47,7 +47,13 @@ Pod::Spec.new do |s|
s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags
s.header_dir = "React"
s.framework = "JavaScriptCore"
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-hermes\" \"${PODS_ROOT}/Headers/Public/hermes-engine\" \"${PODS_ROOT}/Headers/Public/FlipperKit\" \"$(PODS_ROOT)/Headers/Public/ReactCommon\" \"$(PODS_ROOT)/Headers/Public/React-RCTFabric\"", "DEFINES_MODULE" => "YES", "GCC_PREPROCESSOR_DEFINITIONS" => "RCT_METRO_PORT=${RCT_METRO_PORT}", "CLANG_CXX_LANGUAGE_STANDARD" => "c++17" }
s.pod_target_xcconfig = {
"HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-hermes\" \"${PODS_ROOT}/Headers/Public/hermes-engine\" \"${PODS_ROOT}/Headers/Public/FlipperKit\" \"$(PODS_ROOT)/Headers/Public/ReactCommon\" \"$(PODS_ROOT)/Headers/Public/React-RCTFabric\"",
"FRAMEWORK_SEARCH_PATHS" => "\"${PODS_CONFIGURATION_BUILD_DIR}/React-hermes\"",
"DEFINES_MODULE" => "YES",
"GCC_PREPROCESSOR_DEFINITIONS" => "RCT_METRO_PORT=${RCT_METRO_PORT}",
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
}
s.user_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/Headers/Private/React-Core\""}
s.default_subspec = "Default"
+5 -5
View File
@@ -21,11 +21,11 @@ NSDictionary* RCTGetReactNativeVersion(void)
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^(void){
__rnVersion = @{
RCTVersionMajor: @(0),
RCTVersionMinor: @(0),
RCTVersionPatch: @(0),
RCTVersionPrerelease: [NSNull null],
};
RCTVersionMajor: @(0),
RCTVersionMinor: @(70),
RCTVersionPatch: @(0),
RCTVersionPrerelease: @"rc.2",
};
});
return __rnVersion;
}
+2 -2
View File
@@ -1,4 +1,4 @@
VERSION_NAME=1000.0.0-main
VERSION_NAME=0.70.0-rc.2
GROUP=com.facebook.react
POM_NAME=ReactNative
@@ -22,7 +22,7 @@ OKHTTP_VERSION=4.9.2
POWERMOCK_VERSION=2.0.2
PROGUARD_ANNOTATIONS_VERSION=1.19.0
ROBOLECTRIC_VERSION=4.4
SO_LOADER_VERSION=0.10.3
SO_LOADER_VERSION=0.10.4
SWIPEREFRESH_LAYOUT_VERSION=1.0.0
# Native Dependency Versions
@@ -44,7 +44,7 @@ target_link_libraries(
react_render_uimanager
react_utils
react_config
reactnativeutilsjni
reactnativejni
rrc_image
rrc_modal
rrc_progressbar
@@ -16,7 +16,7 @@ import java.util.Map;
public class ReactNativeVersion {
public static final Map<String, Object> VERSION = MapBuilder.<String, Object>of(
"major", 0,
"minor", 0,
"minor", 70,
"patch", 0,
"prerelease", null);
"prerelease", "rc.2");
}
@@ -287,7 +287,9 @@ public abstract class BaseViewManager<T extends View, C extends LayoutShadowNode
view.setSelected(false);
}
view.setTag(R.id.accessibility_state, accessibilityState);
view.setEnabled(true);
if (accessibilityState.hasKey("disabled") && !accessibilityState.getBoolean("disabled")) {
view.setEnabled(true);
}
// For states which don't have corresponding methods in
// AccessibilityNodeInfo, update the view's content description
@@ -6,8 +6,6 @@
cmake_minimum_required(VERSION 3.13)
set(CMAKE_VERBOSE_MAKEFILE on)
# TODO Those two libraries are building against the same sources
# and should probably be merged
file(GLOB reactnativejni_SRC CONFIGURE_DEPENDS *.cpp)
add_compile_options(
@@ -17,32 +15,6 @@ add_compile_options(
-std=c++17
-DWITH_INSPECTOR=1)
##########################
### React Native Utils ###
##########################
add_library(
reactnativeutilsjni
SHARED
${reactnativejni_SRC}
)
# TODO This should not be ../../
target_include_directories(reactnativeutilsjni PUBLIC ../../)
target_link_libraries(reactnativeutilsjni
android
callinvokerholder
fb
fbjni
folly_runtime
glog_init
react_render_runtimescheduler
reactnative
runtimeexecutor
yoga
)
######################
### reactnativejni ###
######################
@@ -67,7 +39,6 @@ target_link_libraries(reactnativejni
logger
react_render_runtimescheduler
reactnative
reactnativeutilsjni
runtimeexecutor
yoga
)
+2 -2
View File
@@ -16,9 +16,9 @@ namespace facebook::react {
constexpr struct {
int32_t Major = 0;
int32_t Minor = 0;
int32_t Minor = 70;
int32_t Patch = 0;
std::string_view Prerelease = "";
std::string_view Prerelease = "rc.2";
} ReactNativeVersion;
} // namespace facebook::react
@@ -28,7 +28,7 @@ target_link_libraries(rrc_progressbar
react_render_debug
react_render_graphics
react_render_uimanager
reactnativeutilsjni
reactnativejni
rrc_view
yoga
)
@@ -31,7 +31,7 @@ target_link_libraries(rrc_slider
react_render_imagemanager
react_render_mapbuffer
react_render_uimanager
reactnativeutilsjni
reactnativejni
rrc_image
rrc_view
yoga
@@ -28,7 +28,7 @@ target_link_libraries(
react_render_debug
react_render_graphics
react_render_uimanager
reactnativeutilsjni
reactnativejni
rrc_view
yoga
)
@@ -40,6 +40,6 @@ target_link_libraries(react_render_textlayoutmanager
react_render_telemetry
react_render_uimanager
react_utils
reactnativeutilsjni
reactnativejni
yoga
)
+1 -1
View File
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
+49 -16
View File
@@ -1,7 +1,6 @@
{
"name": "react-native",
"private": true,
"version": "1000.0.0",
"version": "0.70.0-rc.2",
"bin": "./cli.js",
"description": "A framework for building native apps using React",
"license": "MIT",
@@ -94,18 +93,14 @@
"test-android-e2e": "yarn run docker-build-android && yarn run test-android-run-e2e",
"test-ios": "./scripts/objc-test.sh test"
},
"workspaces": [
"packages/!(eslint-config-react-native-community)",
"repo-config"
],
"peerDependencies": {
"react": "18.1.0"
},
"dependencies": {
"@jest/create-cache-key-function": "^27.0.1",
"@react-native-community/cli": "^9.0.0-alpha.3",
"@react-native-community/cli-platform-android": "^9.0.0-alpha.3",
"@react-native-community/cli-platform-ios": "^9.0.0-alpha.3",
"@react-native-community/cli": "^9.0.0-alpha.9",
"@react-native-community/cli-platform-android": "^9.0.0-alpha.5",
"@react-native-community/cli-platform-ios": "^9.0.0-alpha.5",
"@react-native/assets": "1.0.0",
"@react-native/normalize-color": "2.0.0",
"@react-native/polyfills": "2.0.0",
@@ -116,15 +111,15 @@
"invariant": "^2.2.4",
"jsc-android": "^250230.2.1",
"memoize-one": "^5.0.0",
"metro-react-native-babel-transformer": "0.71.3",
"metro-runtime": "0.71.3",
"metro-source-map": "0.71.3",
"metro-react-native-babel-transformer": "0.72.0",
"metro-runtime": "0.72.0",
"metro-source-map": "0.72.0",
"mkdirp": "^0.5.1",
"nullthrows": "^1.1.1",
"pretty-format": "^26.5.2",
"promise": "^8.0.3",
"react-devtools-core": "4.24.0",
"react-native-gradle-plugin": "^0.70.0",
"react-native-gradle-plugin": "^0.70.1",
"react-refresh": "^0.4.0",
"react-shallow-renderer": "^16.15.0",
"regenerator-runtime": "^0.13.2",
@@ -132,13 +127,51 @@
"stacktrace-parser": "^0.1.3",
"use-sync-external-store": "^1.0.0",
"whatwg-fetch": "^3.0.0",
"ws": "^6.1.4"
"ws": "^6.1.4",
"react-native-codegen": "^0.70.3"
},
"devDependencies": {
"flow-bin": "^0.182.0",
"hermes-eslint": "0.8.0",
"react": "18.1.0",
"react-test-renderer": "^18.1.0"
"react-test-renderer": "18.1.0",
"@babel/core": "^7.14.0",
"@babel/eslint-parser": "^7.18.2",
"@babel/generator": "^7.14.0",
"@babel/plugin-transform-regenerator": "^7.0.0",
"@react-native-community/eslint-plugin": "*",
"@react-native/eslint-plugin-specs": "^0.70.0",
"@reactions/component": "^2.0.2",
"async": "^3.2.2",
"clang-format": "^1.2.4",
"connect": "^3.6.5",
"coveralls": "^3.1.1",
"eslint": "^7.32.0",
"eslint-config-fb-strict": "^26.0.0",
"eslint-config-fbjs": "^3.1.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-flowtype": "^7.0.0",
"eslint-plugin-jest": "^25.2.4",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.26.1",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-react-native": "^3.11.0",
"eslint-plugin-relay": "^1.8.2",
"inquirer": "^7.1.0",
"jest": "^26.6.3",
"jest-junit": "^10.0.0",
"jscodeshift": "^0.13.1",
"metro-babel-register": "0.72.0",
"metro-memory-fs": "0.72.0",
"mkdirp": "^0.5.1",
"prettier": "^2.4.1",
"shelljs": "^0.8.5",
"signedsource": "^1.0.0",
"ws": "^6.1.4",
"yargs": "^15.3.1"
},
"codegenConfig": {
"libraries": [
@@ -158,4 +191,4 @@
}
]
}
}
}
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@react-native/eslint-plugin-specs",
"version": "0.0.4",
"version": "0.70.0",
"description": "ESLint rules to validate NativeModule and Component Specs",
"main": "index.js",
"repository": {
@@ -9,7 +9,7 @@
"directory": "packages/eslint-plugin-specs"
},
"scripts": {
"prepublish": "node prepublish.js"
"prepack": "node prepack.js"
},
"dependencies": {
"@babel/core": "^7.14.0",
+1 -1
View File
@@ -13,7 +13,7 @@
const path = require('path');
const withBabelRegister = require('./with-babel-register');
// We run yarn prepublish before publishing package which will set this value to true
// We use the prepack hook before publishing package to set this value to true
const PACKAGE_USAGE = false;
const ERRORS = {
misnamedHasteModule(hasteModuleName) {
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
@@ -1,6 +1,6 @@
{
"name": "react-native-gradle-plugin",
"version": "0.70.0",
"version": "0.70.1",
"description": "⚛️ Gradle Plugin for React Native",
"homepage": "https://github.com/facebook/react-native/tree/HEAD/packages/react-native-gradle-plugin",
"repository": {
@@ -15,6 +15,7 @@ import com.facebook.react.tasks.BuildCodegenCLITask
import com.facebook.react.tasks.GenerateCodegenArtifactsTask
import com.facebook.react.tasks.GenerateCodegenSchemaTask
import com.facebook.react.utils.JsonUtils
import com.facebook.react.utils.findPackageJsonFile
import java.io.File
import kotlin.system.exitProcess
import org.gradle.api.Plugin
@@ -92,19 +93,16 @@ class ReactPlugin : Plugin<Project> {
// We're reading the package.json at configuration time to properly feed
// the `jsRootDir` @Input property of this task. Therefore, the
// parsePackageJson should be invoked here.
val parsedPackageJson =
extension.root.file("package.json").orNull?.asFile?.let {
JsonUtils.fromCodegenJson(it)
}
// parsePackageJson should be invoked inside this lambda.
val packageJson = findPackageJsonFile(project, extension)
val parsedPackageJson = packageJson?.let { JsonUtils.fromCodegenJson(it) }
val parsedJsRootDir =
parsedPackageJson?.codegenConfig?.jsSrcsDir?.let { relativePath ->
extension.root.dir(relativePath)
}
?: extension.jsRootDir
it.jsRootDir.set(parsedJsRootDir)
val jsSrcsDirInPackageJson = parsedPackageJson?.codegenConfig?.jsSrcsDir
if (jsSrcsDirInPackageJson != null) {
it.jsRootDir.set(File(packageJson.parentFile, jsSrcsDirInPackageJson))
} else {
it.jsRootDir.set(extension.jsRootDir)
}
}
// We create the task to generate Java code from schema.
@@ -117,7 +115,7 @@ class ReactPlugin : Plugin<Project> {
it.nodeExecutableAndArgs.set(extension.nodeExecutableAndArgs)
it.codegenDir.set(extension.codegenDir)
it.generatedSrcDir.set(generatedSrcDir)
it.packageJsonFile.set(extension.root.file("package.json"))
it.packageJsonFile.set(findPackageJsonFile(project, extension))
it.codegenJavaPackageName.set(extension.codegenJavaPackageName)
it.libraryName.set(extension.libraryName)
}
@@ -33,6 +33,7 @@ abstract class GenerateCodegenSchemaTask : Exec() {
val jsInputFiles =
project.fileTree(jsRootDir) {
it.include("**/*.js")
it.include("**/*.ts")
it.exclude("**/generated/source/codegen/**/*")
}
@@ -11,6 +11,7 @@ package com.facebook.react.utils
import com.facebook.react.ReactExtension
import java.io.File
import org.gradle.api.Project
/**
* Computes the entry file for React Native. The Algo follows this order:
@@ -190,6 +191,18 @@ internal fun projectPathToLibraryName(projectPath: String): String =
.joinToString("") { token -> token.replaceFirstChar { it.uppercase() } }
.plus("Spec")
/**
* Function to look for the relevant `package.json`. We first look in the parent folder of this
* Gradle module (generally the case for library projects) or we fallback to looking into the `root`
* folder of a React Native project (generally the case for app projects).
*/
internal fun findPackageJsonFile(project: Project, extension: ReactExtension): File? =
if (project.file("../package.json").exists()) {
project.file("../package.json")
} else {
extension.root.file("package.json").orNull?.asFile
}
private const val HERMESC_IN_REACT_NATIVE_PATH =
"node_modules/react-native/sdks/hermesc/%OS-BIN%/hermesc"
private const val HERMESC_BUILT_FROM_SOURCE_PATH =
@@ -29,15 +29,17 @@ class GenerateCodegenSchemaTaskTest {
val jsRootDir =
tempFolder.newFolder("js").apply {
File(this, "file.js").createNewFile()
File(this, "file.ts").createNewFile()
File(this, "ignore.txt").createNewFile()
}
val task = createTestTask<GenerateCodegenSchemaTask> { it.jsRootDir.set(jsRootDir) }
assertEquals(jsRootDir, task.jsInputFiles.dir)
assertEquals(setOf("**/*.js"), task.jsInputFiles.includes)
assertEquals(1, task.jsInputFiles.files.size)
assertEquals(setOf(File(jsRootDir, "file.js")), task.jsInputFiles.files)
assertEquals(setOf("**/*.js", "**/*.ts"), task.jsInputFiles.includes)
assertEquals(2, task.jsInputFiles.files.size)
assertEquals(
setOf(File(jsRootDir, "file.js"), File(jsRootDir, "file.ts")), task.jsInputFiles.files)
}
@Test
@@ -7,6 +7,7 @@
package com.facebook.react.utils
import com.facebook.react.ReactExtension
import com.facebook.react.TestReactExtension
import com.facebook.react.tests.OS
import com.facebook.react.tests.OsRule
@@ -242,4 +243,29 @@ class PathUtilsTest {
File("/home/circleci/hermes/build/bin/hermesc"),
getBuiltHermescFile(tempFolder.root, "/home/circleci/hermes"))
}
@Test
fun findPackageJsonFile_withFileInParentFolder_picksItUp() {
tempFolder.newFile("package.json")
val moduleFolder = tempFolder.newFolder("awesome-module")
val project = ProjectBuilder.builder().withProjectDir(moduleFolder).build()
project.plugins.apply("com.facebook.react")
val extension = project.extensions.getByType(ReactExtension::class.java)
assertEquals(project.file("../package.json"), findPackageJsonFile(project, extension))
}
@Test
fun findPackageJsonFile_withFileConfiguredInExtension_picksItUp() {
val moduleFolder = tempFolder.newFolder("awesome-module")
val localFile = File(moduleFolder, "package.json").apply { writeText("{}") }
val project = ProjectBuilder.builder().withProjectDir(moduleFolder).build()
project.plugins.apply("com.facebook.react")
val extension =
project.extensions.getByType(ReactExtension::class.java).apply { root.set(moduleFolder) }
assertEquals(localFile, findPackageJsonFile(project, extension))
}
}
+3 -3
View File
@@ -14,7 +14,7 @@
"@babel/generator": "^7.14.0",
"@babel/plugin-transform-regenerator": "^7.0.0",
"@react-native-community/eslint-plugin": "*",
"@react-native/eslint-plugin-specs": ">0.0.2",
"@react-native/eslint-plugin-specs": "^0.70.0",
"@reactions/component": "^2.0.2",
"async": "^3.2.2",
"clang-format": "^1.2.4",
@@ -39,8 +39,8 @@
"jest": "^26.6.3",
"jest-junit": "^10.0.0",
"jscodeshift": "^0.13.1",
"metro-babel-register": "0.71.3",
"metro-memory-fs": "0.71.3",
"metro-babel-register": "0.72.0",
"metro-memory-fs": "0.72.0",
"mkdirp": "^0.5.1",
"prettier": "^2.4.1",
"react": "18.1.0",
@@ -10,6 +10,7 @@ require_relative "./test_utils/PathnameMock.rb"
require_relative "./test_utils/FileMock.rb"
require_relative "./test_utils/DirMock.rb"
require_relative "./test_utils/systemUtils.rb"
require_relative "./test_utils/CodegenUtilsMock.rb"
class CodegenTests < Test::Unit::TestCase
:third_party_provider_header
@@ -182,4 +183,62 @@ class CodegenTests < Test::Unit::TestCase
]
})
end
# ================= #
# Test - RunCodegen #
# ================= #
def testRunCodegen_whenNewArchEnabled_runsCodegen
# Arrange
app_path = "~/app"
config_file = ""
codegen_utils_mock = CodegenUtilsMock.new()
# Act
run_codegen!(app_path, config_file, :new_arch_enabled => true, :codegen_utils => codegen_utils_mock)
# Assert
assert_equal(codegen_utils_mock.use_react_native_codegen_discovery_params, [{
:app_path=>"~/app",
:codegen_disabled=>false,
:codegen_output_dir=>"build/generated/ios",
:config_file_dir=>"",
:fabric_enabled=>false,
:folly_version=>"2021.07.22.00",
:react_native_path=>"../node_modules/react-native"
}])
assert_equal(codegen_utils_mock.get_react_codegen_spec_params, [])
assert_equal(codegen_utils_mock.generate_react_codegen_spec_params, [])
end
def testRunCodegen_whenNewArchDisabled_runsCodegen
# Arrange
app_path = "~/app"
config_file = ""
package_json_file = "~/app/package.json"
codegen_specs = { "name" => "React-Codegen" }
codegen_utils_mock = CodegenUtilsMock.new(:react_codegen_spec => codegen_specs)
# Act
run_codegen!(
app_path,
config_file,
:new_arch_enabled => false,
:fabric_enabled => true,
:package_json_file => package_json_file,
:codegen_utils => codegen_utils_mock)
# Assert
assert_equal(codegen_utils_mock.use_react_native_codegen_discovery_params, [])
assert_equal(codegen_utils_mock.get_react_codegen_spec_params, [{
:fabric_enabled => true,
:folly_version=>"2021.07.22.00",
:package_json_file => "~/app/package.json",
:script_phases => nil
}])
assert_equal(codegen_utils_mock.generate_react_codegen_spec_params, [{
:codegen_output_dir=>"build/generated/ios",
:react_codegen_spec=>{"name"=>"React-Codegen"}
}])
end
end
@@ -0,0 +1,435 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
require "test/unit"
require "json"
require_relative "../codegen_utils.rb"
require_relative "./test_utils/FileMock.rb"
require_relative "./test_utils/DirMock.rb"
require_relative "./test_utils/PodMock.rb"
require_relative "./test_utils/PathnameMock.rb"
require_relative "./test_utils/FinderMock.rb"
require_relative "./test_utils/CodegenUtilsMock.rb"
require_relative "./test_utils/CodegenScriptPhaseExtractorMock.rb"
class CodegenUtilsTests < Test::Unit::TestCase
:base_path
def setup
CodegenUtils.set_react_codegen_discovery_done(false)
CodegenUtils.set_react_codegen_podspec_generated(false)
Pod::Config.reset()
File.enable_testing_mode!
Dir.enable_testing_mode!
@base_path = "~/app/ios"
Pathname.pwd!(@base_path)
Pod::Config.instance.installation_root.relative_path_from = @base_path
end
def teardown
Finder.reset()
Pathname.reset()
Pod::UI.reset()
Pod::Executable.reset()
File.reset()
Dir.reset()
end
# ================================== #
# Test - GenerateReactCodegenPodspec #
# ================================== #
def testGenerateReactCodegenPodspec_whenItHasBeenAlreadyGenerated_doesNothing
# Arrange
spec = { :name => "Test Podspec" }
codegen_output_dir = "build"
CodegenUtils.set_react_codegen_podspec_generated(true)
# Act
CodegenUtils.new().generate_react_codegen_podspec!(spec, codegen_output_dir)
# Assert
assert_equal(Pod::UI.collected_messages, ["[Codegen] Skipping React-Codegen podspec generation."])
assert_equal(Pathname.pwd_invocation_count, 0)
assert_equal(Pod::Executable.executed_commands, [])
assert_equal(Pod::Config.instance.installation_root.relative_path_from_invocation_count, 0)
assert_true(CodegenUtils.react_codegen_podspec_generated)
end
def testGenerateReactCodegenPodspec_whenItHasNotBeenAlreadyGenerated_generatesIt
# Arrange
spec = { :name => "Test Podspec" }
codegen_output_dir = "build"
# Act
CodegenUtils.new().generate_react_codegen_podspec!(spec, codegen_output_dir)
# Assert
assert_equal(Pathname.pwd_invocation_count, 1)
assert_equal(Pod::Config.instance.installation_root.relative_path_from_invocation_count, 1)
assert_equal(Pod::Executable.executed_commands, [{ "command" => 'mkdir', "arguments" => ["-p", "~/app/ios/build"]}])
assert_equal(Pod::UI.collected_messages, ["[Codegen] Generating ~/app/ios/build/React-Codegen.podspec.json"])
assert_equal(File.open_files_with_mode["~/app/ios/build/React-Codegen.podspec.json"], 'w')
assert_equal(File.open_files[0].collected_write, ['{"name":"Test Podspec"}'])
assert_equal(File.open_files[0].fsync_invocation_count, 1)
assert_true(CodegenUtils.react_codegen_podspec_generated)
end
# ========================== #
# Test - GetReactCodegenSpec #
# ========================== #
def testGetReactCodegenSpec_whenFabricDisabledAndNoScriptPhases_generatesAPodspec
# Arrange
File.files_to_read('package.json' => '{ "version": "99.98.97"}')
# Act
podspec = CodegenUtils.new().get_react_codegen_spec(
'package.json',
:fabric_enabled => false,
:script_phases => nil
)
# Assert
assert_equal(podspec, get_podspec_no_fabric_no_script())
assert_equal(Pod::UI.collected_messages, [])
end
def testGetReactCodegenSpec_whenFabricEnabledAndScriptPhases_generatesAPodspec
# Arrange
File.files_to_read('package.json' => '{ "version": "99.98.97"}')
# Act
podspec = CodegenUtils.new().get_react_codegen_spec(
'package.json',
:fabric_enabled => true,
:script_phases => "echo Test Script Phase"
)
# Assert
assert_equal(podspec, get_podspec_fabric_and_script_phases("echo Test Script Phase"))
assert_equal(Pod::UI.collected_messages, ["[Codegen] Adding script_phases to React-Codegen."])
end
# =============================== #
# Test - GetCodegenConfigFromFile #
# =============================== #
def testGetCodegenConfigFromFile_whenFileDoesNotExists_returnEmpty
# Arrange
# Act
codegen = CodegenUtils.new().get_codegen_config_from_file('package.json', 'codegenConfig')
# Assert
assert_equal(codegen, {'libraries' => []})
end
def testGetCodegenConfigFromFile_whenFileExistsButHasNoKey_returnEmpty
# Arrange
File.mocked_existing_files(['package.json'])
File.files_to_read('package.json' => '{ "codegenConfig": {}}')
# Act
codegen = CodegenUtils.new().get_codegen_config_from_file('package.json', 'codegen')
# Assert
assert_equal(codegen, {'libraries' => []})
end
def testGetCodegenConfigFromFile_whenFileExistsAndHasKey_returnObject
# Arrange
File.mocked_existing_files(['package.json'])
File.files_to_read('package.json' => '{ "codegenConfig": {"name": "MySpec"}}')
# Act
codegen = CodegenUtils.new().get_codegen_config_from_file('package.json', 'codegenConfig')
# Assert
assert_equal(codegen, { "name" => "MySpec"})
end
# ======================= #
# Test - GetListOfJSSpecs #
# ======================= #
def testGetListOfJSSpecs_whenUsesLibraries_returnAListOfFiles
# Arrange
app_codegen_config = {
'libraries' => [
{
'name' => 'First Lib',
'jsSrcsDir' => './firstlib/js'
},
{
'name' => 'Second Lib',
'jsSrcsDir' => './secondlib/js'
},
]
}
app_path = "~/MyApp/"
Finder.set_files_for_paths({
'~/MyApp/./firstlib/js' => ["MyFabricComponent1NativeComponent.js", "MyFabricComponent2NativeComponent.js"],
'~/MyApp/./secondlib/js' => ["NativeModule1.js", "NativeModule2.js"],
})
# Act
files = CodegenUtils.new().get_list_of_js_specs(app_codegen_config, app_path)
# Assert
assert_equal(Pod::UI.collected_warns , ["[Deprecated] You are using the old `libraries` array to list all your codegen.\\nThis method will be removed in the future.\\nUpdate your `package.json` with a single object."])
assert_equal(Finder.captured_paths, ['~/MyApp/./firstlib/js', '~/MyApp/./secondlib/js'])
assert_equal(files, [
"${PODS_ROOT}/../MyFabricComponent1NativeComponent.js",
"${PODS_ROOT}/../MyFabricComponent2NativeComponent.js",
"${PODS_ROOT}/../NativeModule1.js",
"${PODS_ROOT}/../NativeModule2.js",
])
end
def testGetListOfJSSpecs_whenDoesNotUsesLibraries_returnAListOfFiles
# Arrange
app_codegen_config = {
'name' => 'First Lib',
'jsSrcsDir' => './js'
}
app_path = "~/MyApp/"
Finder.set_files_for_paths({
'~/MyApp/./js' => ["MyFabricComponent1NativeComponent.js", "NativeModule1.js"],
})
# Act
files = CodegenUtils.new().get_list_of_js_specs(app_codegen_config, app_path)
# Assert
assert_equal(Pod::UI.collected_warns , [])
assert_equal(Finder.captured_paths, ['~/MyApp/./js'])
assert_equal(files, [
"${PODS_ROOT}/../MyFabricComponent1NativeComponent.js",
"${PODS_ROOT}/../NativeModule1.js",
])
end
def testGetListOfJSSpecs_whenMisconfigured_aborts
# Arrange
app_codegen_config = {}
app_path = "~/MyApp/"
# Act
assert_raises() {
files = CodegenUtils.new().get_list_of_js_specs(app_codegen_config, app_path)
}
# Assert
assert_equal(Pod::UI.collected_warns , ["[Error] Codegen not properly configured. Please add the `codegenConfig` entry to your `package.json`"])
end
# ================================== #
# Test - GetReactCodegenScriptPhases #
# ================================== #
def testGetReactCodegenScriptPhases_whenAppPathNotDefined_abort
# Arrange
# Act
assert_raises() {
CodegenUtils.new().get_react_codegen_script_phases(nil)
}
# Assert
assert_equal(Pod::UI.collected_warns, ["[Codegen] error: app_path is requried to use codegen discovery."])
end
def testGetReactCodegenScriptPhases_returnTheScriptObject
# Arrange
app_path = "~/MyApp"
input_files = ["${PODS_ROOT}/../MyFabricComponent1NativeComponent.js", "${PODS_ROOT}/../NativeModule1.js"]
computed_script = "echo ScriptPhases"
codegen_config = { "name" => "MyCodegenModule", "jsSrcsDir" => "./js"}
codegen_utils_mock = CodegenUtilsMock.new(:js_spec_list => input_files, :codegen_config => codegen_config)
script_phase_extractor_mock = CodegenScriptPhaseExtractorMock.new(computed_script)
# Act
scripts = CodegenUtils.new().get_react_codegen_script_phases(
app_path,
:codegen_utils => codegen_utils_mock,
:script_phase_extractor => script_phase_extractor_mock
)
# Assert
assert_equal(codegen_utils_mock.get_codegen_config_from_file_params, [{
"config_key" => "codegenConfig",
"config_path" => "~/MyApp/package.json"
}])
assert_equal(codegen_utils_mock.get_list_of_js_specs_params, [{
"app_codegen_config" => {"jsSrcsDir"=>"./js", "name"=>"MyCodegenModule"},
"app_path" => "~/MyApp"
}])
assert_equal(script_phase_extractor_mock.extract_script_phase_params, [{
fabric_enabled: false,
react_native_path: "../node_modules/react-native",
relative_app_root: "~/MyApp",
relative_config_file_dir: ""
}])
assert_equal(scripts, {
'name': 'Generate Specs',
'execution_position': :before_compile,
'input_files' => input_files,
'show_env_vars_in_log': true,
'output_files': ["${DERIVED_FILE_DIR}/react-codegen.log"],
'script': computed_script
})
end
# ================================ #
# Test - UseReactCodegenDiscovery! #
# ================================ #
def testUseReactCodegenDiscovery_whenCodegenDisabled_doNothing
# Arrange
# Act
CodegenUtils.new().use_react_native_codegen_discovery!(true, nil)
# Assert
assert_false(CodegenUtils.react_codegen_discovery_done())
assert_equal(Pod::UI.collected_messages, [])
assert_equal(Pod::UI.collected_warns, [])
end
def testUseReactCodegenDiscovery_whenDiscoveryDone_doNothing
# Arrange
CodegenUtils.set_react_codegen_discovery_done(true)
# Act
CodegenUtils.new().use_react_native_codegen_discovery!(false, nil)
# Assert
assert_true(CodegenUtils.react_codegen_discovery_done())
assert_equal(Pod::UI.collected_messages, ["[Codegen] Skipping use_react_native_codegen_discovery."])
assert_equal(Pod::UI.collected_warns, [])
end
def testUseReactCodegenDiscovery_whenAppPathUndefined_abort
# Arrange
# Act
assert_raises(){
CodegenUtils.new().use_react_native_codegen_discovery!(false, nil)
}
# Assert
assert_false(CodegenUtils.react_codegen_discovery_done())
assert_equal(Pod::UI.collected_messages, [])
assert_equal(Pod::UI.collected_warns, [
'[Codegen] Error: app_path is required for use_react_native_codegen_discovery.',
'[Codegen] If you are calling use_react_native_codegen_discovery! in your Podfile, please remove the call and pass `app_path` and/or `config_file_dir` to `use_react_native!`.'
])
end
def testUseReactCodegenDiscovery_whenParametersAreGood_executeCodegen
# Arrange
app_path = "~/app"
computed_script = "echo TestScript"
codegen_spec = {"name" => "React-Codegen"}
codegen_utils_mock = CodegenUtilsMock.new(
:react_codegen_script_phases => computed_script,
:react_codegen_spec => codegen_spec
)
# Act
CodegenUtils.new().use_react_native_codegen_discovery!(
false,
app_path,
:codegen_utils => codegen_utils_mock
)
# Assert
assert_true(CodegenUtils.react_codegen_discovery_done())
assert_equal(Pod::UI.collected_warns, [
'[Codegen] warn: using experimental new codegen integration'
])
assert_equal(codegen_utils_mock.get_react_codegen_script_phases_params, [{
:app_path => "~/app",
:config_file_dir => "",
:config_key => "codegenConfig",
:fabric_enabled => false,
:react_native_path => "../node_modules/react-native"}
])
assert_equal(codegen_utils_mock.get_react_codegen_spec_params, [{
:fabric_enabled => false,
:folly_version=>"2021.07.22.00",
:package_json_file => "../node_modules/react-native/package.json",
:script_phases => "echo TestScript"
}])
assert_equal(codegen_utils_mock.generate_react_codegen_spec_params, [{
:codegen_output_dir=>"build/generated/ios",
:react_codegen_spec=>{"name"=>"React-Codegen"}
}])
assert_equal(Pod::Executable.executed_commands, [
{
"command" => "node",
"arguments"=> ["~/app/ios/../node_modules/react-native/scripts/generate-artifacts.js",
"-p", "~/app",
"-o", Pod::Config.instance.installation_root,
"-e", "false",
"-c", ""]
}
])
end
private
def get_podspec_no_fabric_no_script
spec = {
'name' => "React-Codegen",
'version' => "99.98.97",
'summary' => 'Temp pod for generated files for React Native',
'homepage' => 'https://facebook.com/',
'license' => 'Unlicense',
'authors' => 'Facebook',
'compiler_flags' => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32 -Wno-documentation -Wno-nullability-completeness -std=c++17",
'source' => { :git => '' },
'header_mappings_dir' => './',
'platforms' => {
'ios' => '11.0',
},
'source_files' => "**/*.{h,mm,cpp}",
'pod_target_xcconfig' => { "HEADER_SEARCH_PATHS" =>
[
"\"$(PODS_ROOT)/boost\"",
"\"$(PODS_ROOT)/RCT-Folly\"",
"\"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\"",
"\"$(PODS_ROOT)/Headers/Private/React-Fabric\"",
"\"$(PODS_ROOT)/Headers/Private/React-RCTFabric\"",
].join(' ')
},
'dependencies': {
"FBReactNativeSpec": ["99.98.97"],
"React-jsiexecutor": ["99.98.97"],
"RCT-Folly": ["2021.07.22.00"],
"RCTRequired": ["99.98.97"],
"RCTTypeSafety": ["99.98.97"],
"React-Core": ["99.98.97"],
"React-jsi": ["99.98.97"],
"ReactCommon/turbomodule/core": ["99.98.97"]
}
}
end
def get_podspec_fabric_and_script_phases(script_phases)
specs = get_podspec_no_fabric_no_script()
specs[:dependencies].merge!({
'React-graphics': ["99.98.97"],
'React-rncore': ["99.98.97"],
})
specs[:'script_phases'] = script_phases
return specs
end
end
@@ -208,10 +208,8 @@ def prepare_CXX_Flags_build_configuration(name)
end
def prepare_pod_target_installation_results_mock(name, configs)
return PodTargetInstallationResultsMock.new(
:name => name,
:native_target => TargetMock.new(name, configs)
)
target = TargetMock.new(name, configs)
return TargetInstallationResultMock.new(target, target)
end
def prepare_installer_for_cpp_flags(xcconfigs, build_configs)
@@ -232,8 +230,6 @@ def prepare_installer_for_cpp_flags(xcconfigs, build_configs)
[
AggregatedProjectMock.new(:xcconfigs => xcconfigs_map, :base_path => "a/path/")
],
:target_installation_results => TargetInstallationResultsMock.new(
:pod_target_installation_results => pod_target_installation_results_map
)
:pod_target_installation_results => pod_target_installation_results_map
)
end
@@ -0,0 +1,21 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
class CodegenScriptPhaseExtractorMock
attr_reader :extract_script_phase_params
@script_phase
def initialize(script_phase)
@script_phase = script_phase
@extract_script_phase_params = []
end
def extract_script_phase(options)
@extract_script_phase_params.push(options)
return @script_phase
end
end
@@ -0,0 +1,107 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
class CodegenUtilsMock
@js_spec_list
@codegen_config
@react_codegen_script_phases
@react_codegen_spec
attr_reader :get_codegen_config_from_file_params
attr_reader :get_list_of_js_specs_params
attr_reader :get_react_codegen_script_phases_params
attr_reader :get_react_codegen_spec_params
attr_reader :generate_react_codegen_spec_params
attr_reader :use_react_native_codegen_discovery_params
def initialize(js_spec_list: [], codegen_config: {}, react_codegen_script_phases: "", react_codegen_spec: {})
@js_spec_list = js_spec_list
@codegen_config = codegen_config
@get_codegen_config_from_file_params = []
@get_list_of_js_specs_params = []
@react_codegen_script_phases = react_codegen_script_phases
@react_codegen_spec = react_codegen_spec
@get_react_codegen_script_phases_params = []
@get_react_codegen_spec_params = []
@generate_react_codegen_spec_params = []
@use_react_native_codegen_discovery_params = []
end
def get_codegen_config_from_file(config_path, config_key)
@get_codegen_config_from_file_params.push({
"config_path" => config_path,
"config_key" => config_key
})
return @codegen_config
end
def get_list_of_js_specs(app_codegen_config, app_path)
@get_list_of_js_specs_params.push({
"app_codegen_config" => app_codegen_config,
"app_path" => app_path
})
return @js_spec_list
end
def get_react_codegen_script_phases(
app_path,
fabric_enabled: false,
config_file_dir: '',
react_native_path: "../node_modules/react-native",
config_key: 'codegenConfig',
codegen_utils: CodegenUtils.new(),
script_phase_extractor: CodegenScriptPhaseExtractor.new()
)
@get_react_codegen_script_phases_params.push({
app_path: app_path,
fabric_enabled: fabric_enabled,
config_file_dir: config_file_dir,
react_native_path: react_native_path,
config_key: config_key
})
return @react_codegen_script_phases
end
def get_react_codegen_spec(package_json_file, folly_version: '2021.07.22.00', fabric_enabled: false, script_phases: nil)
@get_react_codegen_spec_params.push({
package_json_file: package_json_file,
folly_version: folly_version,
fabric_enabled: fabric_enabled,
script_phases: script_phases
})
return @react_codegen_spec
end
def generate_react_codegen_podspec!(react_codegen_spec, codegen_output_dir)
@generate_react_codegen_spec_params.push({
react_codegen_spec: react_codegen_spec,
codegen_output_dir: codegen_output_dir
})
end
def use_react_native_codegen_discovery!(
codegen_disabled,
app_path,
react_native_path: "../node_modules/react-native",
fabric_enabled: false,
config_file_dir: '',
codegen_output_dir: 'build/generated/ios',
config_key: 'codegenConfig',
folly_version: "2021.07.22.00",
codegen_utils: CodegenUtils.new()
)
@use_react_native_codegen_discovery_params.push({
codegen_disabled: codegen_disabled,
app_path: app_path,
react_native_path: react_native_path,
fabric_enabled: fabric_enabled,
config_file_dir: config_file_dir,
codegen_output_dir: codegen_output_dir,
folly_version: folly_version
})
end
end
@@ -0,0 +1,28 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
class Finder
@@captured_paths = []
@@files_for_paths = {}
def self.find_codegen_file(path)
@@captured_paths.push(path)
return @@files_for_paths[path]
end
def self.set_files_for_paths(files_for_paths)
@@files_for_paths = files_for_paths
end
def self.captured_paths
return @@captured_paths
end
def self.reset()
@@captured_paths = []
@@files_for_paths = {}
end
end
@@ -41,10 +41,23 @@ class InstallerMock
attr_reader :aggregate_targets
attr_reader :target_installation_results
def initialize(pods_project = PodsProjectMock.new, aggregate_targets = [AggregatedProjectMock.new], target_installation_results: [])
InstallationResults = Struct.new(:pod_target_installation_results, :aggregate_target_installation_results)
def initialize(pods_project = PodsProjectMock.new, aggregate_targets = [AggregatedProjectMock.new],
pod_target_installation_results: {},
aggregate_target_installation_results: {})
@pods_project = pods_project
@aggregate_targets = aggregate_targets
@target_installation_results = target_installation_results
@target_installation_results = InstallationResults.new(pod_target_installation_results, aggregate_target_installation_results)
aggregate_targets.each do |aggregate_target|
aggregate_target.user_project.native_targets.each do |target|
@target_installation_results.pod_target_installation_results[target.name] = TargetInstallationResultMock.new(target, target)
end
end
pods_project.native_targets.each do |target|
@target_installation_results.pod_target_installation_results[target.name] = TargetInstallationResultMock.new(target, target)
end
end
def target_with_name(name)
@@ -168,20 +181,27 @@ class BuildConfigurationMock
end
end
class TargetInstallationResultsMock
attr_reader :pod_target_installation_results
def initialize(pod_target_installation_results: {})
@pod_target_installation_results = pod_target_installation_results
end
end
class PodTargetInstallationResultsMock
attr_reader :name
class TargetInstallationResultMock
attr_reader :target
attr_reader :native_target
attr_reader :resource_bundle_targets
attr_reader :test_native_targets
attr_reader :test_resource_bundle_targets
attr_reader :test_app_host_targets
attr_reader :app_native_targets
attr_reader :app_resource_bundle_targets
def initialize(name: "", native_target: TargetMock.new())
@name = name
def initialize(target = TargetMock, native_target = TargetMock,
resource_bundle_targets = [], test_native_targets = [],
test_resource_bundle_targets = {}, test_app_host_targets = [],
app_native_targets = {}, app_resource_bundle_targets = {})
@target = target
@native_target = native_target
@resource_bundle_targets = resource_bundle_targets
@test_native_targets = test_native_targets
@test_resource_bundle_targets = test_resource_bundle_targets
@test_app_host_targets = test_app_host_targets
@app_native_targets = app_native_targets
@app_resource_bundle_targets = app_resource_bundle_targets
end
end
@@ -7,6 +7,20 @@ class Pathname
@@pwd = ""
@@pwd_invocation_count = 0
attr_reader :path
def initialize(path)
@path = path
end
def realpath
return self
end
def relative_path_from(path)
return @path
end
def self.pwd!(pwd)
@@pwd = pwd
end
+55 -1
View File
@@ -315,6 +315,60 @@ class UtilsTests < Test::Unit::TestCase
assert_equal(pods_projects_mock.save_invocation_count, 1)
end
# ============================================= #
# Test - Fix React-bridging Header Search Paths #
# ============================================= #
def test_fixReactBridgingHeaderSearchPaths_correctlySetsTheHeaderSearchPathsForAllTargets
# Arrange
first_target = prepare_target("FirstTarget")
second_target = prepare_target("SecondTarget")
third_target = TargetMock.new("ThirdTarget", [
BuildConfigurationMock.new("Debug", {
"HEADER_SEARCH_PATHS" => '$(inherited) "${PODS_ROOT}/Headers/Public" '
}),
BuildConfigurationMock.new("Release", {
"HEADER_SEARCH_PATHS" => '$(inherited) "${PODS_ROOT}/Headers/Public" '
}),
], nil)
user_project_mock = UserProjectMock.new("a/path", [
prepare_config("Debug"),
prepare_config("Release"),
],
:native_targets => [
first_target,
second_target
]
)
pods_projects_mock = PodsProjectMock.new([], {"hermes-engine" => {}}, :native_targets => [
third_target
])
installer = InstallerMock.new(pods_projects_mock, [
AggregatedProjectMock.new(user_project_mock)
])
# Act
ReactNativePodsUtils.fix_react_bridging_header_search_paths(installer)
# Assert
first_target.build_configurations.each do |config|
assert_equal(config.build_settings["HEADER_SEARCH_PATHS"].strip,
'$(inherited) "$(PODS_ROOT)/Headers/Private/React-bridging/react/bridging" "$(PODS_CONFIGURATION_BUILD_DIR)/React-bridging/react_bridging.framework/Headers"'
)
end
second_target.build_configurations.each do |config|
assert_equal(config.build_settings["HEADER_SEARCH_PATHS"].strip,
'$(inherited) "$(PODS_ROOT)/Headers/Private/React-bridging/react/bridging" "$(PODS_CONFIGURATION_BUILD_DIR)/React-bridging/react_bridging.framework/Headers"'
)
end
third_target.build_configurations.each do |config|
assert_equal(config.build_settings["HEADER_SEARCH_PATHS"].strip,
'$(inherited) "${PODS_ROOT}/Headers/Public" "$(PODS_ROOT)/Headers/Private/React-bridging/react/bridging" "$(PODS_CONFIGURATION_BUILD_DIR)/React-bridging/react_bridging.framework/Headers"'
)
end
end
# ================================= #
# Test - Apply Mac Catalyst Patches #
# ================================= #
@@ -352,7 +406,7 @@ class UtilsTests < Test::Unit::TestCase
third_target.build_configurations.each do |config|
assert_equal(config.build_settings["CODE_SIGN_IDENTITY[sdk=macosx*]"], "-")
end
user_project_mock.native_targets.each do |target|
target.build_configurations.each do |config|
assert_equal(config.build_settings["DEAD_CODE_STRIPPING"], "YES")
+35
View File
@@ -65,3 +65,38 @@ def checkAndGenerateEmptyThirdPartyProvider!(react_native_path, new_arch_enabled
File.delete(temp_schema_list_path) if File.exist?(temp_schema_list_path)
end
end
def run_codegen!(
app_path,
config_file_dir,
new_arch_enabled: false,
disable_codegen: false,
react_native_path: "../node_modules/react-native",
fabric_enabled: false,
codegen_output_dir: 'build/generated/ios',
config_key: 'codegenConfig',
package_json_file: '~/app/package.json',
folly_version: '2021.07.22.00',
codegen_utils: CodegenUtils.new()
)
if new_arch_enabled
codegen_utils.use_react_native_codegen_discovery!(
disable_codegen,
app_path,
:react_native_path => react_native_path,
:fabric_enabled => fabric_enabled,
:config_file_dir => config_file_dir,
:codegen_output_dir => codegen_output_dir,
:config_key => config_key,
:folly_version => folly_version
)
else
# Generate a podspec file for generated files.
# This gets generated in use_react_native_codegen_discovery when codegen discovery is enabled.
react_codegen_spec = codegen_utils.get_react_codegen_spec(
package_json_file,
:fabric_enabled => fabric_enabled
)
codegen_utils.generate_react_codegen_podspec!(react_codegen_spec, codegen_output_dir)
end
end
@@ -0,0 +1,13 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
class CodegenScriptPhaseExtractor
def initialize()
end
def extract_script_phase(options)
get_script_phases_with_codegen_discovery(options)
end
end
+286
View File
@@ -0,0 +1,286 @@
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
require 'json'
require_relative './helpers.rb'
require_relative './codegen_script_phase_extractor.rb'
class CodegenUtils
def initialize()
end
@@REACT_CODEGEN_PODSPEC_GENERATED = false
def self.set_react_codegen_podspec_generated(value)
@@REACT_CODEGEN_PODSPEC_GENERATED = value
end
def self.react_codegen_podspec_generated
@@REACT_CODEGEN_PODSPEC_GENERATED
end
@@REACT_CODEGEN_DISCOVERY_DONE = false
def self.set_react_codegen_discovery_done(value)
@@REACT_CODEGEN_DISCOVERY_DONE = value
end
def self.react_codegen_discovery_done
@@REACT_CODEGEN_DISCOVERY_DONE
end
# It takes some cocoapods specs and writes them into a file
#
# Parameters
# - spec: the cocoapod specs
# - codegen_output_dir: the output directory for the codegen
def generate_react_codegen_podspec!(spec, codegen_output_dir)
# This podspec file should only be create once in the session/pod install.
# This happens when multiple targets are calling use_react_native!.
if @@REACT_CODEGEN_PODSPEC_GENERATED
Pod::UI.puts "[Codegen] Skipping React-Codegen podspec generation."
return
end
relative_installation_root = Pod::Config.instance.installation_root.relative_path_from(Pathname.pwd)
output_dir = "#{relative_installation_root}/#{codegen_output_dir}"
Pod::Executable.execute_command("mkdir", ["-p", output_dir]);
podspec_path = File.join(output_dir, 'React-Codegen.podspec.json')
Pod::UI.puts "[Codegen] Generating #{podspec_path}"
File.open(podspec_path, 'w') do |f|
f.write(spec.to_json)
f.fsync
end
@@REACT_CODEGEN_PODSPEC_GENERATED = true
end
# It generates the podspec object that represents the `React-Codegen.podspec` file
#
# Parameters
# - package_json_file: the path to the `package.json`, required to extract the proper React Native version
# - fabric_enabled: whether fabric is enabled or not.
# - script_phases: whether we want to add some build script phases or not.
def get_react_codegen_spec(package_json_file, folly_version: '2021.07.22.00', fabric_enabled: false, script_phases: nil)
package = JSON.parse(File.read(package_json_file))
version = package['version']
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
boost_compiler_flags = '-Wno-documentation'
spec = {
'name' => "React-Codegen",
'version' => version,
'summary' => 'Temp pod for generated files for React Native',
'homepage' => 'https://facebook.com/',
'license' => 'Unlicense',
'authors' => 'Facebook',
'compiler_flags' => "#{folly_compiler_flags} #{boost_compiler_flags} -Wno-nullability-completeness -std=c++17",
'source' => { :git => '' },
'header_mappings_dir' => './',
'platforms' => {
'ios' => '11.0',
},
'source_files' => "**/*.{h,mm,cpp}",
'pod_target_xcconfig' => { "HEADER_SEARCH_PATHS" =>
[
"\"$(PODS_ROOT)/boost\"",
"\"$(PODS_ROOT)/RCT-Folly\"",
"\"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\"",
"\"$(PODS_ROOT)/Headers/Private/React-Fabric\"",
"\"$(PODS_ROOT)/Headers/Private/React-RCTFabric\"",
].join(' ')
},
'dependencies': {
"FBReactNativeSpec": [version],
"React-jsiexecutor": [version],
"RCT-Folly": [folly_version],
"RCTRequired": [version],
"RCTTypeSafety": [version],
"React-Core": [version],
"React-jsi": [version],
"ReactCommon/turbomodule/core": [version]
}
}
if fabric_enabled
spec[:'dependencies'].merge!({
'React-graphics': [version],
'React-rncore': [version],
});
end
if script_phases
Pod::UI.puts "[Codegen] Adding script_phases to React-Codegen."
spec[:'script_phases'] = script_phases
end
return spec
end
# It extracts the codegen config from the configuration file
#
# Parameters
# - config_path: a path to the configuration file
# - config_ket: the codegen configuration key
#
# Returns: the list of dependencies as extracted from the package.json
def get_codegen_config_from_file(config_path, config_key)
empty = {'libraries' => []}
if !File.exist?(config_path)
return empty
end
config = JSON.parse(File.read(config_path))
return config[config_key] ? config[config_key] : empty
end
# It creates a list of JS files that contains the JS specifications that Codegen needs to use to generate the code
#
# Parameters
# - app_codegen_config: an object that contains the configurations
# - app_path: path to the app
#
# Returns: the list of files that needs to be used by Codegen
def get_list_of_js_specs(app_codegen_config, app_path)
file_list = []
if app_codegen_config['libraries'] then
Pod::UI.warn '[Deprecated] You are using the old `libraries` array to list all your codegen.\nThis method will be removed in the future.\nUpdate your `package.json` with a single object.'
app_codegen_config['libraries'].each do |library|
library_dir = File.join(app_path, library['jsSrcsDir'])
file_list.concat(Finder.find_codegen_file(library_dir))
end
elsif app_codegen_config['jsSrcsDir'] then
codegen_dir = File.join(app_path, app_codegen_config['jsSrcsDir'])
file_list.concat (Finder.find_codegen_file(codegen_dir))
else
Pod::UI.warn '[Error] Codegen not properly configured. Please add the `codegenConfig` entry to your `package.json`'
abort
end
input_files = file_list.map { |filename| "${PODS_ROOT}/../#{Pathname.new(filename).realpath().relative_path_from(Pod::Config.instance.installation_root)}" }
return input_files
end
# It generates the build script phase for the codegen
#
# Parameters
# - app_path: the path to the app
# - fabric_enabled: whether fabric is enabled or not
# - config_file_dir: the directory of the config file
# - react_native_path: the path to React Native
# - config_key: the configuration key to use in the package.json for the Codegen
# - codegen_utils: an object which exposes utilities functions for the codegen
# - script_phase_extractor: an object that is able to extract the Xcode Script Phases for React Native
#
# Return: an object containing the script phase
def get_react_codegen_script_phases(
app_path,
fabric_enabled: false,
config_file_dir: '',
react_native_path: "../node_modules/react-native",
config_key: 'codegenConfig',
codegen_utils: CodegenUtils.new(),
script_phase_extractor: CodegenScriptPhaseExtractor.new()
)
if !app_path
Pod::UI.warn '[Codegen] error: app_path is requried to use codegen discovery.'
abort
end
# We need to convert paths to relative path from installation_root for the script phase for CI.
relative_app_root = Pathname.new(app_path).realpath().relative_path_from(Pod::Config.instance.installation_root)
relative_config_file_dir = ''
if config_file_dir != ''
relative_config_file_dir = Pathname.new(config_file_dir).relative_path_from(Pod::Config.instance.installation_root)
end
# Generate input files for in-app libaraies which will be used to check if the script needs to be run.
# TODO: Ideally, we generate the input_files list from generate-artifacts.js and read the result here.
# Or, generate this podspec in generate-artifacts.js as well.
app_package_path = File.join(app_path, 'package.json')
app_codegen_config = codegen_utils.get_codegen_config_from_file(app_package_path, config_key)
input_files = codegen_utils.get_list_of_js_specs(app_codegen_config, app_path)
# Add a script phase to trigger generate artifact.
# Some code is duplicated so that it's easier to delete the old way and switch over to this once it's stabilized.
return {
'name': 'Generate Specs',
'execution_position': :before_compile,
'input_files' => input_files,
'show_env_vars_in_log': true,
'output_files': ["${DERIVED_FILE_DIR}/react-codegen.log"],
'script': script_phase_extractor.extract_script_phase(
react_native_path: react_native_path,
relative_app_root: relative_app_root,
relative_config_file_dir: relative_config_file_dir,
fabric_enabled: fabric_enabled
),
}
end
def use_react_native_codegen_discovery!(
codegen_disabled,
app_path,
react_native_path: "../node_modules/react-native",
fabric_enabled: false,
config_file_dir: '',
codegen_output_dir: 'build/generated/ios',
config_key: 'codegenConfig',
folly_version: '2021.07.22.00',
codegen_utils: CodegenUtils.new()
)
return if codegen_disabled
if CodegenUtils.react_codegen_discovery_done()
Pod::UI.puts "[Codegen] Skipping use_react_native_codegen_discovery."
return
end
if !app_path
Pod::UI.warn '[Codegen] Error: app_path is required for use_react_native_codegen_discovery.'
Pod::UI.warn '[Codegen] If you are calling use_react_native_codegen_discovery! in your Podfile, please remove the call and pass `app_path` and/or `config_file_dir` to `use_react_native!`.'
abort
end
Pod::UI.warn '[Codegen] warn: using experimental new codegen integration'
relative_installation_root = Pod::Config.instance.installation_root.relative_path_from(Pathname.pwd)
# Generate React-Codegen podspec here to add the script phases.
script_phases = codegen_utils.get_react_codegen_script_phases(
app_path,
:fabric_enabled => fabric_enabled,
:config_file_dir => config_file_dir,
:react_native_path => react_native_path,
:config_key => config_key
)
react_codegen_spec = codegen_utils.get_react_codegen_spec(
File.join(react_native_path, "package.json"),
:folly_version => folly_version,
:fabric_enabled => fabric_enabled,
:script_phases => script_phases
)
codegen_utils.generate_react_codegen_podspec!(react_codegen_spec, codegen_output_dir)
out = Pod::Executable.execute_command(
'node',
[
"#{relative_installation_root}/#{react_native_path}/scripts/generate-artifacts.js",
"-p", "#{app_path}",
"-o", Pod::Config.instance.installation_root,
"-e", "#{fabric_enabled}",
"-c", "#{config_file_dir}",
])
Pod::UI.puts out;
CodegenUtils.set_react_codegen_discovery_done(true)
end
end
+8
View File
@@ -18,3 +18,11 @@ class Environment
return RUBY_PLATFORM
end
end
class Finder
def self.find_codegen_file(path)
js_files = '-name "Native*.js" -or -name "*NativeComponent.js"'
ts_files = '-name "Native*.ts" -or -name "*NativeComponent.ts"'
return `find #{path} -type f \\( #{js_files} -or #{ts_files} \\)`.split("\n").sort()
end
end
+12
View File
@@ -93,6 +93,18 @@ class ReactNativePodsUtils
end
end
def self.fix_react_bridging_header_search_paths(installer)
installer.target_installation_results.pod_target_installation_results
.each do |pod_name, target_installation_result|
target_installation_result.native_target.build_configurations.each do |config|
# For third party modules who have React-bridging dependency to search correct headers
config.build_settings['HEADER_SEARCH_PATHS'] ||= '$(inherited) '
config.build_settings['HEADER_SEARCH_PATHS'] << '"$(PODS_ROOT)/Headers/Private/React-bridging/react/bridging" '
config.build_settings['HEADER_SEARCH_PATHS'] << '"$(PODS_CONFIGURATION_BUILD_DIR)/React-bridging/react_bridging.framework/Headers" '
end
end
end
def self.apply_mac_catalyst_patches(installer)
# Fix bundle signing issues
installer.pods_project.targets.each do |target|
+51 -250
View File
@@ -11,6 +11,7 @@ require_relative './cocoapods/hermes.rb'
require_relative './cocoapods/flipper.rb'
require_relative './cocoapods/fabric.rb'
require_relative './cocoapods/codegen.rb'
require_relative './cocoapods/codegen_utils.rb'
require_relative './cocoapods/utils.rb'
require_relative './cocoapods/new_architecture.rb'
require_relative './cocoapods/local_podspec_patch.rb'
@@ -18,28 +19,34 @@ require_relative './cocoapods/local_podspec_patch.rb'
$CODEGEN_OUTPUT_DIR = 'build/generated/ios'
$CODEGEN_COMPONENT_DIR = 'react/renderer/components'
$CODEGEN_MODULE_DIR = '.'
$REACT_CODEGEN_PODSPEC_GENERATED = false
$REACT_CODEGEN_DISCOVERY_DONE = false
$START_TIME = Time.now.to_i
def use_react_native! (options={})
# The prefix to react-native
prefix = options[:path] ||= "../node_modules/react-native"
# Function that setup all the react native dependencies
# 
# Parameters
# - path: path to react_native installation.
# - fabric_enabled: whether fabric should be enabled or not.
# - new_arch_enabled: whether the new architecture should be enabled or not.
# - production: whether the dependencies must be installed to target a Debug or a Release build.
# - hermes_enabled: whether Hermes should be enabled or not.
# - flipper_configuration: The configuration to use for flipper.
# - app_path: path to the React Native app. Required by the New Architecture.
# - config_file_dir: directory of the `package.json` file, required by the New Architecture.
def use_react_native! (
path: "../node_modules/react-native",
fabric_enabled: false,
new_arch_enabled: ENV['RCT_NEW_ARCH_ENABLED'] == '1',
production: ENV['PRODUCTION'] == '1',
hermes_enabled: true,
flipper_configuration: FlipperConfiguration.disabled,
app_path: '..',
config_file_dir: '')
# Include Fabric dependencies
fabric_enabled = options[:fabric_enabled] ||= false
prefix = path
# New arch enabled
new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
# Include DevSupport dependency
production = options[:production] ||= false
# Include Hermes dependencies
hermes_enabled = options[:hermes_enabled] != nil ? options[:hermes_enabled] : true
flipper_configuration = options[:flipper_configuration] ||= FlipperConfiguration.disabled
# The version of folly that must be used
folly_version = '2021.07.22.00'
ReactNativePodsUtils.warn_if_not_on_arm64()
@@ -79,21 +86,17 @@ def use_react_native! (options={})
pod 'boost', :podspec => "#{prefix}/third-party-podspecs/boost.podspec"
pod 'RCT-Folly', :podspec => "#{prefix}/third-party-podspecs/RCT-Folly.podspec", :modular_headers => true
if new_arch_enabled
app_path = options[:app_path]
config_file_dir = options[:config_file_dir]
use_react_native_codegen_discovery!({
react_native_path: prefix,
app_path: app_path,
fabric_enabled: fabric_enabled,
config_file_dir: config_file_dir,
})
else
# Generate a podspec file for generated files.
# This gets generated in use_react_native_codegen_discovery when codegen discovery is enabled.
react_codegen_spec = get_react_codegen_spec(fabric_enabled: fabric_enabled)
generate_react_codegen_podspec!(react_codegen_spec)
end
run_codegen!(
app_path,
config_file_dir,
:new_arch_enabled => new_arch_enabled,
:disable_codegen => ENV['DISABLE_CODEGEN'] == '1',
:react_native_path => prefix,
:fabric_enabled => fabric_enabled,
:codegen_output_dir => $CODEGEN_OUTPUT_DIR,
:package_json_file => File.join(__dir__, "..", "package.json"),
:folly_version => folly_version
)
pod 'React-Codegen', :path => $CODEGEN_OUTPUT_DIR, :modular_headers => true
@@ -123,15 +126,27 @@ def use_react_native! (options={})
end
end
# It returns the default flags.
def get_default_flags()
return ReactNativePodsUtils.get_default_flags()
end
# It installs the flipper dependencies into the project.
#
# Parameters
# - versions: a dictionary of Flipper Library -> Versions that can be used to customize which version of Flipper to install.
# - configurations: an array of configuration where to install the dependencies.
def use_flipper!(versions = {}, configurations: ['Debug'])
Pod::UI.warn "use_flipper is deprecated, use the flipper_configuration option in the use_react_native function"
use_flipper_pods(versions, :configurations => configurations)
end
# Function that executes after React Native has been installed to configure some flags and build settings.
#
# Parameters
# - installer: the Cocoapod object that allows to customize the project.
# - react_native_path: path to React Native.
# - mac_catalyst_enabled: whether we are running the Pod on a Mac Catalyst project or not.
def react_native_post_install(installer, react_native_path = "../node_modules/react-native", mac_catalyst_enabled: false)
ReactNativePodsUtils.apply_mac_catalyst_patches(installer) if mac_catalyst_enabled
@@ -141,6 +156,7 @@ def react_native_post_install(installer, react_native_path = "../node_modules/re
ReactNativePodsUtils.exclude_i386_architecture_while_using_hermes(installer)
ReactNativePodsUtils.fix_library_search_paths(installer)
ReactNativePodsUtils.fix_react_bridging_header_search_paths(installer)
ReactNativePodsUtils.set_node_modules_user_settings(installer, react_native_path)
NewArchitectureHelper.set_clang_cxx_language_standard_if_needed(installer)
@@ -150,224 +166,9 @@ def react_native_post_install(installer, react_native_path = "../node_modules/re
Pod::UI.puts "Pod install took #{Time.now.to_i - $START_TIME} [s] to run".green
end
def get_react_codegen_spec(options={})
fabric_enabled = options[:fabric_enabled] ||= false
script_phases = options[:script_phases] ||= nil
package = JSON.parse(File.read(File.join(__dir__, "..", "package.json")))
version = package['version']
source = { :git => 'https://github.com/facebook/react-native.git' }
if version == '1000.0.0'
# This is an unpublished version, use the latest commit hash of the react-native repo, which were presumably in.
source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
else
source[:tag] = "v#{version}"
end
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
folly_version = '2021.07.22.00'
boost_version = '1.76.0'
boost_compiler_flags = '-Wno-documentation'
spec = {
'name' => "React-Codegen",
'version' => version,
'summary' => 'Temp pod for generated files for React Native',
'homepage' => 'https://facebook.com/',
'license' => 'Unlicense',
'authors' => 'Facebook',
'compiler_flags' => "#{folly_compiler_flags} #{boost_compiler_flags} -Wno-nullability-completeness -std=c++17",
'source' => { :git => '' },
'header_mappings_dir' => './',
'platforms' => {
'ios' => '11.0',
},
'source_files' => "**/*.{h,mm,cpp}",
'pod_target_xcconfig' => { "HEADER_SEARCH_PATHS" =>
[
"\"$(PODS_ROOT)/boost\"",
"\"$(PODS_ROOT)/RCT-Folly\"",
"\"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\"",
"\"$(PODS_ROOT)/Headers/Private/React-Fabric\"",
"\"$(PODS_ROOT)/Headers/Private/React-RCTFabric\"",
].join(' ')
},
'dependencies': {
"FBReactNativeSpec": [version],
"React-jsiexecutor": [version],
"RCT-Folly": [folly_version],
"RCTRequired": [version],
"RCTTypeSafety": [version],
"React-Core": [version],
"React-jsi": [version],
"ReactCommon/turbomodule/core": [version]
}
}
if fabric_enabled
spec[:'dependencies'].merge!({
'React-graphics': [version],
'React-rncore': [version],
});
end
if script_phases
Pod::UI.puts "[Codegen] Adding script_phases to React-Codegen."
spec[:'script_phases'] = script_phases
end
return spec
end
def get_codegen_config_from_file(config_path, config_key)
empty = {'libraries' => []}
if !File.exist?(config_path)
return empty
end
config = JSON.parse(File.read(config_path))
return config[config_key] ? config[config_key] : empty
end
def get_react_codegen_script_phases(options={})
app_path = options[:app_path] ||= ''
if !app_path
Pod::UI.warn '[Codegen] error: app_path is requried to use codegen discovery.'
exit 1
end
# We need to convert paths to relative path from installation_root for the script phase for CI.
relative_app_root = Pathname.new(app_path).realpath().relative_path_from(Pod::Config.instance.installation_root)
config_file_dir = options[:config_file_dir] ||= ''
relative_config_file_dir = ''
if config_file_dir != ''
relative_config_file_dir = Pathname.new(config_file_dir).relative_path_from(Pod::Config.instance.installation_root)
end
fabric_enabled = options[:fabric_enabled] ||= false
# react_native_path should be relative already.
react_native_path = options[:react_native_path] ||= "../node_modules/react-native"
# Generate input files for in-app libaraies which will be used to check if the script needs to be run.
# TODO: Ideally, we generate the input_files list from generate-artifacts.js and read the result here.
# Or, generate this podspec in generate-artifacts.js as well.
config_key = options[:config_key] ||= 'codegenConfig'
app_package_path = File.join(app_path, 'package.json')
app_codegen_config = get_codegen_config_from_file(app_package_path, config_key)
file_list = []
if app_codegen_config['libraries'] then
Pod::UI.warn '[Deprecated] You are using the old `libraries` array to list all your codegen.\nThis method will be removed in the future.\nUpdate your `package.json` with a single object.'
app_codegen_config['libraries'].each do |library|
library_dir = File.join(app_path, library['jsSrcsDir'])
file_list.concat (`find #{library_dir} -type f \\( -name "Native*.js" -or -name "*NativeComponent.js" \\)`.split("\n").sort)
end
elsif app_codegen_config['jsSrcsDir'] then
codegen_dir = File.join(app_path, app_codegen_config['jsSrcsDir'])
file_list.concat (`find #{codegen_dir} -type f \\( -name "Native*.js" -or -name "*NativeComponent.js" \\)`.split("\n").sort)
else
Pod::UI.warn '[Error] Codegen not properly configured. Please add the `codegenConf` entry to your `package.json`'
exit 1
end
input_files = file_list.map { |filename| "${PODS_ROOT}/../#{Pathname.new(filename).realpath().relative_path_from(Pod::Config.instance.installation_root)}" }
# Add a script phase to trigger generate artifact.
# Some code is duplicated so that it's easier to delete the old way and switch over to this once it's stabilized.
return {
'name': 'Generate Specs',
'execution_position': :before_compile,
'input_files' => input_files,
'show_env_vars_in_log': true,
'output_files': ["${DERIVED_FILE_DIR}/react-codegen.log"],
'script': get_script_phases_with_codegen_discovery(
react_native_path: react_native_path,
relative_app_root: relative_app_root,
relative_config_file_dir: relative_config_file_dir,
fabric_enabled: fabric_enabled
),
}
end
def set_react_codegen_podspec_generated(value)
$REACT_CODEGEN_PODSPEC_GENERATED = value
end
def has_react_codegen_podspec_generated()
return $REACT_CODEGEN_PODSPEC_GENERATED
end
def generate_react_codegen_podspec!(spec)
# This podspec file should only be create once in the session/pod install.
# This happens when multiple targets are calling use_react_native!.
if has_react_codegen_podspec_generated()
Pod::UI.puts "[Codegen] Skipping React-Codegen podspec generation."
return
end
relative_installation_root = Pod::Config.instance.installation_root.relative_path_from(Pathname.pwd)
output_dir = "#{relative_installation_root}/#{$CODEGEN_OUTPUT_DIR}"
Pod::Executable.execute_command("mkdir", ["-p", output_dir]);
podspec_path = File.join(output_dir, 'React-Codegen.podspec.json')
Pod::UI.puts "[Codegen] Generating #{podspec_path}"
File.open(podspec_path, 'w') do |f|
f.write(spec.to_json)
f.fsync
end
set_react_codegen_podspec_generated(true)
return {
"spec" => spec,
"path" => $CODEGEN_OUTPUT_DIR, # Path needs to be relative to `Podfile`
}
end
def use_react_native_codegen_discovery!(options={})
return if ENV['DISABLE_CODEGEN'] == '1'
if $REACT_CODEGEN_DISCOVERY_DONE
Pod::UI.puts "[Codegen] Skipping use_react_native_codegen_discovery."
return
end
Pod::UI.warn '[Codegen] warn: using experimental new codegen integration'
react_native_path = options[:react_native_path] ||= "../node_modules/react-native"
app_path = options[:app_path]
fabric_enabled = options[:fabric_enabled] ||= false
config_file_dir = options[:config_file_dir] ||= ''
relative_installation_root = Pod::Config.instance.installation_root.relative_path_from(Pathname.pwd)
if !app_path
Pod::UI.warn '[Codegen] Error: app_path is required for use_react_native_codegen_discovery.'
Pod::UI.warn '[Codegen] If you are calling use_react_native_codegen_discovery! in your Podfile, please remove the call and pass `app_path` and/or `config_file_dir` to `use_react_native!`.'
exit 1
end
# Generate React-Codegen podspec here to add the script phases.
script_phases = get_react_codegen_script_phases(options)
react_codegen_spec = get_react_codegen_spec(fabric_enabled: fabric_enabled, script_phases: script_phases)
generate_react_codegen_podspec!(react_codegen_spec)
out = Pod::Executable.execute_command(
'node',
[
"#{relative_installation_root}/#{react_native_path}/scripts/generate-artifacts.js",
"-p", "#{app_path}",
"-o", Pod::Config.instance.installation_root,
"-e", "#{fabric_enabled}",
"-c", "#{config_file_dir}",
])
Pod::UI.puts out;
$REACT_CODEGEN_DISCOVERY_DONE = true
end
# === LEGACY METHOD ===
# We need to keep this while we continue to support the old architecture.
# =====================
def use_react_native_codegen!(spec, options={})
return if ENV['RCT_NEW_ARCH_ENABLED'] == '1'
# TODO: Once the new codegen approach is ready for use, we should output a warning here to let folks know to migrate.
+6 -2
View File
@@ -33,7 +33,6 @@ selected_vm=""
PACKAGE_VERSION=""
test_android(){
generate_maven_artifacts
if [ "$1" == "1" ]; then
test_android_hermes
elif [ "$1" == "2" ]; then
@@ -43,7 +42,8 @@ test_android(){
generate_maven_artifacts(){
rm -rf android
./gradlew :ReactAndroid:installArchives || error "Couldn't generate artifacts"
./gradlew :ReactAndroid:installArchives || error "Couldn't generate React Native Maven artifacts"
./gradlew :ReactAndroid:hermes-engine:installArchives || error "Couldn't generate Hermes Engine Maven artifacts"
success "Generated artifacts for Maven"
}
@@ -109,6 +109,10 @@ kill_packagers(){
init_template_app(){
kill_packagers
if [ "$selected_platform" == "1" ]; then
generate_maven_artifacts
fi
PACKAGE_VERSION=$(cat package.json \
| grep version \
| head -1 \
+1
View File
@@ -0,0 +1 @@
hermes-2022-07-20-RNv0.70.0-bc97c5399e0789c0a323f8e1431986e207a9e8ba
+3 -1
View File
@@ -31,8 +31,10 @@ elsif version == '1000.0.0'
source[:commit] = `git ls-remote https://github.com/facebook/hermes main | cut -f 1`.strip
elsif currentremote.strip.end_with?("facebook/react-native.git") and currentbranch.strip.end_with?("-stable")
Pod::UI.puts '[Hermes] Detected that you are on a React Native release branch, building Hermes from source...'.yellow if Object.const_defined?("Pod::UI")
hermestag_file = File.join(__dir__, "..", ".hermesversion")
hermestag = File.read(hermestag_file).strip
source[:git] = git
source[:commit] = `git ls-remote https://github.com/facebook/hermes main | cut -f 1`.strip
source[:tag] = hermestag
else
source[:http] = "https://github.com/facebook/react-native/releases/download/v#{version}/hermes-runtime-darwin-v#{version}.tar.gz"
end
+1
View File
@@ -1,6 +1,7 @@
apply plugin: "com.android.application"
import com.android.build.OutputFile
import org.apache.tools.ant.taskdefs.condition.Os
/**
* The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets
-2
View File
@@ -1,5 +1,3 @@
import org.apache.tools.ant.taskdefs.condition.Os
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
+1 -1
View File
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
+2 -2
View File
@@ -11,7 +11,7 @@
},
"dependencies": {
"react": "18.1.0",
"react-native": "1000.0.0"
"react-native": "0.70.0-rc.2"
},
"devDependencies": {
"@babel/core": "^7.12.9",
@@ -20,7 +20,7 @@
"babel-jest": "^26.6.3",
"eslint": "^7.32.0",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "^0.71.3",
"metro-react-native-babel-preset": "^0.72.0",
"react-test-renderer": "18.1.0"
},
"jest": {
+522 -435
View File
File diff suppressed because it is too large Load Diff