Skip to content

Commit

Permalink
feat(mobile): Add dynamic names on staff release
Browse files Browse the repository at this point in the history
  • Loading branch information
gfanton committed Jan 24, 2019
1 parent 10e2694 commit 34a0429
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 7 deletions.
8 changes: 7 additions & 1 deletion .circleci/config.yml
Expand Up @@ -300,10 +300,15 @@ jobs:
working_directory: ~/go/src/berty.tech/client/react-native
command: make version.android

- run:
name: set name
command: |
[[ ! -z "${CIRCLE_PR_NUMBER}" ]] && echo "export ANDROID_CUSTOM_NAME='Berty @${CIRCLE_PR_NUMBER}'" >> $BASH_ENV
- run:
name: build app
working_directory: ~/go/src/berty.tech/client/react-native
command: /tmp/retry -m 3 make fastlane.android.staff
command: . $BASH_ENV; /tmp/retry -m 3 make fastlane.android.staff

- store_artifacts:
path: /tmp/fl
Expand Down Expand Up @@ -432,6 +437,7 @@ jobs:
name: build app
working_directory: ~/go/src/berty.tech/client/react-native
command: |
[[ ! -z "${CIRCLE_PR_NUMBER}" ]] && IOS_CUSTOM_NAME="Berty @${CIRCLE_PR_NUMBER}" make appname.ios
make fastlane.setup_circle
/tmp/retry -m 3 make fastlane.ios.adhoc
Expand Down
10 changes: 10 additions & 0 deletions client/react-native/Makefile
Expand Up @@ -15,6 +15,7 @@ BUILD ?= .build
IOS_UDID := ''
IOS_VERSION ?= $(shell git describe --tags --always | cut -d - -f 1,2 | tr - .| tail -c +2)
IOS_BUILD := $(BUILD)/ios
IOS_CUSTOM_NAME ?=

# @TODO: find a better way to pass those arguments >

Expand All @@ -39,6 +40,7 @@ IOS_BUNDLE_ID_RELEASE ?= chat.berty.ios
# android related env
ANDROID_VERSION ?= $(shell git rev-list --all --count)
ANDROID_BUILD ?= $(BUILD)/android
ANDROID_CUSTOM_NAME ?=

KEYCHAIN_NAME ?= berty_keychain
KEYCHAIN_PASSWORD ?= berty_pass
Expand Down Expand Up @@ -273,6 +275,13 @@ webapp.rm: webapp.stop


### Fastlane build part ###

.PHONY: appname.ios
appname.ios:
@[[ ! -z "$(IOS_CUSTOM_NAME)" ]] \
&& plutil -replace CFBundleDisplayName -string "$(IOS_CUSTOM_NAME)" $(IOS)/Berty/Info.plist \
&& echo "Setting custom name: [$(IOS_CUSTOM_NAME)] for ios" || true

.PHONY: version
version:
mkdir -p $(BUILD)
Expand Down Expand Up @@ -426,6 +435,7 @@ fastlane.android.staff:

mkdir -p $(ANDROID_BUILD)

ORG_GRADLE_PROJECT_BERTY_CUSTOM_NAME="$(ANDROID_CUSTOM_NAME)" \
ORG_GRADLE_PROJECT_BERTY_APK_OUTPUT_DIR="$(shell realpath '$(ANDROID_BUILD)')" \
FL_GRADLE_PROJECT_DIR=android \
FL_GRADLE_BUILD_TYPE=Staff \
Expand Down
15 changes: 11 additions & 4 deletions client/react-native/android/app/build.gradle
Expand Up @@ -155,22 +155,29 @@ android {
}
}
buildTypes {
debug {
applicationIdSuffix ".debug"
debuggable true
}
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
debug {
applicationIdSuffix ".debug"
debuggable true
}
yolo {
initWith(buildTypes.release)
applicationIdSuffix ".yolo"
matchingFallbacks = ['release']
}
staff {
initWith(buildTypes.release)

def appname = "Berty Staff"
if (project.hasProperty('BERTY_CUSTOM_NAME') && BERTY_CUSTOM_NAME?.trim()) {
appname = BERTY_CUSTOM_NAME
}
resValue "string", "app_name", appname

applicationIdSuffix ".staff"
matchingFallbacks = ['release']
}
Expand Down
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Berty</string>
</resources>
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Berty</string>
</resources>
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Berty Staff</string>
<!-- <string name="app_name">Berty Staff</string> -->
</resources>

0 comments on commit 34a0429

Please sign in to comment.