Update build scripts

pull/707/head
Alinson S. Xavier 5 years ago
parent 7ee3e00e49
commit c4e496a5ff

@ -4,4 +4,5 @@ plugins {
id "org.jetbrains.kotlin.kapt" version "$KOTLIN_VERSION" apply false id "org.jetbrains.kotlin.kapt" version "$KOTLIN_VERSION" apply false
id "org.jetbrains.kotlin.android.extensions" version "$KOTLIN_VERSION" apply false id "org.jetbrains.kotlin.android.extensions" version "$KOTLIN_VERSION" apply false
id "org.jetbrains.kotlin.multiplatform" version "1.4.21" apply false id "org.jetbrains.kotlin.multiplatform" version "1.4.21" apply false
id "org.jlleitschuh.gradle.ktlint" version "9.4.1"
} }

@ -24,7 +24,7 @@ AVDNAME="uhabitsTest"
GRADLE="./gradlew --stacktrace --quiet" GRADLE="./gradlew --stacktrace --quiet"
PACKAGE_NAME=org.isoron.uhabits PACKAGE_NAME=org.isoron.uhabits
ANDROID_OUTPUTS_DIR="uhabits-android/build/outputs" ANDROID_OUTPUTS_DIR="uhabits-android/build/outputs"
VERSION=$(cat uhabits-android/gradle.properties | grep VERSION_NAME | sed -e 's/.*=//g;s/ //g') VERSION=$(cat gradle.properties | grep VERSION_NAME | sed -e 's/.*=//g;s/ //g')
if [ ! -f "${ANDROID_HOME}/platform-tools/adb" ]; then if [ ! -f "${ANDROID_HOME}/platform-tools/adb" ]; then
echo "Error: ANDROID_HOME is not set correctly" echo "Error: ANDROID_HOME is not set correctly"
@ -58,16 +58,12 @@ fail() {
ktlint() { ktlint() {
log_info "Running ktlint..." log_info "Running ktlint..."
cd uhabits-android
$GRADLE ktlintCheck || fail $GRADLE ktlintCheck || fail
cd ..
} }
build_core() { build_core() {
log_info "Building uhabits-core..." log_info "Building uhabits-core..."
cd uhabits-core $GRADLE :uhabits-core:build || fail
$GRADLE build || fail
cd ..
} }
@ -80,38 +76,33 @@ run_adb_as_root() {
} }
build_apk() { build_apk() {
cd uhabits-android
if [ ! -z $RELEASE ]; then if [ ! -z $RELEASE ]; then
log_info "Reading secret..." log_info "Reading secret..."
source ../.secret/env || fail source .secret/env || fail
fi fi
log_info "Removing old APKs..." log_info "Removing old APKs..."
rm -vf build/*.apk rm -vf uhabits-android/build/*.apk
if [ ! -z $RELEASE ]; then if [ ! -z $RELEASE ]; then
log_info "Building release APK..." log_info "Building release APK..."
$GRADLE assembleRelease $GRADLE :uhabits-android:assembleRelease
cp -v \ cp -v \
build/outputs/apk/release/uhabits-android-release.apk \ uhabits-android/build/outputs/apk/release/uhabits-android-release.apk \
build/loop-$VERSION-release.apk build/loop-$VERSION-release.apk
fi fi
log_info "Building debug APK..." log_info "Building debug APK..."
$GRADLE assembleDebug --stacktrace || fail $GRADLE :uhabits-android:assembleDebug --stacktrace || fail
cp -v \ cp -v \
build/outputs/apk/debug/uhabits-android-debug.apk \ uhabits-android/build/outputs/apk/debug/uhabits-android-debug.apk \
build/loop-$VERSION-debug.apk build/loop-$VERSION-debug.apk
cd ..
} }
build_instrumentation_apk() { build_instrumentation_apk() {
log_info "Building instrumentation APK..." log_info "Building instrumentation APK..."
cd uhabits-android
if [ ! -z $RELEASE ]; then if [ ! -z $RELEASE ]; then
$GRADLE assembleAndroidTest \ $GRADLE :uhabits-android:assembleAndroidTest \
-Pandroid.injected.signing.store.file=$LOOP_KEY_STORE \ -Pandroid.injected.signing.store.file=$LOOP_KEY_STORE \
-Pandroid.injected.signing.store.password=$LOOP_STORE_PASSWORD \ -Pandroid.injected.signing.store.password=$LOOP_STORE_PASSWORD \
-Pandroid.injected.signing.key.alias=$LOOP_KEY_ALIAS \ -Pandroid.injected.signing.key.alias=$LOOP_KEY_ALIAS \
@ -119,7 +110,6 @@ build_instrumentation_apk() {
else else
$GRADLE assembleAndroidTest || fail $GRADLE assembleAndroidTest || fail
fi fi
cd ..
} }
uninstall_apk() { uninstall_apk() {
@ -241,22 +231,22 @@ parse_opts() {
done done
} }
remove_build_dir() { remove_build_dirs() {
rm -rfv ./uhabits-core/build rm -rfv uhabits-core/build
rm -rfv ./uhabits-web/node_modules/upath/build rm -rfv uhabits-web/node_modules/upath/build
rm -rfv ./uhabits-web/node_modules/core-js/build rm -rfv uhabits-web/node_modules/core-js/build
rm -rfv ./uhabits-web/build rm -rfv uhabits-web/build
rm -rfv ./uhabits-core-legacy/build rm -rfv uhabits-core-legacy/build
rm -rfv ./uhabits-server/build rm -rfv uhabits-server/build
rm -rfv ./uhabits-android/build rm -rfv uhabits-android/build
rm -rfv ./uhabits-android/uhabits-android/build rm -rfv uhabits-android/uhabits-android/build
rm -rfv ./uhabits-android/android-pickers/build rm -rfv uhabits-android/android-pickers/build
rm -rfv ./uhabits-web/node_modules rm -rfv uhabits-web/node_modules
rm -rfv ./uhabits-core/.gradle rm -rfv uhabits-core/.gradle
rm -rfv ./uhabits-core-legacy/.gradle rm -rfv uhabits-core-legacy/.gradle
rm -rfv ./uhabits-server/.gradle rm -rfv uhabits-server/.gradle
rm -rfv ./uhabits-android/.gradle rm -rfv uhabits-android/.gradle
rm -rfv ./.gradle rm -rfv .gradle
} }
main() { main() {
@ -290,7 +280,7 @@ main() {
;; ;;
clean) clean)
remove_build_dir remove_build_dirs
;; ;;
*) *)

@ -1,10 +1,10 @@
plugins { plugins {
id 'com.github.triplet.play' version '3.1.0' id 'com.github.triplet.play' version '3.1.0'
id "org.jlleitschuh.gradle.ktlint" version "9.4.1"
id 'com.android.application' id 'com.android.application'
id "org.jetbrains.kotlin.android" id "org.jetbrains.kotlin.android"
id "org.jetbrains.kotlin.kapt" id "org.jetbrains.kotlin.kapt"
id "org.jetbrains.kotlin.android.extensions" id "org.jetbrains.kotlin.android.extensions"
id "org.jlleitschuh.gradle.ktlint"
} }
repositories { repositories {

@ -19,7 +19,7 @@
plugins { plugins {
id "org.jetbrains.kotlin.multiplatform" id "org.jetbrains.kotlin.multiplatform"
id "org.jlleitschuh.gradle.ktlint" version "9.4.1" id "org.jlleitschuh.gradle.ktlint"
} }
repositories { repositories {

@ -1,20 +0,0 @@
/*
* Copyright (C) 2016-2020 Alinson Santos Xavier <git@axavier.org>
*
* This file is part of Loop Habit Tracker.
*
* Loop Habit Tracker is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your
* option) any later version.
*
* Loop Habit Tracker is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
rootProject.name = "uhabits-server"
Loading…
Cancel
Save