############################################################################### # Copyright (c) 2019 Linaro # All rights reserved. This program and the accompanying materials # are made available under the terms of the Eclipse Public License v1.0 # which accompanies this distribution, and is available at # http://www.eclipse.org/legal/epl-v10.html ############################################################################### export PATH=$PATH:~/bin/ set -o errtrace git config --global user.email "android-build-bot@fake-email.com" git config --global user.name "android-build-bot" source "${BUILD_SCRIPT_ROOT}"/helpers trap infrastructure_error ERR if [ -z "${TARGET_OUT_DIR}" ]; then # only set TARGET_OUT_DIR when it is not set # Set TARGET_OUT_DIR since few TARGET_PRODUCT include "full_" keyword as well export TARGET_OUT_DIR=`echo $TARGET_PRODUCT | sed 's/_/\n/;s/.*\n//'` fi calc_make_jobs java -version # Download overlays ASAP for fail-fast approach if [ -n "$SOURCE_OVERLAY" ]; then download_overlays "$SOURCE_OVERLAY" unpack_overlays "$SOURCE_OVERLAY" fi # Remove any old local manifest and manifest which can break repo init if # duplicate repository are found or forceful manifest update rm -rf .repo/local_manifests .repo/manifest* if [ -n "$REPO_SEED_URL" ]; then repo-sync-from-seed "${1}" else repo-sync-from-mirror "${1}" fi if [ -n "$GERRIT_PROJECT" ] && [ $GERRIT_PROJECT != "android-build-configs" ] && [ $GERRIT_EVENT_TYPE == "comment-added" ]; then if [ ${GERRIT_HOST} == "dev-private-review.linaro.org" ]; then GERRIT_URL="ssh://git@${GERRIT_HOST}/${GERRIT_PROJECT}" else GERRIT_URL="http://${GERRIT_HOST}/${GERRIT_PROJECT}" fi if [ "$GERRIT_PROJECT" == "platform/manifest" ] || [ "$GERRIT_PROJECT" == "linaro-art/platform/manifest" ]; then cd .repo/local_manifests; git pull ${GERRIT_URL} $GERRIT_REFSPEC cd - repo sync -j16 else cd `grep -rni $GERRIT_PROJECT\" .repo/local_manifests | grep -Po 'path="\K[^"]*'` if git pull ${GERRIT_URL} ${GERRIT_REFSPEC} | grep -q "Automatic merge failed"; then git reset --hard echo "Error: *** Error patch merge failed" exit 1 fi cd - fi fi if [ -n "$PATCHSETS" ]; then for i in $PATCHSETS; do sh ./android-patchsets/$i done fi # Generate a Changelog describing additional patches applied to AOSP codebase export android_version=`grep -rni "refs/tags" .repo/manifest.xml | sed -e "s/.*tags\///" -e "s/\"//g"` repo forall -c 'if git rev-parse $android_version >/dev/null 2>&1 then patches=`git log --oneline --no-merges $android_version..HEAD | wc -l` if [ $patches -ne 0 ]; then git_remote=`git remote -v | grep "fetch" | cut -f2 | cut -d " " -f1` echo "=====================================================================" echo "Patchsets applied to $git_remote on top of $android_version" git diff --stat $android_version HEAD git log --oneline --no-merges $android_version..HEAD echo "" fi; fi' | cat > temp_changelog.txt files_changed=`add_changes \`grep -e "file changed" -e "files changed" temp_changelog.txt | cut -d " " -f2\`` insertions=`add_changes \`grep -e "file changed" -e "files changed" temp_changelog.txt | cut -d " " -f5\`` deletions=`add_changes \`grep -e "file changed" -e "files changed" temp_changelog.txt | cut -d " " -f7\`` echo "=====================================================================" > changelog.txt echo "=====================================================================" >> changelog.txt echo "$files_changed files changed, $insertions insertions(+), $deletions deletions(-)" >> changelog.txt echo "=====================================================================" >> changelog.txt echo "=====================================================================" >> changelog.txt echo "" >> changelog.txt cat temp_changelog.txt >> changelog.txt trap - ERR export TIMEFORMAT="TIME: Compilation: %lR" if [ -f ./android-build-configs/linaro-build.sh ]; then time ./android-build-configs/linaro-build.sh -c "${BUILD_CONFIG_FILENAME}" -ss else source build/envsetup.sh [ -n "$LUNCH" ] && lunch "$LUNCH" [ -z "$MAKE" ] && MAKE=make time $MAKE $MAKE_OPTS -j$MAKE_JOBS $MAKE_TARGETS fi unset TIMEFORMAT trap infrastructure_error ERR # Show remaining disk space to catch early if # we're approaching ramdisk limit again echo "Remaining disk space after build:" df # Store kernel .config as a build artifact if [ -f kernel/.config ]; then cp kernel/.config out/kernel_config elif [ -f "out/target/product/$TARGET_OUT_DIR/obj/kernel/.config" ]; then cp "out/target/product/$TARGET_OUT_DIR/obj/kernel/.config" out/kernel_config fi # Create md5sums file for platform artifacts (cd out/target/product/${TARGET_OUT_DIR}/; md5sum *.tar.bz2 *.img *.img.bz2 >MD5SUMS) || true if [ ! -n "$SKIP_LICENSE_CHECK" ]; then ${BUILD_SCRIPT_ROOT}/license-verification.sh out/pinned-manifest.xml out/target/product/$TARGET_PRODUCT/BUILD-INFO.txt fi if [ -n "$PUBLISH_DESCRIPTIONS" ]; then ${BUILD_SCRIPT_ROOT}/../utils/manifest-descriptions/make.sh out/source-manifest.xml out/pinned-manifest.xml fi cp changelog.txt out/ flatten_artifacts