Skip to content

Commit

Permalink
feat: Xcode 15 support on React Native 0.71.14 (#7114)
Browse files Browse the repository at this point in the history
**Description**

Xcode 14.2+ support (notable Xcode 15)
-
#6158 (comment)

TODO
- [x] Fix Branch build error
- Fork Branch repo, bump `IPHONEOS_DEPLOYMENT_TARGET`s from 8 to 12,
update git submodule
- [x] Fix MixPanel build error
- Fork MixPanel repo, `IPHONEOS_DEPLOYMENT_TARGET`s from 8 to 12, update
git submodule
- [x] Upgrade RN from 0.71.6 to 0.71.13
- [x] Refactor Podfile
- [x] Raise/fix Sentry build issue
- [x] Update `react-native.config.js` to support `NO_FLIPPER` env var
- [x] Fix Yoga/YogaKit build error (disable Flipper natively)
- [x] Fix Xcode 15 build error: Unable to load ...frameworks-Debug-input-files.xcfilelist
- [x] Bump BitRise stack from osx-xcode-14.2.x-ventura to osx-xcode-15.0.x
- [x] Upgrade RN from 0.71.13 to 0.71.14 (for additional Xcode 15 compat)
- [x] Upgrade Detox for additional Xcode 15 compat
- [x] Fix BitRise osx-xcode-15.0.x smoke tests
  - Bump Detox config iOS sim from iPhone 12 Pro to iPhone 13 Pro
- [x] Test older Xcode 14.2
- [x] Disable Flipper in release-mode
- [x] Fix Flipper debug-mode tech debt
- [x] Reenable Flipper
- [x] Update build scripts for iPhone 13 Pro
- [x] Update docs for Xcode 15.0.1 and iPhone 13 Pro
- [x] Bump Browserstack iPhone 12 Pro devices to iPhone 13 Pro
- [x] Remove stale Device util static method isIphone12
- [x] Bump metro devDep from 0.72.3 to 0.73.10
- [x] Test i386 arch (comes with iPhone 15, requires creating iPhone 13 Pro sim)

_Xcode 15 beta 8 tested up to a7ec533, then Xcode 15 stable since_

`start:ios` must be run before running via Xcode 15, or `cp
node_modules/@metamask/mobile-provider/dist/index.js
app/core/InpageBridgeWeb3.js` can optionally be run

_Xcode updates: https://developer.apple.com/documentation/updates/xcode_

**Issue**

fixes #6158

and brew warning ⚠️

<img width="576" alt="Xcode 14 2 warning"
src="https://github.com/MetaMask/metamask-mobile/assets/1881059/059988b2-e90c-4400-8f6a-e015391d4d48">

---------

Co-authored-by: João Loureiro <[email protected]>
Co-authored-by: legobeat <[email protected]>
  • Loading branch information
3 people authored Oct 30, 2023
1 parent 3022144 commit 867a410
Show file tree
Hide file tree
Showing 19 changed files with 412 additions and 765 deletions.
2 changes: 1 addition & 1 deletion .detoxrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ module.exports = {
'ios.simulator': {
type: 'ios.simulator',
device: {
type: 'iPhone 12 Pro',
type: 'iPhone 13 Pro',
},
},
'android.bitrise.emulator': {
Expand Down
8 changes: 2 additions & 6 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
[submodule "ios/mixpanel-iphone"]
path = ios/mixpanel-iphone
url = https://github.com/mixpanel/mixpanel-iphone
url = https://github.com/metamask/mixpanel-iphone
[submodule "ios/branch-ios-sdk"]
path = ios/branch-ios-sdk
url = https://github.com/BranchMetrics/ios-branch-deep-linking-attribution

[submodule "ios/mixpanel-iphone"]
path = ios/mixpanel-iphone
url = https://github.com/mixpanel/mixpanel-iphone
url = https://github.com/metamask/ios-branch-deep-linking-attribution
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ source 'https://rubygems.org'
ruby '>= 3.0.0'

gem 'cocoapods', '>= 1.11.3'
gem 'activesupport', '>= 6.1.7.3', '< 7.1.0'
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The code is built using React-Native and running code locally requires a Mac or
```
- Install the shared [React Native dependencies](https://reactnative.dev/docs/environment-setup#installing-dependencies) (`React Native CLI`, _not_ `Expo CLI`)
- XCode version `14.2` or below
- XCode version `15.0.1` or below
- Install [cocoapods](https://guides.cocoapods.org/using/getting-started.html) by running:
Expand Down Expand Up @@ -90,7 +90,7 @@ The code is built using React-Native and running code locally requires a Mac or
- [React Native Getting Started - iOS](https://reactnative.dev/docs/environment-setup#installing-dependencies) _(React Native CLI Quickstart -> [your OS] -> iOS)_
- Install the correct simulator
- **iOS OS Version:** Latest, unless told otherwise
- **Device:** iPhone 12 Pro
- **Device:** iPhone 13 Pro
Expand Down Expand Up @@ -237,7 +237,7 @@ Prerequisites for running tests:
- Make sure to install `detox-cli` by referring to the instructions mentioned [here](https://wix.github.io/Detox/docs/introduction/getting-started/#detox-prerequisites).
- Additionally, install `applesimutils` by following the guidelines provided [here](https://github.com/wix/AppleSimulatorUtils).
- Before running any tests, it's recommended to refer to the `iOS section` above and check the latest simulator device specified under `Install the correct simulator`.
- The default device for iOS is the iPhone 12 Pro and Android the Pixel 5. Ensure you have these set up.
- The default device for iOS is the iPhone 13 Pro and Android the Pixel 5. Ensure you have these set up.
- Make sure that Metro is running. Use this command to launch the metro server:
```bash
Expand Down
8 changes: 1 addition & 7 deletions app/util/device/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

import { Dimensions, Platform } from 'react-native';
import { getModel, hasNotch, getApiLevel } from 'react-native-device-info';
import { hasNotch, getApiLevel } from 'react-native-device-info';

export default class Device {
static getDeviceWidth() {
Expand Down Expand Up @@ -86,12 +86,6 @@ export default class Device {
return this.getDeviceHeight() > 736;
}

static isIphone12() {
const model = getModel();
const models = ['iPhone 12', 'iPhone 12 Pro', 'iPhone 12 Pro Max'];
return models.includes(model);
}

static hasNotch() {
return hasNotch();
}
Expand Down
2 changes: 1 addition & 1 deletion bitrise.yml
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ app:
IOS_APP_LINK: ''
meta:
bitrise.io:
stack: osx-xcode-14.2.x-ventura
stack: osx-xcode-15.0.x
machine_type_id: g2-m1-max.5core
trigger_map:
- push_branch: release/*
Expand Down
79 changes: 47 additions & 32 deletions ios/MetaMask.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,8 @@
13B07F8E1A680F5B00A75B9A /* Resources */,
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
15ACCA0022655C3A0063978B /* Embed Frameworks */,
3263892F1BBB809723CB4024 /* [CP] Embed Pods Frameworks */,
802588CED3FC487A5D5263F0 /* [CP] Copy Pods Resources */,
C77EFC60F19570875F8DB3BD /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand All @@ -582,8 +582,8 @@
B339FF0F289ABD70001B89FB /* Resources */,
B339FF2F289ABD70001B89FB /* Bundle React Native code and images */,
B339FF30289ABD70001B89FB /* Embed Frameworks */,
C9BADD20B98A4D13195A3200 /* [CP] Embed Pods Frameworks */,
8EF10BB14629809332947E5D /* [CP] Copy Pods Resources */,
EB3465C9579A347237ADD532 /* [CP] Embed Pods Frameworks */,
);
buildRules = (
);
Expand Down Expand Up @@ -815,23 +815,6 @@
shellPath = /bin/sh;
shellScript = "if [ -e ../.ios.env ]\nthen\n cp -rf ../.ios.env debug.xcconfig\n cp -rf ../.ios.env release.xcconfig\nelse\n cp -rf ../.ios.env.example debug.xcconfig\n cp -rf ../.ios.env.example release.xcconfig\nfi\n\n";
};
3263892F1BBB809723CB4024 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-MetaMask/Pods-MetaMask-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-MetaMask/Pods-MetaMask-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-MetaMask/Pods-MetaMask-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
54113A1E76112B187F92C803 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
Expand Down Expand Up @@ -945,7 +928,24 @@
shellPath = /bin/sh;
shellScript = "if [[ -s \"$HOME/.nvm/nvm.sh\" ]]; then\n. \"$HOME/.nvm/nvm.sh\"\nelif [[ -x \"$(command -v brew)\" && -s \"$(brew --prefix nvm)/nvm.sh\" ]]; then\n. \"$(brew --prefix nvm)/nvm.sh\"\nfi\n\nexport NODE_BINARY=$(which node)\n\nif [[ -s \"$HOME/.nvm/nvm.sh\" ]]; then\n. \"$HOME/.nvm/nvm.sh\"\nelif [[ -x \"$(command -v brew)\" && -s \"$(brew --prefix nvm)/nvm.sh\" ]]; then\n. \"$(brew --prefix nvm)/nvm.sh\"\nfi\n\nif [ ! -e \"${SENTRY_PROPERTIES}\" ]; then\n export SENTRY_PROPERTIES=../sentry.properties\nfi\n\n\nif [ \"$PLATFORM_NAME\" == \"iphonesimulator\" ] && [ \"$CONFIGURATION\" == \"Release\" ]; then\n ../node_modules/react-native/scripts/react-native-xcode.sh\nelse\n ../node_modules/@sentry/cli/bin/sentry-cli react-native xcode \\\n ../node_modules/react-native/scripts/react-native-xcode.sh\nfi\n";
};
C9BADD20B98A4D13195A3200 /* [CP] Embed Pods Frameworks */ = {
C77EFC60F19570875F8DB3BD /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-MetaMask/Pods-MetaMask-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-MetaMask/Pods-MetaMask-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-MetaMask/Pods-MetaMask-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
EB3465C9579A347237ADD532 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
Expand Down Expand Up @@ -1071,14 +1071,11 @@
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = "$(inherited)";
LIBRARY_SEARCH_PATHS = "$(SDKROOT)/usr/lib/swift$(inherited)";
LLVM_LTO = YES;
MARKETING_VERSION = 7.9.0;
ONLY_ACTIVE_ARCH = YES;
OTHER_CFLAGS = (
"$(inherited)",
"-DFB_SONARKIT_ENABLED=1",
);
OTHER_CFLAGS = "$(inherited)";
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down Expand Up @@ -1137,14 +1134,11 @@
"$(inherited)",
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = "$(inherited)";
LIBRARY_SEARCH_PATHS = "$(SDKROOT)/usr/lib/swift$(inherited)";
LLVM_LTO = YES;
MARKETING_VERSION = 7.9.0;
ONLY_ACTIVE_ARCH = NO;
OTHER_CFLAGS = (
"$(inherited)",
"-DFB_SONARKIT_ENABLED=1",
);
OTHER_CFLAGS = "$(inherited)";
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand All @@ -1165,7 +1159,7 @@
baseConfigurationReference = 15FDD82721B7642B006B7C35 /* debug.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
Expand All @@ -1183,12 +1177,14 @@
ENABLE_BITCODE = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION,
);
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
Expand All @@ -1200,6 +1196,12 @@
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = (
"$(inherited)",
"-Wl",
"-ld_classic",
);
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
};
name = Debug;
Expand All @@ -1208,7 +1210,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
Expand All @@ -1226,7 +1228,12 @@
ENABLE_BITCODE = NO;
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_PREPROCESSOR_DEFINITIONS = (
"$(inherited)",
_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION,
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
Expand All @@ -1235,6 +1242,12 @@
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
MTL_ENABLE_DEBUG_INFO = NO;
OTHER_LDFLAGS = (
"$(inherited)",
"-Wl",
"-ld_classic",
);
REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
SDKROOT = iphoneos;
VALIDATE_PRODUCT = YES;
};
Expand Down Expand Up @@ -1284,6 +1297,7 @@
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"$(SDKROOT)/usr/lib/swift",
"$(inherited)",
"\"$(SRCROOT)/MetaMask/System/Library/Frameworks\"",
);
Expand Down Expand Up @@ -1353,6 +1367,7 @@
"@executable_path/Frameworks",
);
LIBRARY_SEARCH_PATHS = (
"$(SDKROOT)/usr/lib/swift",
"$(inherited)",
"\"$(SRCROOT)/MetaMask/System/Library/Frameworks\"",
);
Expand Down
Loading

0 comments on commit 867a410

Please sign in to comment.