diff options
Diffstat (limited to 'eclipse/scripts')
-rwxr-xr-x | eclipse/scripts/build_server.sh | 15 | ||||
-rwxr-xr-x | eclipse/scripts/create_all_symlinks.sh | 190 | ||||
-rwxr-xr-x | eclipse/scripts/setup_eclipse.sh | 2 |
3 files changed, 150 insertions, 57 deletions
diff --git a/eclipse/scripts/build_server.sh b/eclipse/scripts/build_server.sh index 4efd609..e96abe1 100755 --- a/eclipse/scripts/build_server.sh +++ b/eclipse/scripts/build_server.sh @@ -24,6 +24,7 @@ DEST_DIR="" BUILD_NUMBER="" CREATE_ZIP="1" INTERNAL_BUILD="" +ADT_PREVIEW="preview" # "preview" for preview builds, "" for final release builds. function get_params() { # parse input parameters @@ -60,10 +61,10 @@ function check_params() { [ -n "$DEST_DIR" ] || die "Usage: $0 <destination-directory> [build-number]" [ -d "$DEST_DIR" ] || die "Destination directory $DEST_DIR must exist." - # Qualifier is "v" followed by date/time in YYYYMMDDHHSS format and the optional - # build number. + # Qualifier is "v" followed by date/time in YYYYMMDDHHSS format, an optional "preview" + # tag and the optional build number. DATE=`date +v%Y%m%d%H%M` - QUALIFIER="$DATE" + QUALIFIER="${DATE}-$ADT_PREVIEW" [ -n "$BUILD_NUMBER" ] && QUALIFIER="${QUALIFIER}-${BUILD_NUMBER}" return 0 @@ -76,14 +77,15 @@ function build_plugin() { # runs if any. BUILD_PREFIX="android-eclipse" if [ "$INTERNAL_BUILD" ]; then - # append 'eng' signifier to end of archive name to denote internal build + # append 'eng' qualifier to end of archive name to denote internal build BUILD_PREFIX="${BUILD_PREFIX}-eng" fi # exclude date from build-zip name so it can be auto-calculated by continuous # test process unless there's no build number, in which case the date is # still used (useful for testing) - ZIP_NAME="${BUILD_PREFIX}-${BUILD_NUMBER:-$DATE}.zip" + local preview="${ADT_PREVIEW:+-}${ADT_PREVIEW}" + ZIP_NAME="${BUILD_PREFIX}${preview}-${BUILD_NUMBER:-$DATE}.zip" [ -d "$DEST_DIR/$BUILD_PREFIX" ] || rm -rfv "$DEST_DIR/$BUILD_PREFIX" # Perform the Eclipse build and move the result in $DEST_DIR/android-build @@ -111,6 +113,7 @@ function build_plugin() { } function build_adt_ide() { + local preview="${ADT_PREVIEW}${ADT_PREVIEW:+-}" if [[ -z $INTERNAL_BUILD ]]; then # This needs to run from the top android directory D="$PROG_DIR" @@ -118,7 +121,7 @@ function build_adt_ide() { for sc in */*/*/build_ide*.sh; do if [[ -x $sc ]]; then echo "RUNNING $sc from $PWD" - $sc "$DEST_DIR" "$QUALIFIER" "${BUILD_NUMBER:-$QUALIFIER}" + $sc "$DEST_DIR" "$QUALIFIER" "${preview}${BUILD_NUMBER:-$QUALIFIER}" else echo "WARNING: skipping non-exec $sc script" fi diff --git a/eclipse/scripts/create_all_symlinks.sh b/eclipse/scripts/create_all_symlinks.sh index 925bc70..a464f51 100755 --- a/eclipse/scripts/create_all_symlinks.sh +++ b/eclipse/scripts/create_all_symlinks.sh @@ -39,6 +39,20 @@ function warn() { fi } +function printGradleJarPath() { + # Prints to stdout the absolute path of the JAR assembled for a given gradle project. + # $1 = source dir, e.g. tools/base or tools/swt + # $2 = the gradle project name e.g. common or lint-api + echo "## Quering Gradle properties for '$2' in '$1'." > /dev/stderr + ( cd $1 && \ + ./gradlew :$2:properties | awk ' + BEGIN { B=""; N=""; V="" } + /^archivesBaseName:/ { N=$2 } + /^buildDir:/ { D=$2 } + /^version:/ { V=$2 } + END { print D "/libs/" N "-" V ".jar" }' ) +} + ## parse arguments while [ $# -gt 0 ]; do case "$1" in @@ -76,12 +90,8 @@ else fi if [[ "$USE_COPY" == "1" ]]; then - function cpfile { # $1=source $2=dest - cp -fv $1 $2/ - } - - function cpdir() { # $1=source $2=dest - rsync -avW --delete-after $1 $2 + function cpfile { # $1=source $2=dest $3=optional dest filename + cp -fv $1 $2/$3 } else # computes the "reverse" path, e.g. "a/b/c" => "../../.." @@ -89,12 +99,15 @@ else echo $1 | sed 's@[^/]*@..@g' } - function cpfile { # $1=source $2=dest - ln -svf `back $2`/$1 $2/ - } - - function cpdir() { # $1=source $2=dest - ln -svf `back $2`/$1 $2 + function cpfile { # $1=source $2=dest $3=optional dest filename + local src=$1 + if [[ "${src:0:1}" != "/" ]]; then + # Not an absolute path. We assume a relative path to be + # relative to the android root and we want to make it + # relative to the destination dir. + src=$(back $2)/$1 + fi + ln -svf $src $2/$3 } fi @@ -105,10 +118,19 @@ LIBS="" CP_FILES="" +### Configure which libs to build. +# +# Each entry for LIBS needs to be prefixed with the way we want to build it: +# make: - a library built using its traditional Android.mk +# base: - a gradle library located in tools/base +# swt: - a gradle library located in toosl/swt +# +# LIBS entries without or with an unknown ":" prefix will generate an error. + ### BASE ### BASE_PLUGIN_DEST="sdk/eclipse/plugins/com.android.ide.eclipse.base/libs" -BASE_PLUGIN_LIBS="common sdkstats sdklib dvlib layoutlib-api sdk-common" +BASE_PLUGIN_LIBS="base:common swt:sdkstats base:sdklib base:dvlib base:layoutlib-api base:sdk-common" BASE_PLUGIN_PREBUILTS="\ prebuilts/tools/common/m2/repository/net/sf/kxml/kxml2/2.3.0/kxml2-2.3.0.jar \ prebuilts/tools/common/m2/repository/org/apache/commons/commons-compress/1.0/commons-compress-1.0.jar \ @@ -128,7 +150,8 @@ CP_FILES="$CP_FILES @:$BASE_PLUGIN_DEST $BASE_PLUGIN_LIBS $BASE_PLUGIN_PREBUILTS ### ADT ### ADT_DEST="sdk/eclipse/plugins/com.android.ide.eclipse.adt/libs" -ADT_LIBS="ant-glob asset-studio lint-api lint-checks ninepatch propertysheet rule-api sdkuilib swtmenubar manifest-merger" +ADT_LIBS="make:ant-glob base:asset-studio base:lint-api base:lint-checks base:ninepatch make:propertysheet \ + base:rule-api swt:sdkuilib swt:swtmenubar base:manifest-merger" ADT_PREBUILTS="\ prebuilts/tools/common/freemarker/freemarker-2.3.19.jar \ prebuilts/tools/common/m2/repository/org/ow2/asm/asm/4.0/asm-4.0.jar \ @@ -143,7 +166,7 @@ CP_FILES="$CP_FILES @:$ADT_DEST $ADT_LIBS $ADT_PREBUILTS" ### DDMS ### DDMS_DEST="sdk/eclipse/plugins/com.android.ide.eclipse.ddms/libs" -DDMS_LIBS="ddmlib ddmuilib swtmenubar uiautomatorviewer" +DDMS_LIBS="base:ddmlib swt:ddmuilib swt:swtmenubar swt:uiautomatorviewer" DDMS_PREBUILTS="\ prebuilts/tools/common/m2/repository/jfree/jcommon/1.0.12/jcommon-1.0.12.jar \ @@ -157,7 +180,7 @@ CP_FILES="$CP_FILES @:$DDMS_DEST $DDMS_LIBS $DDMS_PREBUILTS" ### TEST ### TEST_DEST="sdk/eclipse/plugins/com.android.ide.eclipse.tests" -TEST_LIBS="easymock sdktestutils" +TEST_LIBS="make:easymock base:testutils" TEST_PREBUILTS="prebuilts/tools/common/m2/repository/net/sf/kxml/kxml2/2.3.0/kxml2-2.3.0.jar" LIBS="$LIBS $TEST_LIBS" @@ -168,7 +191,7 @@ CP_FILES="$CP_FILES @:$TEST_DEST $TEST_LIBS $TEST_PREBUILTS" if [[ $PLATFORM != "windows-x86" ]]; then # We can't build enough of the platform on Cygwin to create layoutlib - BRIDGE_LIBS="layoutlib ninepatch" + BRIDGE_LIBS="make:layoutlib base:ninepatch" LIBS="$LIBS $BRIDGE_LIBS" fi @@ -177,7 +200,7 @@ fi ### HIERARCHYVIEWER ### HV_DEST="sdk/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/libs" -HV_LIBS="hierarchyviewer2lib swtmenubar" +HV_LIBS="swt:hierarchyviewer2lib swt:swtmenubar" LIBS="$LIBS $HV_LIBS" CP_FILES="$CP_FILES @:$HV_DEST $HV_LIBS" @@ -186,7 +209,7 @@ CP_FILES="$CP_FILES @:$HV_DEST $HV_LIBS" ### TRACEVIEW ### TV_DEST="sdk/eclipse/plugins/com.android.ide.eclipse.traceview/libs" -TV_LIBS="traceview" +TV_LIBS="swt:traceview" LIBS="$LIBS $TV_LIBS" CP_FILES="$CP_FILES @:$TV_DEST $TV_LIBS" @@ -195,7 +218,7 @@ CP_FILES="$CP_FILES @:$TV_DEST $TV_LIBS" ### MONITOR ### MONITOR_DEST="sdk/eclipse/plugins/com.android.ide.eclipse.monitor/libs" -MONITOR_LIBS="sdkuilib" +MONITOR_LIBS="swt:sdkuilib" LIBS="$LIBS $MONITOR_LIBS" CP_FILES="$CP_FILES @:$MONITOR_DEST $MONITOR_LIBS" @@ -203,7 +226,7 @@ CP_FILES="$CP_FILES @:$MONITOR_DEST $MONITOR_LIBS" ### SDKMANAGER ### -SDKMAN_LIBS="swtmenubar" +SDKMAN_LIBS="swt:swtmenubar" LIBS="$LIBS $SDKMAN_LIBS" @@ -214,18 +237,72 @@ if [[ $PLATFORM != "windows-x86" ]]; then # liblzf doesn't build under cygwin. If necessary, this should be fixed first. GLD_DEST="sdk/eclipse/plugins/com.android.ide.eclipse.gldebugger/libs" - GLD_LIBS="host-libprotobuf-java-2.3.0-lite liblzf" + GLD_LIBS="make:host-libprotobuf-java-2.3.0-lite make:liblzf" LIBS="$LIBS $GLD_LIBS" CP_FILES="$CP_FILES @:$GLD_DEST $GLD_LIBS" fi + +#--- Determine what to build + +UNPROCESSED="" +GRADLE_SWT="" +GRADLE_BASE="" +MAKE_TARGETS="" +for LIB in $LIBS; do + if [[ "${LIB:0:5}" == "base:" ]]; then + GRADLE_BASE="$GRADLE_BASE :${LIB:5}:assemble" + elif [[ "${LIB:0:4}" == "swt:" ]]; then + GRADLE_SWT="$GRADLE_SWT :${LIB:4}:assemble" + elif [[ "${LIB:0:5}" == "make:" ]]; then + MAKE_TARGETS="$MAKE_TARGETS ${LIB:5}" + else + UNPROCESSED="$UNPROCESSED $LIB" + fi +done + +unset LIBS # we shouldn't use this anymore, it has been split up just above. + + +if [[ -n $UNPROCESSED ]]; then + die "## The following libs lack a prefix (make:, base: or swt:): $UNPROCESSED" +fi + +# In the mode to only echo dependencies, output them and we're done +if [[ -n $ONLY_SHOW_DEPS ]]; then + echo $MAKE_TARGETS + exit 0 +fi + +# --- Gradle Build --- + +# tools/base: if we need it for SWT, we build them all and public local. +# Otherwise we do a specific tools/base build on just the requested targets. + +if [[ -n "$GRADLE_SWT" ]]; then + echo "### Starting tools/base: gradlew publishLocal" + (cd tools/base && ./gradlew publishLocal) +elif [[ -n "$GRADLE_BASE" ]]; then + echo "### Starting tools/base: gradlew $GRADLE_BASE" + (cd tools/base && ./gradlew $GRADLE_BASE) +fi + +# tools/swt: build requested targets + +if [[ -n "$GRADLE_SWT" ]]; then + echo "### Starting tools/swt: gradlew $GRADLE_SWT" + (cd tools/swt && ./gradlew $GRADLE_SWT) +fi + +# --- Android.mk Build --- + # If some of the libs are available in prebuilts/devtools, use link to them directly # instead of trying to rebuild them so remove them from the libs to build. Note that # they are already listed in CP_FILES so we'll adjust the source to copy later. -LIBS2="" -for LIB in $LIBS; do +NEW_TARGETS="" +for LIB in $MAKE_TARGETS; do J="prebuilts/devtools/tools/lib/$LIB.jar" if [[ ! -f $J ]]; then J="prebuilts/devtools/adt/lib/$LIB.jar" @@ -233,38 +310,33 @@ for LIB in $LIBS; do if [[ -f $J ]]; then warn "## Using existing $J" else - LIBS2="$LIBS2 $LIB" + NEW_TARGETS="$NEW_TARGETS $LIB" fi done -LIBS="$LIBS2" -unset LIBS2 +MAKE_TARGETS="$NEW_TARGETS" +unset NEW_TARGETS -# In the mode to only echo dependencies, output them and we're done -if [[ -n $ONLY_SHOW_DEPS ]]; then - echo $LIBS - exit 0 -fi -if [[ -z $ONLY_COPY_DEPS ]]; then - # Make sure we have lunch sdk-<something> - if [[ ! "$TARGET_PRODUCT" ]]; then - warn "## TARGET_PRODUCT is not set, running build/envsetup.sh" - . build/envsetup.sh - warn "## lunch sdk-eng" - lunch sdk-eng - fi - - # Run make on all libs +if [[ -n $MAKE_TARGETS ]]; then + ( # Make sure we have lunch sdk-<something> + if [[ ! "$TARGET_PRODUCT" ]]; then + warn "## TARGET_PRODUCT is not set, running build/envsetup.sh" + . build/envsetup.sh + warn "## lunch sdk-eng" + lunch sdk-eng + fi - J="4" - [[ $(uname) == "Darwin" ]] && J=$(sysctl hw.ncpu | cut -d : -f 2 | tr -d ' ') - [[ $(uname) == "Linux" ]] && J=$(cat /proc/cpuinfo | grep processor | wc -l) + J="4" + [[ $(uname) == "Darwin" ]] && J=$(sysctl hw.ncpu | cut -d : -f 2 | tr -d ' ') + [[ $(uname) == "Linux" ]] && J=$(cat /proc/cpuinfo | grep processor | wc -l) - warn "## Building libs: make -j$J $LIBS" - make -j${J} $LIBS + warn "## Building libs: make -j$J $MAKE_TARGETS" + make -j${J} $MAKE_TARGETS + ) fi -# Copy resulting files +# --- Copy resulting files --- + DEST="" for SRC in $CP_FILES; do if [[ "${SRC:0:2}" == "@:" ]]; then @@ -272,8 +344,26 @@ for SRC in $CP_FILES; do mkdir -vp "$DEST" continue fi - if [[ ! -f "$SRC" ]]; then + + ORIG_SRC="$SRC" + DEST_FILE="" + + if [[ "${SRC:0:5}" == "base:" ]]; then + SRC="${SRC:5}" + ORIG_SRC="$SRC" + DEST_FILE="$SRC.jar" + SRC=$(printGradleJarPath tools/base $SRC) + elif [[ "${SRC:0:4}" == "swt:" ]]; then + SRC="${SRC:4}" + ORIG_SRC="$SRC" + DEST_FILE="$SRC.jar" + SRC=$(printGradleJarPath tools/swt $SRC) + elif [[ "${SRC:0:5}" == "make:" ]]; then + SRC="${SRC:5}" ORIG_SRC="$SRC" + fi + + if [[ ! -f "$SRC" ]]; then # Take a prebuilts/devtools instead of a framework one if possible. SRC="prebuilts/devtools/tools/lib/$SRC.jar" if [[ ! -f "$SRC" ]]; then @@ -288,7 +378,7 @@ for SRC in $CP_FILES; do die "Invalid cp_file dest directory: $DEST" fi - cpfile "$SRC" "$DEST" + cpfile "$SRC" "$DEST" "$DEST_FILE" else die "## Unknown source '$ORIG_SRC' to copy in '$DEST'" fi diff --git a/eclipse/scripts/setup_eclipse.sh b/eclipse/scripts/setup_eclipse.sh index 4154bf8..5942c06 100755 --- a/eclipse/scripts/setup_eclipse.sh +++ b/eclipse/scripts/setup_eclipse.sh @@ -45,7 +45,7 @@ BASE_DIR="$1" [[ -n "$1" ]] || die "Usage: $0 <dest-dir>" # URL for Eclipse Linux RCP. -DOWNLOAD_URL="http://download.eclipse.org/technology/epp/downloads/release/helios/SR2/eclipse-rcp-helios-SR2-linux-gtk-x86_64.tar.gz" +DOWNLOAD_URL="http://archive.eclipse.org/technology/epp/downloads/release/helios/SR2/eclipse-rcp-helios-SR2-linux-gtk-x86_64.tar.gz" # URL for CDT CDT_DOWNLOAD_URL="http://download.eclipse.org/tools/cdt/releases/helios/dist/cdt-master-7.0.2.zip" |