1#!/bin/sh 2 3NUM_ARGS=$# 4JAR_DESTINATION="$1/prebuilts/framework_intermediates/libs/systemui_statsd.jar" 5 6has_croot() { 7 declare -F croot > /dev/null 8 return $? 9} 10 11check_environment() { 12 if ! has_croot; then 13 echo "Run script in a shell that has had envsetup run. Run '. update_statsd_lib.sh' from scripts directory" 14 return 1 15 fi 16 17 if [ $NUM_ARGS -ne 1 ]; then 18 echo "Usage: . update_statsd_lib.sh PATH_TO_UNBUNDLED_LAUNCER e.g. . update_statsd_lib ~/src/ub-launcher3-master" 19 return 1 20 fi 21 return 0 22} 23 24main() { 25 if check_environment ; then 26 pushd . 27 croot 28 mma -j16 SystemUI-statsd 29 cp out/target/product/$TARGET_PRODUCT/obj/JAVA_LIBRARIES/SystemUI-statsd_intermediates/javalib.jar $JAR_DESTINATION 30 popd 31 fi 32} 33 34main 35 36