diff --git a/.hgignore b/.hgignore index 31e60e5..949005d 100644 --- a/.hgignore +++ b/.hgignore @@ -26,6 +26,8 @@ android/.DS_Store android/captures android/gradle +output/ + ios/.idea/ ios/.vagrant/ ios/.sconsign.dblite diff --git a/Makefile b/Makefile index 229cdea..2384ebe 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,46 @@ -PHONY: all +#!make -all: build-release upload +include build.variables +export $(shell sed 's/=.*//' build.variables) -upload-release: build-release - adb install -r build/app/outputs/apk/app-release.apk +FLAGS := -upload: build-debug - adb install -r build/app/outputs/apk/app-debug.apk -build-debug: - flutter build apk --debug +android-apps: pub-get apk-prod apk-ote apk-int apk-staging apk-testing apk-autobonus apk-racib archive -build-release: - flutter build apk + +archive: + rm -fR output + mkdir -p output + rsync build/app/outputs/apk/*/*/*.apk output + +apk-prod: + flutter build apk --split-per-abi --release --build-name $(VERSION_NAME) $(FLAGS) --build-number $(VERSION) --flavor dinect || echo "prod" + +apk-ote: + flutter build apk --split-per-abi --release --build-name $(VERSION_NAME) $(FLAGS) --build-number $(VERSION) --flavor dinect_ote || echo "ote" + +apk-int: + flutter build apk --split-per-abi --release --build-name $(VERSION_NAME) $(FLAGS) --build-number $(VERSION) --flavor dinect_int || echo "int" + +apk-staging: + flutter build apk --split-per-abi --release --build-name $(VERSION_NAME) $(FLAGS) --build-number $(VERSION) --flavor dinect_staging || echo "staging" + +apk-testing: + flutter build apk --split-per-abi --release --build-name $(VERSION_NAME) $(FLAGS) --build-number $(VERSION) --flavor dinect_testing || echo "testing" + +apk-autobonus: + flutter build apk --split-per-abi --release --build-name $(VERSION_NAME) $(FLAGS) --build-number $(VERSION) --flavor autobonus || echo "autobonus" + +apk-racib: + flutter build apk --split-per-abi --release --build-name $(VERSION_NAME) $(FLAGS) --build-number $(VERSION) --flavor racib || echo "racib" + +pub-get: + flutter pub get clean: - flutter build clean + flutter clean + rm -fR output + +bootstrap: + flutter version $(FLUTTER_VERSION) diff --git a/android/app/build.gradle b/android/app/build.gradle index 5f85a5d..0fd2978 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -188,7 +188,17 @@ android { buildConfigField "String", "appTitle", "\"RACIB Checker\"" buildConfigField "boolean", "showBonus", "true" } - } + } + + splits { + abi { + enable true + reset() + include "armeabi-v7a", "arm64-v8a" + universalApk false + } + } + compileOptions { targetCompatibility 1.8 sourceCompatibility 1.8 diff --git a/build.variables b/build.variables new file mode 100644 index 0000000..1e8a463 --- /dev/null +++ b/build.variables @@ -0,0 +1,4 @@ +VERSION=1.0 +VERSION_NAME=1 + +FLUTTER_VERSION=v1.9.1+hotfix.4 diff --git a/jenkinsfile.android b/jenkinsfile.android new file mode 100644 index 0000000..a5644e1 --- /dev/null +++ b/jenkinsfile.android @@ -0,0 +1,33 @@ +node('android') { + try { + stage 'Clean from prevoius build' + sh """ + rm -fR build/ || echo "dir does not exist"; + """ + + stage 'Checkout branch' + checkout scm + + stage 'Assemble applications' + sh """ + source ~/.profile + make android-apps + """ + archiveArtifacts artifacts: 'output/*.apk' + + } catch(err) { + currentBuild.result = "FAILURE" + + /*mail body: "project build error: ${err}" ,*/ + /*from: 'ci@dinect.com',*/ + /*replyTo: 'm.sokolov@dinect.com',*/ + /*subject: 'project build failed',*/ + /*to: 'm.sokolov@dinect.com'*/ + + throw err + } finally{ + sh """ + echo "Build failed" + """ + } +}