* [MM-16593] [MM-17175] [MM-17164] [MM-17189] [MM-17181] Android - Upgrade to RN 0.60 (#3145)
* Upgrade to react-native 0.60
* Use @sentry/react-native
* Manually link @sentry/react-native
* Address review comments
* Jetify after install
* Call jetify from node_modules
* [MM-17785] iOS - Upgrade to RN 0.60 (#3153)
* Upgrade to react-native 0.60
* Use @sentry/react-native
* Manually link @sentry/react-native
* Address review comments
* Jetify after install
* Call jetify from node_modules
* Get app building for iOS
* Revert react-native-image-picker upgrade
* Minor version upgrade of react-native-image-picker
* [MM-17142] Convert all string refs to callbacks (#3217)
* Replace string refs
* Fix tests
* Don't use inline functions
* Fix mattermost-redux reversion from master merge
* [MM-18336] Upload Sentry debug symbols only when SENTRY_ENABLED is true (#3227)
* Upgrade @sentry/react-native
* Run Sentry gradle tasks only when enabled
* Upgrade @sentry/react-native and remove extra Sentry build phase
* [MM-17144] Use Hermes (#3226)
* Replace string refs
* Fix tests
* Don't use inline functions
* Fix mattermost-redux reversion from master merge
* Use Hermes
* bundleCommand ram-bundle no longer needed
* Require harmony-reflect only for Android
* Fix failing test
* Path react-native's splitLayoutProps (#3337)
* [MM-18867] [MM-17186] [MM-18866] [MM-19447] [MM-18967] Upgrade to RN 0.61.2 (#3423)
* Upgrade to RN 0.61.2
* Update rn-fetch-blob commit hash
* Update react-native-keyboard-tracking-view commit hash
* Use react-native-youtube with AVPlayer fix
* Fix jest mocks
* Use updated document picker API
* Remove unnecessary linking
* Revert "MM-17759 Add code highlighting (#3072)"
This reverts commit 26b999e885.
* Fix share extension
* Revert "Revert "MM-17759 Add code highlighting (#3072)""
This reverts commit 52aca776b12dee3abe8646d0c90480f8528e86c1.
* Address PR reviews
* Rename patch to match version
* Update react-native-youtube patch
* Update dependencies
* Fix RNDocViewer reference
* Update tests and revert to redux-persist 4.10.2
* Revert "Revert "Revert "MM-17759 Add code highlighting (#3072)"""
This reverts commit 5ef383be2619b1be6167c23f128ecb4b4ad25df9.
* Android fixes after dep upgrades
* Use fresco 2.0.0
* Use mattermost forks
* Use React-Core in Mattermost.scheme instead of react
* Remove packager (#3452)
* Remove Pods from source control
* Fix unit tests
* Add new line before entering the keystore in gradle.properties
* set ios as working directory for cocoapods
* Cache cocoapods on circleCI builds
* set ios as working dir
* fix cocoapods cache key
* Unify fastlane and npm dependencies command
* Use package-lock.json checksum for npm cache
* Fix package.json and use the checksum as the cache key
* Fix package.json and use the checksum as the cache key
* changes to circleci.yaml fastlane and removing pods from git
* Fix Mattermost.xcodeproj
* Update coocoapods to 1.7.5 and fix xcode header search paths
* Update package-lock.json
* Remove unused tooltip component
* Fix incorrect ref
* Disable Hermes (#3460)
* Revert "Remove packager (#3452)"
This reverts commit b2a79e184b3242124dfdb91ae095f6ce3f4eb986.
* Disable Hermes :'(
* Update preloaded modules
* Fix packages moduleNames and modulePaths, update snapshots and update mm-redux (ts version)
* remove document picker from modulePaths
* Fix package-lock.json
* Add eslint disable rules
267 lines
9.6 KiB
Makefile
267 lines
9.6 KiB
Makefile
.PHONY: pre-run pre-build clean
|
|
.PHONY: check-style
|
|
.PHONY: i18n-extract-ci
|
|
.PHONY: start stop
|
|
.PHONY: run run-ios run-android
|
|
.PHONY: build build-ios build-android unsigned-ios unsigned-android ios-sim-x86_64
|
|
.PHONY: build-pr can-build-pr prepare-pr
|
|
.PHONY: test help
|
|
|
|
POD := $(shell which pod 2> /dev/null)
|
|
OS := $(shell sh -c 'uname -s 2>/dev/null')
|
|
BASE_ASSETS = $(shell find assets/base -type d) $(shell find assets/base -type f -name '*')
|
|
OVERRIDE_ASSETS = $(shell find assets/override -type d 2> /dev/null) $(shell find assets/override -type f -name '*' 2> /dev/null)
|
|
MM_UTILITIES_DIR = ../mattermost-utilities
|
|
|
|
node_modules: package.json
|
|
@if ! [ $(shell which npm 2> /dev/null) ]; then \
|
|
echo "npm is not installed https://npmjs.com"; \
|
|
exit 1; \
|
|
fi
|
|
|
|
@echo Getting Javascript dependencies
|
|
@npm install
|
|
|
|
npm-ci: package.json
|
|
@if ! [ $(shell which npm 2> /dev/null) ]; then \
|
|
echo "npm is not installed https://npmjs.com"; \
|
|
exit 1; \
|
|
fi
|
|
|
|
@echo Getting Javascript dependencies
|
|
@npm ci
|
|
|
|
.podinstall:
|
|
ifeq ($(OS), Darwin)
|
|
ifdef POD
|
|
@echo Getting Cocoapods dependencies;
|
|
@cd ios && pod install;
|
|
else
|
|
@echo "Cocoapods is not installed https://cocoapods.org/"
|
|
@exit 1
|
|
endif
|
|
endif
|
|
@touch $@
|
|
|
|
dist/assets: $(BASE_ASSETS) $(OVERRIDE_ASSETS)
|
|
@mkdir -p dist
|
|
|
|
@if [ -e dist/assets ] ; then \
|
|
rm -rf dist/assets; \
|
|
fi
|
|
|
|
@echo "Generating app assets"
|
|
@node scripts/make-dist-assets.js
|
|
|
|
pre-run: | node_modules .podinstall dist/assets ## Installs dependencies and assets
|
|
|
|
pre-build: | npm-ci .podinstall dist/assets ## Install dependencies and assets before building
|
|
|
|
check-style: node_modules ## Runs eslint
|
|
@echo Checking for style guide compliance
|
|
@npm run check
|
|
|
|
clean: ## Cleans dependencies, previous builds and temp files
|
|
@echo Cleaning started
|
|
|
|
@rm -f .podinstall
|
|
@rm -rf ios/Pods
|
|
@rm -rf node_modules
|
|
@rm -rf dist
|
|
@rm -rf ios/build
|
|
@rm -rf android/app/build
|
|
|
|
@echo Cleanup finished
|
|
|
|
post-install:
|
|
@./node_modules/.bin/jetify
|
|
|
|
@rm -f node_modules/intl/.babelrc
|
|
@# Hack to get react-intl and its dependencies to work with react-native
|
|
@# Based off of https://github.com/este/este/blob/master/gulp/native-fix.js
|
|
@sed -i'' -e 's|"./locale-data/index.js": false|"./locale-data/index.js": "./locale-data/index.js"|g' node_modules/react-intl/package.json
|
|
@sed -i'' -e 's|"./lib/locales": false|"./lib/locales": "./lib/locales"|g' node_modules/intl-messageformat/package.json
|
|
@sed -i'' -e 's|"./lib/locales": false|"./lib/locales": "./lib/locales"|g' node_modules/intl-relativeformat/package.json
|
|
@sed -i'' -e 's|"./locale-data/complete.js": false|"./locale-data/complete.js": "./locale-data/complete.js"|g' node_modules/intl/package.json
|
|
|
|
@./node_modules/.bin/patch-package
|
|
|
|
start: | pre-run ## Starts the React Native packager server
|
|
$(call start_packager)
|
|
|
|
stop: ## Stops the React Native packager server
|
|
$(call stop_packager)
|
|
|
|
check-device-ios:
|
|
@if ! [ $(shell which xcodebuild) ]; then \
|
|
echo "xcode is not installed"; \
|
|
exit 1; \
|
|
fi
|
|
@if ! [ $(shell which watchman) ]; then \
|
|
echo "watchman is not installed"; \
|
|
exit 1; \
|
|
fi
|
|
|
|
check-device-android:
|
|
@if ! [ $(ANDROID_HOME) ]; then \
|
|
echo "ANDROID_HOME is not set"; \
|
|
exit 1; \
|
|
fi
|
|
@if ! [ $(shell which adb 2> /dev/null) ]; then \
|
|
echo "adb is not installed"; \
|
|
exit 1; \
|
|
fi
|
|
|
|
@echo "Connect your Android device or open the emulator"
|
|
@adb wait-for-device
|
|
|
|
@if ! [ $(shell which watchman 2> /dev/null) ]; then \
|
|
echo "watchman is not installed"; \
|
|
exit 1; \
|
|
fi
|
|
|
|
prepare-android-build:
|
|
@rm -rf ./node_modules/react-native/local-cli/templates/HelloWorld
|
|
@rm -rf ./node_modules/react-native-linear-gradient/Examples/
|
|
@rm -rf ./node_modules/react-native-orientation/demo/
|
|
|
|
run: run-ios ## alias for run-ios
|
|
|
|
run-ios: | check-device-ios pre-run ## Runs the app on an iOS simulator
|
|
@if [ $(shell ps -ef | grep -i "cli.js start" | grep -civ grep) -eq 0 ]; then \
|
|
echo Starting React Native packager server; \
|
|
npm start & echo Running iOS app in development; \
|
|
if [ ! -z "${SIMULATOR}" ]; then \
|
|
react-native run-ios --simulator="${SIMULATOR}"; \
|
|
else \
|
|
react-native run-ios; \
|
|
fi; \
|
|
wait; \
|
|
else \
|
|
echo Running iOS app in development; \
|
|
if [ ! -z "${SIMULATOR}" ]; then \
|
|
react-native run-ios --simulator="${SIMULATOR}"; \
|
|
else \
|
|
react-native run-ios; \
|
|
fi; \
|
|
fi
|
|
|
|
run-android: | check-device-android pre-run prepare-android-build ## Runs the app on an Android emulator or dev device
|
|
@if [ $(shell ps -ef | grep -i "cli.js start" | grep -civ grep) -eq 0 ]; then \
|
|
echo Starting React Native packager server; \
|
|
npm start & echo Running Android app in development; \
|
|
if [ ! -z ${VARIANT} ]; then \
|
|
react-native run-android --no-packager --variant=${VARIANT}; \
|
|
else \
|
|
react-native run-android --no-packager; \
|
|
fi; \
|
|
wait; \
|
|
else \
|
|
echo Running Android app in development; \
|
|
if [ ! -z ${VARIANT} ]; then \
|
|
react-native run-android --no-packager --variant=${VARIANT}; \
|
|
else \
|
|
react-native run-android --no-packager; \
|
|
fi; \
|
|
fi
|
|
|
|
build: | stop pre-build check-style i18n-extract-ci ## Builds the app for Android & iOS
|
|
$(call start_packager)
|
|
@echo "Building App"
|
|
@cd fastlane && BABEL_ENV=production NODE_ENV=production bundle exec fastlane build
|
|
$(call stop_packager)
|
|
|
|
|
|
build-ios: | stop pre-build check-style i18n-extract-ci ## Builds the iOS app
|
|
$(call start_packager)
|
|
@echo "Building iOS app"
|
|
@cd fastlane && BABEL_ENV=production NODE_ENV=production bundle exec fastlane ios build
|
|
$(call stop_packager)
|
|
|
|
build-android: | stop pre-build check-style i18n-extract-ci prepare-android-build ## Build the Android app
|
|
$(call start_packager)
|
|
@echo "Building Android app"
|
|
@cd fastlane && BABEL_ENV=production NODE_ENV=production bundle exec fastlane android build
|
|
$(call stop_packager)
|
|
|
|
unsigned-ios: stop pre-build check-style ## Build an unsigned version of the iOS app
|
|
$(call start_packager)
|
|
@echo "Building unsigned iOS app"
|
|
@cd fastlane && NODE_ENV=production bundle exec fastlane ios unsigned
|
|
@mkdir -p build-ios
|
|
@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
|
|
@cd build-ios/ && mkdir -p Payload && cp -R Build/Products/Release-iphoneos/Mattermost.app Payload/ && zip -r Mattermost-unsigned.ipa Payload/
|
|
@mv build-ios/Mattermost-unsigned.ipa .
|
|
@cd fastlane && bundle exec fastlane upload_file_to_s3 file:Mattermost-unsigned.ipa os_type:iOS
|
|
@rm -rf build-ios/
|
|
$(call stop_packager)
|
|
|
|
ios-sim-x86_64: stop pre-build check-style ## Build an unsigned x86_64 version of the iOS app for iPhone simulator
|
|
$(call start_packager)
|
|
@echo "Building unsigned x86_64 iOS app for iPhone simulator"
|
|
@cd fastlane && NODE_ENV=production bundle exec fastlane ios unsigned
|
|
@mkdir -p build-ios
|
|
@cd ios/ && xcodebuild -workspace Mattermost.xcworkspace/ -scheme Mattermost -arch x86_64 -sdk iphonesimulator -configuration Release -parallelizeTargets -resultBundlePath ../build-ios/result -derivedDataPath ../build-ios/ ENABLE_BITCODE=NO CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ENABLE_BITCODE=NO
|
|
@cd build-ios/Build/Products/Release-iphonesimulator/ && zip -r Mattermost-simulator-x86_64.app.zip Mattermost.app/
|
|
@mv build-ios/Build/Products/Release-iphonesimulator/Mattermost-simulator-x86_64.app.zip .
|
|
@rm -rf build-ios/
|
|
@cd fastlane && bundle exec fastlane upload_file_to_s3 file:Mattermost-simulator-x86_64.app.zip os_type:iOS
|
|
$(call stop_packager)
|
|
|
|
unsigned-android: stop pre-build check-style prepare-android-build ## Build an unsigned version of the Android app
|
|
$(call start_packager)
|
|
@echo "Building unsigned Android app"
|
|
@cd fastlane && NODE_ENV=production bundle exec fastlane android unsigned
|
|
@mv android/app/build/outputs/apk/unsigned/app-unsigned-unsigned.apk ./Mattermost-unsigned.apk
|
|
@cd fastlane && bundle exec fastlane upload_file_to_s3 file:Mattermost-unsigned.apk os_type:Android
|
|
$(call stop_packager)
|
|
|
|
test: | pre-run check-style ## Runs tests
|
|
@npm test
|
|
|
|
build-pr: | can-build-pr stop pre-build check-style i18n-extract-ci ## Build a PR from the mattermost-mobile repo
|
|
$(call start_packager)
|
|
@echo "Building App from PR ${PR_ID}"
|
|
@cd fastlane && BABEL_ENV=production NODE_ENV=production bundle exec fastlane build_pr pr:PR-${PR_ID}
|
|
$(call stop_packager)
|
|
|
|
can-build-pr:
|
|
@if [ -z ${PR_ID} ]; then \
|
|
echo a PR number needs to be specified; \
|
|
exit 1; \
|
|
fi
|
|
|
|
i18n-extract: ## Extract strings for translation from the source code
|
|
npm run mmjstool -- i18n extract-mobile
|
|
|
|
i18n-extract-ci:
|
|
mkdir -p tmp
|
|
cp assets/base/i18n/en.json tmp/en.json
|
|
mkdir -p tmp/fake-webapp-dir/i18n/
|
|
echo '{}' > tmp/fake-webapp-dir/i18n/en.json
|
|
npm run mmjstool -- i18n extract-mobile --webapp-dir tmp/fake-webapp-dir --mobile-dir .
|
|
diff tmp/en.json assets/base/i18n/en.json
|
|
rm -rf tmp
|
|
|
|
## Help documentation https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
|
|
help:
|
|
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
|
|
|
|
define start_packager
|
|
@if [ $(shell ps -ef | grep -i "cli.js start" | grep -civ grep) -eq 0 ]; then \
|
|
echo Starting React Native packager server; \
|
|
npm start & echo; \
|
|
else \
|
|
echo React Native packager server already running; \
|
|
fi
|
|
endef
|
|
|
|
define stop_packager
|
|
@echo Stopping React Native packager server
|
|
@if [ $(shell ps -ef | grep -i "cli.js start" | grep -civ grep) -eq 1 ]; then \
|
|
ps -ef | grep -i "cli.js start" | grep -iv grep | awk '{print $$2}' | xargs kill -9; \
|
|
echo React Native packager server stopped; \
|
|
else \
|
|
echo No React Native packager server running; \
|
|
fi
|
|
endef
|