-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32471 from staszekscp/hybrid-app-changes
- Loading branch information
Showing
31 changed files
with
465 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
diff --git a/node_modules/@react-native-camera-roll/camera-roll/android/build.gradle b/node_modules/@react-native-camera-roll/camera-roll/android/build.gradle | ||
index 3f76132..63dc946 100644 | ||
--- a/node_modules/@react-native-camera-roll/camera-roll/android/build.gradle | ||
+++ b/node_modules/@react-native-camera-roll/camera-roll/android/build.gradle | ||
@@ -81,7 +81,9 @@ def findNodeModulePath(baseDir, packageName) { | ||
} | ||
|
||
def resolveReactNativeDirectory() { | ||
- def reactNative = file("${findNodeModulePath(rootProject.projectDir, "react-native")}") | ||
+ def projectDir = this.hasProperty('reactNativeProject') ? this.reactNativeProject : rootProject.projectDir | ||
+ def modulePath = file(projectDir); | ||
+ def reactNative = file("${findNodeModulePath(modulePath, 'react-native')}") | ||
if (reactNative.exists()) { | ||
return reactNative | ||
} |
52 changes: 52 additions & 0 deletions
52
patches/@react-native-community+cli-platform-android+12.3.0.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
diff --git a/node_modules/@react-native-community/cli-platform-android/native_modules.gradle b/node_modules/@react-native-community/cli-platform-android/native_modules.gradle | ||
index bbfa7f7..ed53872 100644 | ||
--- a/node_modules/@react-native-community/cli-platform-android/native_modules.gradle | ||
+++ b/node_modules/@react-native-community/cli-platform-android/native_modules.gradle | ||
@@ -140,6 +140,7 @@ class ReactNativeModules { | ||
private Logger logger | ||
private String packageName | ||
private File root | ||
+ private File rnRoot | ||
private ArrayList<HashMap<String, String>> reactNativeModules | ||
private ArrayList<String> unstable_reactLegacyComponentNames | ||
private HashMap<String, ArrayList> reactNativeModulesBuildVariants | ||
@@ -147,9 +148,10 @@ class ReactNativeModules { | ||
|
||
private static String LOG_PREFIX = ":ReactNative:" | ||
|
||
- ReactNativeModules(Logger logger, File root) { | ||
+ ReactNativeModules(Logger logger, File root, File rnRoot) { | ||
this.logger = logger | ||
this.root = root | ||
+ this.rnRoot = rnRoot | ||
|
||
def (nativeModules, reactNativeModulesBuildVariants, androidProject, reactNativeVersion) = this.getReactNativeConfig() | ||
this.reactNativeModules = nativeModules | ||
@@ -416,10 +418,10 @@ class ReactNativeModules { | ||
*/ | ||
def cliResolveScript = "try {console.log(require('@react-native-community/cli').bin);} catch (e) {console.log(require('react-native/cli').bin);}" | ||
String[] nodeCommand = ["node", "-e", cliResolveScript] | ||
- def cliPath = this.getCommandOutput(nodeCommand, this.root) | ||
+ def cliPath = this.getCommandOutput(nodeCommand, this.rnRoot) | ||
|
||
String[] reactNativeConfigCommand = ["node", cliPath, "config"] | ||
- def reactNativeConfigOutput = this.getCommandOutput(reactNativeConfigCommand, this.root) | ||
+ def reactNativeConfigOutput = this.getCommandOutput(reactNativeConfigCommand, this.rnRoot) | ||
|
||
def json | ||
try { | ||
@@ -486,7 +488,13 @@ class ReactNativeModules { | ||
*/ | ||
def projectRoot = rootProject.projectDir | ||
|
||
-def autoModules = new ReactNativeModules(logger, projectRoot) | ||
+def autoModules | ||
+ | ||
+if(this.hasProperty('reactNativeProject')){ | ||
+ autoModules = new ReactNativeModules(logger, projectRoot, new File(projectRoot, reactNativeProject)) | ||
+} else { | ||
+ autoModules = new ReactNativeModules(logger, projectRoot, projectRoot) | ||
+} | ||
|
||
def reactNativeVersionRequireNewArchEnabled(autoModules) { | ||
def rnVersion = autoModules.reactNativeVersion |
52 changes: 52 additions & 0 deletions
52
patches/@react-native-community+cli-platform-ios+12.3.0.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
diff --git a/node_modules/@react-native-community/cli-platform-ios/native_modules.rb b/node_modules/@react-native-community/cli-platform-ios/native_modules.rb | ||
index 82f537c..f5e2cda 100644 | ||
--- a/node_modules/@react-native-community/cli-platform-ios/native_modules.rb | ||
+++ b/node_modules/@react-native-community/cli-platform-ios/native_modules.rb | ||
@@ -12,7 +12,7 @@ | ||
require 'pathname' | ||
require 'cocoapods' | ||
|
||
-def use_native_modules!(config = nil) | ||
+def updateConfig(config = nil) | ||
if (config.is_a? String) | ||
Pod::UI.warn("Passing custom root to use_native_modules! is deprecated.", | ||
[ | ||
@@ -24,7 +24,6 @@ def use_native_modules!(config = nil) | ||
# Resolving the path the RN CLI. The `@react-native-community/cli` module may not be there for certain package managers, so we fall back to resolving it through `react-native` package, that's always present in RN projects | ||
cli_resolve_script = "try {console.log(require('@react-native-community/cli').bin);} catch (e) {console.log(require('react-native/cli').bin);}" | ||
cli_bin = Pod::Executable.execute_command("node", ["-e", cli_resolve_script], true).strip | ||
- | ||
if (!config) | ||
json = [] | ||
|
||
@@ -36,10 +35,30 @@ def use_native_modules!(config = nil) | ||
|
||
config = JSON.parse(json.join("\n")) | ||
end | ||
+end | ||
+ | ||
+def use_native_modules!(config = nil) | ||
+ if (ENV['REACT_NATIVE_DIR']) | ||
+ Dir.chdir(ENV['REACT_NATIVE_DIR']) do | ||
+ config = updateConfig(config) | ||
+ end | ||
+ else | ||
+ config = updateConfig(config) | ||
+ end | ||
|
||
project_root = Pathname.new(config["project"]["ios"]["sourceDir"]) | ||
|
||
+ if(ENV["PROJECT_ROOT_DIR"]) | ||
+ project_root = File.join(Dir.pwd, ENV["PROJECT_ROOT_DIR"]) | ||
+ | ||
+ end | ||
+ | ||
packages = config["dependencies"] | ||
+ | ||
+ if (ENV["NO_FLIPPER"]) | ||
+ packages = {**packages, "react-native-flipper" => {"platforms" => {"ios" => nil}}} | ||
+ end | ||
+ | ||
found_pods = [] | ||
|
||
packages.each do |package_name, package| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
diff --git a/node_modules/@react-native-firebase/analytics/android/build.gradle b/node_modules/@react-native-firebase/analytics/android/build.gradle | ||
index d223ebf..821b730 100644 | ||
--- a/node_modules/@react-native-firebase/analytics/android/build.gradle | ||
+++ b/node_modules/@react-native-firebase/analytics/android/build.gradle | ||
@@ -45,6 +45,8 @@ if (coreVersionDetected != coreVersionRequired) { | ||
} | ||
} | ||
|
||
+apply plugin: 'com.android.library' | ||
+ | ||
project.ext { | ||
set('react-native', [ | ||
versions: [ | ||
@@ -144,4 +146,3 @@ dependencies { | ||
ReactNative.shared.applyPackageVersion() | ||
ReactNative.shared.applyDefaultExcludes() | ||
ReactNative.module.applyAndroidVersions() | ||
-ReactNative.module.applyReactNativeDependency("api") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
diff --git a/node_modules/@react-native-firebase/app/android/build.gradle b/node_modules/@react-native-firebase/app/android/build.gradle | ||
index 05f629a..7c36693 100644 | ||
--- a/node_modules/@react-native-firebase/app/android/build.gradle | ||
+++ b/node_modules/@react-native-firebase/app/android/build.gradle | ||
@@ -18,6 +18,7 @@ buildscript { | ||
|
||
plugins { | ||
id "io.invertase.gradle.build" version "1.5" | ||
+ id 'com.android.library' | ||
} | ||
|
||
def packageJson = PackageJson.getForProject(project) | ||
@@ -91,6 +92,7 @@ repositories { | ||
} | ||
|
||
dependencies { | ||
+ api 'com.facebook.react:react-native:+' | ||
implementation platform("com.google.firebase:firebase-bom:${ReactNative.ext.getVersion("firebase", "bom")}") | ||
implementation "com.google.firebase:firebase-common" | ||
implementation "com.google.android.gms:play-services-auth:${ReactNative.ext.getVersion("play", "play-services-auth")}" | ||
@@ -99,4 +101,3 @@ dependencies { | ||
ReactNative.shared.applyPackageVersion() | ||
ReactNative.shared.applyDefaultExcludes() | ||
ReactNative.module.applyAndroidVersions() | ||
-ReactNative.module.applyReactNativeDependency("api") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
diff --git a/node_modules/@react-native-firebase/crashlytics/android/build.gradle b/node_modules/@react-native-firebase/crashlytics/android/build.gradle | ||
index 6b6de57..9b89ae7 100644 | ||
--- a/node_modules/@react-native-firebase/crashlytics/android/build.gradle | ||
+++ b/node_modules/@react-native-firebase/crashlytics/android/build.gradle | ||
@@ -18,6 +18,7 @@ buildscript { | ||
|
||
plugins { | ||
id "io.invertase.gradle.build" version "1.5" | ||
+ id 'com.android.library' | ||
} | ||
|
||
def appProject | ||
@@ -92,4 +93,3 @@ dependencies { | ||
ReactNative.shared.applyPackageVersion() | ||
ReactNative.shared.applyDefaultExcludes() | ||
ReactNative.module.applyAndroidVersions() | ||
-ReactNative.module.applyReactNativeDependency("api") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
diff --git a/node_modules/@react-native-firebase/perf/android/build.gradle b/node_modules/@react-native-firebase/perf/android/build.gradle | ||
index b4a9c7b..5835e3d 100644 | ||
--- a/node_modules/@react-native-firebase/perf/android/build.gradle | ||
+++ b/node_modules/@react-native-firebase/perf/android/build.gradle | ||
@@ -19,6 +19,7 @@ buildscript { | ||
|
||
plugins { | ||
id "io.invertase.gradle.build" version "1.5" | ||
+ id 'com.android.library' | ||
} | ||
|
||
def appProject | ||
@@ -129,4 +130,3 @@ dependencies { | ||
ReactNative.shared.applyPackageVersion() | ||
ReactNative.shared.applyDefaultExcludes() | ||
ReactNative.module.applyAndroidVersions() | ||
-ReactNative.module.applyReactNativeDependency("api") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
diff --git a/node_modules/expo/scripts/autolinking.gradle b/node_modules/expo/scripts/autolinking.gradle | ||
index 60d6ef8..3ed90a4 100644 | ||
--- a/node_modules/expo/scripts/autolinking.gradle | ||
+++ b/node_modules/expo/scripts/autolinking.gradle | ||
@@ -1,4 +1,4 @@ | ||
// Resolve `expo` > `expo-modules-autolinking` dependency chain | ||
def autolinkingPath = ["node", "--print", "require.resolve('expo-modules-autolinking/package.json', { paths: [require.resolve('expo/package.json')] })"].execute(null, rootDir).text.trim() | ||
-apply from: new File(autolinkingPath, "../scripts/android/autolinking_implementation.gradle"); | ||
|
||
+apply from: hasProperty("reactNativeProject") ? file('../../expo-modules-autolinking/scripts/android/autolinking_implementation.gradle') : new File(autolinkingPath, "../scripts/android/autolinking_implementation.gradle"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
diff --git a/node_modules/expo-modules-autolinking/scripts/android/autolinking_implementation.gradle b/node_modules/expo-modules-autolinking/scripts/android/autolinking_implementation.gradle | ||
index 92f1fd6..ada01ad 100644 | ||
--- a/node_modules/expo-modules-autolinking/scripts/android/autolinking_implementation.gradle | ||
+++ b/node_modules/expo-modules-autolinking/scripts/android/autolinking_implementation.gradle | ||
@@ -149,12 +149,13 @@ class ExpoAutolinkingManager { | ||
} | ||
|
||
static private String[] convertOptionsToCommandArgs(String command, Map options) { | ||
+ def expoPath = options.searchPaths ? "../react-native/node_modules/expo" : "expo" | ||
String[] args = [ | ||
'node', | ||
'--no-warnings', | ||
'--eval', | ||
// Resolve the `expo` > `expo-modules-autolinking` chain from the project root | ||
- 'require(require.resolve(\'expo-modules-autolinking\', { paths: [require.resolve(\'expo\')] }))(process.argv.slice(1))', | ||
+ "require(require.resolve(\'expo-modules-autolinking\', { paths: [require.resolve(\'${expoPath}\')] }))(process.argv.slice(1))", | ||
'--', | ||
command, | ||
'--platform', | ||
diff --git a/node_modules/expo-modules-autolinking/scripts/ios/project_integrator.rb b/node_modules/expo-modules-autolinking/scripts/ios/project_integrator.rb | ||
index 5d46f1e..3db7b89 100644 | ||
--- a/node_modules/expo-modules-autolinking/scripts/ios/project_integrator.rb | ||
+++ b/node_modules/expo-modules-autolinking/scripts/ios/project_integrator.rb | ||
@@ -215,6 +215,7 @@ module Expo | ||
args = autolinking_manager.base_command_args.map { |arg| "\"#{arg}\"" } | ||
platform = autolinking_manager.platform_name.downcase | ||
package_names = autolinking_manager.packages_to_generate.map { |package| "\"#{package.name}\"" } | ||
+ expo_path = ENV['REACT_NATIVE_DIR'] ? "#{ENV['REACT_NATIVE_DIR']}/node_modules/expo" : "expo" | ||
|
||
<<~SUPPORT_SCRIPT | ||
#!/usr/bin/env bash | ||
@@ -262,7 +263,7 @@ module Expo | ||
|
||
with_node \\ | ||
--no-warnings \\ | ||
- --eval "require(require.resolve(\'expo-modules-autolinking\', { paths: [require.resolve(\'expo/package.json\')] }))(process.argv.slice(1))" \\ | ||
+ --eval "require(require.resolve(\'expo-modules-autolinking\', { paths: [require.resolve(\'#{expo_path}/package.json\')] }))(process.argv.slice(1))" \\ | ||
generate-modules-provider #{args.join(' ')} \\ | ||
--target "#{modules_provider_path}" \\ | ||
--platform "apple" \\ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
diff --git a/node_modules/expo-modules-core/android/build.gradle b/node_modules/expo-modules-core/android/build.gradle | ||
index 3603ffd..1599a69 100644 | ||
--- a/node_modules/expo-modules-core/android/build.gradle | ||
+++ b/node_modules/expo-modules-core/android/build.gradle | ||
@@ -53,9 +53,10 @@ def isExpoModulesCoreTests = { | ||
}.call() | ||
|
||
def REACT_NATIVE_BUILD_FROM_SOURCE = findProject(":packages:react-native:ReactAndroid") != null | ||
+def FALLBACK_REACT_NATIVE_DIR = hasProperty("reactNativeProject") ? file('../../react-native') : new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).parent | ||
def REACT_NATIVE_DIR = REACT_NATIVE_BUILD_FROM_SOURCE | ||
? findProject(":packages:react-native:ReactAndroid").getProjectDir().parent | ||
- : new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).parent | ||
+ : FALLBACK_REACT_NATIVE_DIR | ||
|
||
def reactProperties = new Properties() | ||
file("$REACT_NATIVE_DIR/ReactAndroid/gradle.properties").withInputStream { reactProperties.load(it) } |
Oops, something went wrong.