aboutsummaryrefslogtreecommitdiff
path: root/compileSamples.sh
diff options
context:
space:
mode:
authorTrevor Johns <trevorjohns@google.com>2017-05-17 01:29:53 -0700
committerTrevor Johns <trevorjohns@google.com>2017-05-17 05:30:23 -0700
commit75aafd123461be009649273d7673257d90b0237e (patch)
treeefd7360cb8759419eac53d999d401aaa9d3c1a78 /compileSamples.sh
parente88ec37a845c2cb956690f37e9c7953a9f19504b (diff)
downloadandroid-75aafd123461be009649273d7673257d90b0237e.tar.gz
Add new script for globally compiling samples
Fixes OOM problem caused by loading all samples into Gradle simultaneously. Test: manual Change-Id: I756725c112e89f1f3218ee3ef55227d3b2837124
Diffstat (limited to 'compileSamples.sh')
-rwxr-xr-xcompileSamples.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/compileSamples.sh b/compileSamples.sh
new file mode 100755
index 00000000..b91853e4
--- /dev/null
+++ b/compileSamples.sh
@@ -0,0 +1,23 @@
+#!/bin/bash
+
+# Abort on error
+set -e
+
+if [ -z $1 ]; then
+ echo "Error: Please specify output directory";
+ exit 1
+else
+ echo "Output dir: ~/samples-out/${1}";
+fi
+
+export GRADLE_OPTS="-Xmx4096m -XX:MaxPermSize=512m -XX:-UseGCOverheadLimit -XX:+HeapDumpOnOutOfMemoryError"
+export JAVA_OPTS="-Xmx4096m -XX:MaxPermSize=512m -XX:-UseGCOverheadLimit -XX:+HeapDumpOnOutOfMemoryError"
+export _JAVA_OPTIONS="-Xmx4096m -XX:MaxPermSize=512m -XX:-UseGCOverheadLimit -XX:+HeapDumpOnOutOfMemoryError"
+
+parallel --joblog emit.log --max-procs 8 --retries 5 -a projects.txt ./emitSample.sh
+
+rsync -avzrt --delete ../../build/out/gradle/ ../../build/prebuilts/gradle
+rm -rf ~/samples-out/$1 || true
+mkdir -p ~/samples-out/$1
+mv ../../build/out/browseable/*.zip ~/samples-out/$1
+rsync -avzrt --delete ../../build/out/browseable/ ../../../development/samples/browseable