aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjrizzoli <joey@cyanogenmoditalia.it>2015-11-05 16:35:05 +0100
committerjrizzoli <joey@cyanogenmoditalia.it>2016-01-11 21:46:28 +0100
commitbc101c241eea0291f7211ec811ae254d83ed4539 (patch)
tree1ce910eb6bc3a96d5754f03867aa6e07fd08db70
parent6e5c479a1660bc3c65ba6efc0a4ad0c56b9838ef (diff)
downloadandroid_external_gello_build-bc101c241eea0291f7211ec811ae254d83ed4539.tar.gz
android_external_gello_build-bc101c241eea0291f7211ec811ae254d83ed4539.tar.bz2
android_external_gello_build-bc101c241eea0291f7211ec811ae254d83ed4539.zip
gello_build: inline builder
Change-Id: I6c58a8487d706f08dfc9f617c1499a7d48be887f Signed-off-by: jrizzoli <joey@cyanogenmoditalia.it>
-rw-r--r--.gitignore8
-rw-r--r--README.md4
-rw-r--r--env/.gclient12
-rwxr-xr-xgello_build.sh203
4 files changed, 224 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..297862e
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,8 @@
+env/src
+env/_*
+env/build
+
+Gello.apk
+.cm_done
+
+depot
diff --git a/README.md b/README.md
index 85994b6..0cdd581 100644
--- a/README.md
+++ b/README.md
@@ -10,12 +10,10 @@ Features
----------
- *-h* = Show help message
- *-v* = Verbose mode, show more details
-- *--fast* = Skip sync and runhooks, useful for testing changes
-- *--clean* = Remove the whole Gello build system
- *--depot* = Install Depot Tool
+- *--fast* = Skip sync and runhooks, useful for testing changes
- *--mp* = Once everything else is done, install the given apk on a connected device
- *--no-sync* = Skip sync
-- *--verbose* = As "-v", show more details
Setup
----------
diff --git a/env/.gclient b/env/.gclient
new file mode 100644
index 0000000..96adcf6
--- /dev/null
+++ b/env/.gclient
@@ -0,0 +1,12 @@
+solutions = [
+ { "name" : "src",
+ "url" : "git://codeaurora.org/quic/chrome4sdp/chromium/src.git@refs/remotes/origin/m42",
+ "deps_file" : "DEPS",
+ "managed" : True,
+ "safesync_url": "",
+ "custom_deps" : {
+ "src/swe/browser" : "https://github.com/jrizzoli/android_packages_apps_gello.git@refs/remotes/origin/cm-12.1"
+ }
+ },
+]
+target_os = ["android"]
diff --git a/gello_build.sh b/gello_build.sh
new file mode 100755
index 0000000..fb81f36
--- /dev/null
+++ b/gello_build.sh
@@ -0,0 +1,203 @@
+#!/bin/bash
+#
+# Copyright (C) 2015 The CyanogenMod Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# Integrated SWE Build System for Gello
+#
+
+##
+# Variables
+#
+TOP_GELLO=$(pwd)
+SRC_GELLO=$TOP_GELLO/env/src
+
+READY_APK=$TOP_GELLO/Gello.apk
+
+
+##
+# Flag Booleans
+#
+FAST=false
+PUSH=false
+NOSYNC=false
+VERBOSE=false
+
+
+##
+# Sync
+#
+function sync() {
+ if [ "$NOSYNC" != true ]; then
+ cd $TOP_GELLO/env
+
+ # If we have previously downloaded depot tools using this script
+ # export its path for us
+ if [ -d "$TOP_GELLO/depot/depot_tools" ]; then
+ export PATH=$PATH:$TOP_GELLO/depot/depot_tools
+ fi
+
+ echo "Syncing now!"
+ gclient sync -n --no-nag-max
+ return $?
+ else
+ return 0
+ fi
+}
+
+
+##
+# Setup
+#
+function setup() {
+ local DONE_FILE=$TOP_GELLO/.cm_done
+ local GOOGLE_SDK=$SRC_GELLO/third_party/android_tools/sdk/extras/google/google_play_services
+
+ cd $SRC_GELLO
+
+ . build/android/envsetup.sh
+
+ if [ "$FAST" != true ] && [ -f $DONE_FILE ]; then
+ # !! The first time it asks a manual input to accept licenses !!
+ GYP_DEFINES="$GYP_DEFINES OS=android swe_channel=cm" gclient runhooks
+ return $?
+ else
+ return 0
+ fi
+
+ if [ ! -f $DONE_FILE ]; then
+ touch $DONE_FILE
+ fi
+
+ # If we don't have Google SDKs, get them
+ # !! This asks a manual input to accept licenses !!
+ if [ ! -d $GOOGLE_SDK ]; then
+ bash $SRC_GELLO/build/install-android-sdks.sh
+ fi
+
+
+}
+
+
+##
+# Compile
+#
+function compile() {
+ local TMP_APK=$SRC_GELLO/out/Release/apks/SWE_AndroidBrowser.apk
+ local OUT_TARGET=$TOP_GELLO/Gello.apk
+
+ cd $SRC_GELLO
+
+ # Make things
+ ninja -C out/Release swe_android_browser_apk
+
+ if [ "$?" == 0 ]; then
+ if [ -f "$OUT_TARGET" ]; then
+ rm -f $OUT_TARGET
+ fi
+ cp $TMP_APK $OUT_TARGET
+ return $?
+ else
+ return $?
+ fi
+}
+
+
+##
+# Check Flags
+#
+function checkflags() {
+ if [ "$1" == "--verbose" ] || [ "$2" == "--verbose" ] ||
+ [ "$3" == "--verbose" ] || [ "$4" == "--verbose" ]; then
+ VERBOSE=true
+ fi
+
+ if [ "$1" == "--fast" ] || [ "$2" == "--fast" ] ||
+ [ "$3" == "--fast" ] || [ "$4" == "--fast" ]; then
+ NOSYNC=true
+ FAST=true
+ fi
+
+ if [ "$1" == "--no-sync" ] || [ "$2" == "--no-sync" ] ||
+ [ "$3" == "--no-sync" ] || [ "$4" == "--no-sync" ]; then
+ NOSYNC=true
+ fi
+
+ if [ "$1" == "--push" ] || [ "$2" == "--push" ] ||
+ [ "$3" == "--push" ] || [ "$4" == "--push" ]; then
+ PUSH=true
+ fi
+}
+
+
+##
+# Help
+#
+function helpgello() {
+ cat<<EOF
+Gello inline build system (c) CyanogenMod 2015
+Usage: ./gello_build.sh <flags>
+flags:
+ -h = Show this message
+ -v = Verbose mode, show more details
+ --depot = Install Depot Tool
+ --fast = Skip sync and runhooks, useful for testing changes
+ --push = Once everything else is done, install the given apk on a connected device
+ --no-sync = Skip sync
+EOF
+}
+
+
+##
+# Depot
+#
+function getdepot() {
+ cd $TOP_GELLO
+
+ mkdir depot
+ cd depot
+ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
+}
+
+
+##
+# Main
+#
+
+if [ "$1" == "--depot" ]; then
+ getdepot && exit 0
+elif [ "$1" == "--help" ]; then
+ helpgello && exit 0
+fi
+
+checkflags $1 $2 $3 $4
+
+sync && setup && compile
+
+if [ "$?" == 0 ]; then
+ echo "$(tput setaf 2)Done! Gello: $READY_APK$(tput sgr reset)"
+
+ if [ "$PUSH" == true ]; then
+ if [ ! -x $(which adb) ]; then
+ adb wait-for-device
+ adb install -r -d $TOP_GELLO/Gello.apk
+ exit $?
+ else
+ echo "Adb not found! Unable to push gello to device!"
+ exit 3
+ fi
+ fi
+
+ exit 0
+fi