diff options
author | Raphael Moll <ralf@android.com> | 2013-01-15 18:06:01 -0800 |
---|---|---|
committer | Raphael Moll <ralf@android.com> | 2013-01-15 18:29:06 -0800 |
commit | 5e46fc9b7736a8df1826b7b93b1275270798b04d (patch) | |
tree | a126ad2e5b7e816c3eb8c9ca307420ba609ac5ea /update_jars.sh | |
parent | 3bcba8585f27fd9d011763b606139f1ad0fe3e2a (diff) | |
download | devtools-5e46fc9b7736a8df1826b7b93b1275270798b04d.tar.gz |
SDK: Devtools prebuilts for sdklib, sdkuilib and swtmenubar.
sdklib: built from tools/base 187dab382bcb657c8fad843672ec76138713eeb3
sdkuilib, swtmenubar: built from tools/swt 15dd833ff93b9d25253b87000ef0fc16027e297a
Also updated the update script, now you can update a single prebuilt
by doing something like this:
$ ./update_jars.sh -f ddmlib
Change-Id: I296aee5dfe8fbb9f9b6b11a281b078b5328d2210
Diffstat (limited to 'update_jars.sh')
-rwxr-xr-x | update_jars.sh | 94 |
1 files changed, 69 insertions, 25 deletions
diff --git a/update_jars.sh b/update_jars.sh index d1e146a..ccf08f9 100755 --- a/update_jars.sh +++ b/update_jars.sh @@ -2,13 +2,28 @@ set -e # fail on errors DRY="echo" # default to dry mode unless -f is specified +FILTER="" # name of a specific jar to update (default: update them all) + +while [[ -n "$1" ]]; do + if [[ "$1" == "-f" ]]; then + DRY="" + elif [[ -z "$FILTER" ]]; then + FILTER="$1" + else + echo "Unknown argument: $1" + echo "Usage: $0 [-f] [project_to_update]" + echo " (default: updates all jars.)" + exit 1 + fi + shift +done -if [[ "$1" == "-f" ]]; then - DRY="" -fi # Define projects to build and files to copy. function list_projects() { + add_project sdklib + add_project sdkuilib in:tools/swt + add_project swtmenubar in:tools/swt add_project ddmlib add_project manifmerger add_project jobb etc/jobb etc/jobb.bat @@ -16,63 +31,92 @@ function list_projects() { # ---- # List of targets to build, e.g. :jobb:jar -BUILD_LIST="" +declare -A BUILD_LIST # -A==associative array, aka a map[string]=>string # List of files to copy. Syntax: relative/dir (relative to src & dest) or src/rel/dir|dst/rel/dir. -COPY_LIST="" +declare -A COPY_LIST function add_project() { # $1=project name + # $2=optional in:tools/swt repo (default: tools/base) # $2...=optional files to copy (relative to project dir) local proj=$1 - echo "## Getting gradle properties for project $proj" + shift + + if [[ -n "$FILTER" && "$proj" != "$FILTER" ]]; then + echo "## Skipping project $proj" + return + fi + + local repo="base" + if [[ "$1" == "in:tools/swt" ]]; then + repo="swt" + shift + fi + + echo "## Getting gradle properties for project tools/$repo/$proj" # Request to build the jar for that project - BUILD_LIST="$BUILD_LIST :$proj:jar" + BUILD_LIST[$repo]="${BUILD_LIST[$repo]} :$proj:jar" + # Copy the resulting JAR local dst=$proj/$proj.jar - local src=`(cd ../../tools/base ; ./gradlew :$proj:properties | \ + local src=`(cd ../../tools/$repo ; ./gradlew :$proj:properties | \ awk 'BEGIN { B=""; N=""; V="" } \ /^archivesBaseName:/ { N=$2 } \ /^buildDir:/ { B=$2 } \ /^version:/ { V=$2 } \ END { print B "/libs/" N "-" V ".jar" }'i )` - COPY_LIST="$COPY_LIST $src|$dst" + COPY_LIST[$repo]="${COPY_LIST[$repo]} $src|$dst" # Copy all the optiona files - shift while [[ -n "$1" ]]; do - COPY_LIST="$COPY_LIST $proj/$1" + COPY_LIST[$repo]="${COPY_LIST[$repo]} $proj/$1" shift done + return 0 } function build() { + local repo=$1 echo - if [[ -z "$BUILD_LIST" ]]; then - echo "Error: nothing to build."; exit 1; + if [[ -z "${BUILD_LIST[$repo]}" ]]; then + echo "## WARNING: nothing to build in tools/$repo." + return 1 else - echo "## Building $BUILD_LIST" - ( cd ../../tools/base ; ./gradlew $BUILD_LIST ) + # To build tools/swt, we'll need to first locally publish some + # libs from tools/base. + if [[ "$repo" == "swt" ]]; then + echo "## PublishLocal in tools/base (needed for tools/swt)" + ( cd ../../tools/base ; ./gradlew publishLocal ) + fi + echo "## Building tools/$repo: ${BUILD_LIST[$repo]}" + ( cd ../../tools/$repo ; ./gradlew ${BUILD_LIST[$repo]} ) + return 0 fi } function copy_files() { + local repo=$1 echo - if [[ -z "$COPY_LIST" ]]; then - echo "Error: nothing to copy."; exit 1; + if [[ -z "${COPY_LIST[$repo]}" ]]; then + echo "## WARNING: nothing to copy in tools/$repo." else - for f in $COPY_LIST; do + for f in ${COPY_LIST[$repo]}; do src="${f%%|*}" # strip part after | if any dst="${f##*|}" # strip part before | if any - if [[ ${src:0:1} != "/" ]]; then src=../../tools/base/$src; fi + if [[ ${src:0:1} != "/" ]]; then src=../../tools/$repo/$src; fi $DRY cp -v $src $dst done - if [[ -n $DRY ]]; then - echo - echo "## WARNING: DRY MODE. Run with -f to actually copy files." - fi fi } list_projects -build -copy_files +for r in base swt; do + if build $r; then + copy_files $r + fi +done +if [[ -n $DRY ]]; then + echo + echo "## WARNING: DRY MODE. Run with -f to actually copy files." +fi + |