Skip to content

Commit

Permalink
Fastlane for Android and ios (mattermost#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
enahum authored and hmhealey committed Jan 19, 2017
1 parent 4d9e30f commit 1566a79
Show file tree
Hide file tree
Showing 52 changed files with 1,428 additions and 120 deletions.
1 change: 1 addition & 0 deletions .gitattributes
@@ -0,0 +1 @@
*.pbxproj -text
6 changes: 6 additions & 0 deletions .gitignore
Expand Up @@ -22,6 +22,7 @@ xcuserdata
DerivedData
*.hmap
*.ipa
*.apk
*.xcuserstate
project.xcworkspace

Expand Down Expand Up @@ -52,3 +53,8 @@ Session.vim
.netrwhist
*~
tags

fastlane/report.xml
*.zip
server.PID
mattermost.keystore
58 changes: 57 additions & 1 deletion Makefile
@@ -1,4 +1,9 @@
.PHONY: run run-ios run-android check-style test clean post-install
.PHONY: check-ios-target prepare-ios-build build-ios after-ios-build
.PHONY: check-android-target prepare-android-build build-android after-android-build

ios_target := $(filter-out build-ios,$(MAKECMDGOALS))
android_target := $(filter-out build-android,$(MAKECMDGOALS))

.npminstall: package.json
@if ! [ $(shell command -v npm) ]; then \
Expand All @@ -24,7 +29,6 @@ dist/assets: $(BASE_ASSETS) $(OVERRIDE_ASSETS)

node scripts/make-dist-assets.js

.PHONY: prepare
pre-run: .npminstall dist/assets

run: run-ios
Expand Down Expand Up @@ -91,3 +95,55 @@ post-install:
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

check-ios-target:
ifneq ($(ios_target), $(filter $(ios_target), dev beta release))
@echo "Try running make build-ios TARGET\nWhere TARGET is one of dev, beta or release"
@exit 1
endif

prepare-ios-build:
# We need to do this as the react-native packager minifies the output and that is causing issues
@sed -i'' -e 's|--dev $$DEV|--dev true|g' ./node_modules/react-native/packager/react-native-xcode.sh

@node ./node_modules/react-native/local-cli/cli.js start --reset-cache & echo $$! > server.PID

do-build-ios:
@echo "Building ios $(ios_target) app"
@cd fastlane && fastlane ios $(ios_target)

after-ios-build:
@echo Cleaning up
@sed -i'' -e 's|--dev true|--dev $$DEV|g' ./node_modules/react-native/packager/react-native-xcode.sh
@kill -9 `cat server.PID` && rm server.PID

build-ios: | check-ios-target pre-run check-style prepare-ios-build do-build-ios after-ios-build

check-android-target:
ifneq ($(android_target), $(filter $(android_target), dev beta release))
@echo "Try running make build-android TARGET\nWhere TARGET is one of dev, beta or release"
@exit 1
endif

prepare-android-build:
@rm -rf ./node_modules/react-native/local-cli/templates/HelloWorld
@sed -i'' -e 's|def devEnabled = !targetName.toLowerCase().contains("release")|def devEnabled = true|g' ./node_modules/react-native/react.gradle

do-build-android:
@echo "Building android $(android_target) app"
@cd fastlane && fastlane android $(android_target)

after-android-build:
@echo Cleaning up
@sed -i'' -e 's|def devEnabled = true|def devEnabled = !targetName.toLowerCase().contains("release")|g' ./node_modules/react-native/react.gradle

build-android: | check-android-target pre-run check-style prepare-android-build do-build-android after-android-build

dev:
@:

beta:
@:

release:
@:
21 changes: 16 additions & 5 deletions android/app/build.gradle
Expand Up @@ -88,15 +88,24 @@ android {
buildToolsVersion "23.0.1"

defaultConfig {
applicationId "com.mattermost"
applicationId "com.mattermost.react.native"
minSdkVersion 16
targetSdkVersion 22
versionCode 1
targetSdkVersion 23
versionCode 2
versionName "1.0"
multiDexEnabled true
ndk {
abiFilters "armeabi-v7a", "x86"
}
}
signingConfigs {
release {
storeFile file(MATTERMOST_RELEASE_STORE_FILE)
storePassword MATTERMOST_RELEASE_PASSWORD
keyAlias MATTERMOST_RELEASE_KEY_ALIAS
keyPassword MATTERMOST_RELEASE_PASSWORD
}
}
splits {
abi {
reset()
Expand All @@ -109,6 +118,7 @@ android {
release {
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
}
// applicationVariants are e.g. debug, release
Expand All @@ -127,6 +137,7 @@ android {
}

dependencies {
compile project(':react-native-vector-icons')
compile project(':react-native-svg')
compile fileTree(dir: "libs", include: ["*.jar"])
compile "com.android.support:appcompat-v7:23.0.1"
Expand All @@ -136,6 +147,6 @@ dependencies {
// Run this once to be able to run the application with BUCK
// puts all compile dependencies into folder libs for BUCK to use
task copyDownloadableDepsToLibs(type: Copy) {
from configurations.compile
into 'libs'
from configurations.compile
into 'libs'
}
Binary file added android/app/src/main/assets/fonts/Entypo.ttf
Binary file not shown.
Binary file added android/app/src/main/assets/fonts/EvilIcons.ttf
Binary file not shown.
Binary file not shown.
Binary file added android/app/src/main/assets/fonts/Foundation.ttf
Binary file not shown.
Binary file added android/app/src/main/assets/fonts/Ionicons.ttf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added android/app/src/main/assets/fonts/Octicons.ttf
Binary file not shown.
Binary file not shown.
Binary file added android/app/src/main/assets/fonts/Zocial.ttf
Binary file not shown.
11 changes: 10 additions & 1 deletion android/app/src/main/java/com/mattermost/MainApplication.java
Expand Up @@ -4,11 +4,13 @@
import android.util.Log;

import com.facebook.react.ReactApplication;
import com.oblador.vectoricons.VectorIconsPackage;
import com.horcrux.svg.RNSvgPackage;
import com.facebook.react.ReactInstanceManager;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.facebook.soloader.SoLoader;

import java.util.Arrays;
import java.util.List;
Expand All @@ -25,13 +27,20 @@ protected boolean getUseDeveloperSupport() {
protected List<ReactPackage> getPackages() {
return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new VectorIconsPackage(),
new RNSvgPackage()
);
}
};

@Override
public ReactNativeHost getReactNativeHost() {
return mReactNativeHost;
return mReactNativeHost;
}

@Override
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
}
}
2 changes: 2 additions & 0 deletions android/settings.gradle
@@ -1,4 +1,6 @@
rootProject.name = 'Mattermost'
include ':react-native-vector-icons'
project(':react-native-vector-icons').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-vector-icons/android')

include ':app'
include ':react-native-svg'
Expand Down
3 changes: 2 additions & 1 deletion app/mattermost.js
Expand Up @@ -5,10 +5,11 @@ import React from 'react';
import {Provider} from 'react-redux';

import configureStore from 'app/store';
import initialState from 'app/initial_state';
import Router from 'app/navigation/router';
import RootLayout from 'app/layouts/root_layout/root_layout_container';

const store = configureStore();
const store = configureStore(initialState);

export default class Mattermost extends React.Component {
render() {
Expand Down

0 comments on commit 1566a79

Please sign in to comment.