diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 43eea5bded..11d85d7748 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -345,7 +345,6 @@ platform :ios do update_identifiers replace_assets - sh 'rm -rf ../ios/build/' sh 'rm -rf ../build-ios/' sh 'cd ../ios/ && xcodebuild -workspace Mattermost.xcworkspace/ -scheme Mattermost -sdk iphoneos -configuration Release -parallelizeTargets -resultBundlePath ../build-ios/result -derivedDataPath ../build-ios/ CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO' sh 'cd ../build-ios/ && mkdir -p Payload && cp -R ../ios/Build/Products/Release-iphoneos/Mattermost.app Payload/ && zip -r Mattermost-unsigned.ipa Payload/' diff --git a/ios/Mattermost.xcodeproj/project.pbxproj b/ios/Mattermost.xcodeproj/project.pbxproj index 4f1501df68..73535e9ed3 100644 --- a/ios/Mattermost.xcodeproj/project.pbxproj +++ b/ios/Mattermost.xcodeproj/project.pbxproj @@ -859,6 +859,8 @@ files = ( ); inputPaths = ( + "$(SRCROOT)/.xcode.env.local", + "$(SRCROOT)/.xcode.env", ); name = "Bundle React Native code and images"; outputPaths = ( @@ -1101,7 +1103,7 @@ "$(SRCROOT)/UploadAttachments/UploadAttachments", ); INFOPLIST_FILE = Mattermost/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.1; + IPHONEOS_DEPLOYMENT_TARGET = 12.4; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1145,7 +1147,7 @@ "$(SRCROOT)/UploadAttachments/UploadAttachments", ); INFOPLIST_FILE = Mattermost/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.1; + IPHONEOS_DEPLOYMENT_TARGET = 12.4; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1172,7 +1174,7 @@ buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_COMMA = YES; @@ -1192,7 +1194,7 @@ DEVELOPMENT_TEAM = UQ8HT4Q2XM; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = NotificationService/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.1; + IPHONEOS_DEPLOYMENT_TARGET = 12.4; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1219,7 +1221,7 @@ buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_COMMA = YES; @@ -1240,7 +1242,7 @@ DEVELOPMENT_TEAM = UQ8HT4Q2XM; GCC_C_LANGUAGE_STANDARD = gnu11; INFOPLIST_FILE = NotificationService/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.1; + IPHONEOS_DEPLOYMENT_TARGET = 12.4; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -1263,7 +1265,7 @@ buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_COMMA = YES; @@ -1313,7 +1315,7 @@ buildSettings = { CLANG_ANALYZER_NONNULL = YES; CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; + CLANG_CXX_LANGUAGE_STANDARD = "c++17"; CLANG_ENABLE_OBJC_WEAK = YES; CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; CLANG_WARN_COMMA = YES; @@ -1362,7 +1364,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; @@ -1397,9 +1399,15 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.1; + IPHONEOS_DEPLOYMENT_TARGET = 12.4; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; + OTHER_CPLUSPLUSFLAGS = ( + "$(OTHER_CFLAGS)", + "-DFOLLY_NO_CONFIG", + "-DFOLLY_MOBILE=1", + "-DFOLLY_USE_LIBCPP=1", + ); REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; }; @@ -1409,7 +1417,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; @@ -1438,8 +1446,14 @@ GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; HEADER_SEARCH_PATHS = ""; - IPHONEOS_DEPLOYMENT_TARGET = 12.1; + IPHONEOS_DEPLOYMENT_TARGET = 12.4; MTL_ENABLE_DEBUG_INFO = NO; + OTHER_CPLUSPLUSFLAGS = ( + "$(OTHER_CFLAGS)", + "-DFOLLY_NO_CONFIG", + "-DFOLLY_MOBILE=1", + "-DFOLLY_USE_LIBCPP=1", + ); REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; diff --git a/ios/bundleReactNative.sh b/ios/bundleReactNative.sh index 5c60ae7e74..63ec1bcd03 100755 --- a/ios/bundleReactNative.sh +++ b/ios/bundleReactNative.sh @@ -3,7 +3,9 @@ [[ -s $HOME/.nvm/nvm.sh ]] && . $HOME/.nvm/nvm.sh export NODE_OPTIONS=--max_old_space_size=12000 -export BUNDLE_COMMAND="ram-bundle" +export BUNDLE_COMMAND="bundle" +export ENTRY_FILE="index.ts" + if [[ "${SENTRY_ENABLED}" = "true" ]]; then echo "Sentry native integration is enabled" @@ -13,5 +15,5 @@ if [[ "${SENTRY_ENABLED}" = "true" ]]; then ../node_modules/@sentry/cli/bin/sentry-cli react-native xcode ./react-native-xcode.sh else echo "Sentry native integration is not enabled" - ./react-native-xcode.sh + ../node_modules/react-native/scripts/react-native-xcode.sh fi diff --git a/ios/react-native-xcode.sh b/ios/react-native-xcode.sh deleted file mode 100755 index cc2867fac7..0000000000 --- a/ios/react-native-xcode.sh +++ /dev/null @@ -1,114 +0,0 @@ -#!/bin/bash -# Copyright (c) Facebook, Inc. and its affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -# Bundle React Native app's code and image assets. -# This script is supposed to be invoked as part of Xcode build process -# and relies on environment variables (including PWD) set by Xcode - -# Print commands before executing them (useful for troubleshooting) -set -x -DEST=$CONFIGURATION_BUILD_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH - -# Enables iOS devices to get the IP address of the machine running Metro -if [[ "$CONFIGURATION" = *Debug* && ! "$PLATFORM_NAME" == *simulator ]]; then - IP=$(ipconfig getifaddr en0) - if [[ -z "$IP" || -n "`ifconfig $value | grep 'baseT'`" ]]; then - IP=$(ipconfig getifaddr en1) - fi - if [ -z "$IP" ]; then - IP=$(ifconfig | grep 'inet ' | grep -v ' 127.' | grep -v ' 169.254.' |cut -d\ -f2 | awk 'NR==1{print $1}') - fi - - echo "$IP" > "$DEST/ip.txt" -fi - -if [[ "$SKIP_BUNDLING" ]]; then - echo "SKIP_BUNDLING enabled; skipping." - exit 0; -fi - -case "$CONFIGURATION" in - *Debug*) - if [[ "$PLATFORM_NAME" == *simulator ]]; then - if [[ "$FORCE_BUNDLING" ]]; then - echo "FORCE_BUNDLING enabled; continuing to bundle." - else - echo "Skipping bundling in Debug for the Simulator (since the packager bundles for you). Use the FORCE_BUNDLING flag to change this behavior." - exit 0; - fi - else - echo "Bundling for physical device. Use the SKIP_BUNDLING flag to change this behavior." - fi - - DEV=true - ;; - "") - echo "$0 must be invoked by Xcode" - exit 1 - ;; - *) - DEV=false - ;; -esac - -# Setting up a project root was a workaround to enable support for non-standard -# structures, including monorepos. Today, CLI supports that out of the box -# and setting custom `PROJECT_ROOT` only makes it confusing. -# -# As a backwards-compatible change, I am leaving "PROJECT_ROOT" support for those -# who already use it - it is likely a non-breaking removal. -# -# For new users, we default to $PWD - not changing things all. -# -# For context: https://github.com/facebook/react-native/commit/9ccde378b6e6379df61f9d968be6346ca6be7ead#commitcomment-37914902 -PROJECT_ROOT=${PROJECT_ROOT:-$PWD} -cd "$PROJECT_ROOT/.." || exit - -# Define entry file -if [[ "$ENTRY_FILE" ]]; then - # Use ENTRY_FILE defined by user - : -elif [[ -s "index.ios.js" ]]; then - ENTRY_FILE=${1:-index.ios.js} - else - ENTRY_FILE=${1:-index.ts} -fi - -# Path to react-native folder inside node_modules -REACT_NATIVE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/node_modules/react-native" && pwd)" -# check and assign NODE_BINARY env -# shellcheck source=/dev/null -source "$REACT_NATIVE_DIR/scripts/node-binary.sh" - -[ -z "$NODE_ARGS" ] && export NODE_ARGS="" - -[ -z "$CLI_PATH" ] && export CLI_PATH="$REACT_NATIVE_DIR/cli.js" - -[ -z "$BUNDLE_COMMAND" ] && BUNDLE_COMMAND="bundle" - -if [[ -z "$BUNDLE_CONFIG" ]]; then - CONFIG_ARG="" -else - CONFIG_ARG="--config $BUNDLE_CONFIG" -fi - -BUNDLE_FILE="$DEST/main.jsbundle" - -"$NODE_BINARY" $NODE_ARGS "$CLI_PATH" $BUNDLE_COMMAND \ - $CONFIG_ARG \ - --entry-file "$ENTRY_FILE" \ - --platform ios \ - --dev $DEV \ - --reset-cache \ - --bundle-output "$BUNDLE_FILE" \ - --assets-dest "$DEST" \ - $EXTRA_PACKAGER_ARGS - -if [[ $DEV != true && ! -f "$BUNDLE_FILE" ]]; then - echo "error: File $BUNDLE_FILE does not exist. This must be a bug with" >&2 - echo "React Native, please report it here: https://github.com/facebook/react-native/issues" - exit 2 -fi diff --git a/scripts/build.sh b/scripts/build.sh index b7606403e8..a758a38544 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -50,6 +50,16 @@ function setup() { npm run pod-install || exit 1 fi + COMPASS_ICONS="node_modules/@mattermost/compass-icons/font/compass-icons.ttf" + if [ -z "$COMPASS_ICONS" ]; then + echo "Compass Icons font not found" + exit 1 + else + echo "Configuring Compass Icons font" + cp "$COMPASS_ICONS" "assets/fonts/" + cp "$COMPASS_ICONS" "android/app/src/main/assets/fonts" + fi + ASSETS=$(node scripts/generate-assets.js) if [ -z "$ASSETS" ]; then echo "Error Generating app assets"