diff options
-rw-r--r-- | build-scripts/build-android | 24 | ||||
-rwxr-xr-x | build-scripts/build-android-lcr | 135 | ||||
-rw-r--r-- | build-scripts/helpers | 3 | ||||
-rwxr-xr-x | node/prepare_build_config.py | 4 |
4 files changed, 154 insertions, 12 deletions
diff --git a/build-scripts/build-android b/build-scripts/build-android index b75e29d..f1cd367 100644 --- a/build-scripts/build-android +++ b/build-scripts/build-android @@ -176,9 +176,6 @@ else if test -z "$TARGET_ARCH_VARIANT" -a -z "$LUNCH"; then TARGET_ARCH_VARIANT=armv7-a-neon fi - if test -z "$WITH_HOST_DALVIK"; then - WITH_HOST_DALVIK=false - fi SHOWCOMMANDS= if ! test -z "$QUIET" && test "$QUIET" = "1"; then @@ -202,12 +199,23 @@ else [ -z $ANDROID_CLANGVER ] && ANDROID_CLANGVER=clang-4053586 # aosp prebuilt build number at 2017/10/11 master mkdir -p $PWD/prebuilts/clang/host/linux-x86/clang-master cp -r external_tarballs/$(basename ${CLANG_TOOLCHAIN_URL} .tar.xz)/* $PWD/prebuilts/clang/host/linux-x86/clang-master/ - for i in lib64 prebuilt_include test; do - # mkdir -p $PWD/prebuilts/clang/host/linux-x86/clang-master/${i} - # cp -af $PWD/prebuilts/clang/host/linux-x86/$ANDROID_CLANGVER/${i}/* $PWD/prebuilts/clang/host/linux-x86/clang-master/${i}/ + + export LLVM_PREBUILTS_VERSION=clang-master + export LLVM_RELEASE_VERSION=$(ls $PWD/prebuilts/clang/host/linux-x86/clang-master/lib64/clang/) + + # ********** FIXME ********** + # All the files being copied from the AOSP clang build + # should really be part of the toolchain tarball. + # Not done currently because they aren't generated by upstream + # clang's build process. + for i in test; do ln -s $PWD/prebuilts/clang/host/linux-x86/$ANDROID_CLANGVER/${i} $PWD/prebuilts/clang/host/linux-x86/clang-master/${i} done - export LLVM_PREBUILTS_VERSION=clang-master + # This catches crosscompiled compiler-rt versions, libFuzzer, + # as well as symbol versioning files + for i in $PWD/prebuilts/clang/host/linux-x86/$ANDROID_CLANGVER/lib64/clang/*/lib/linux/*; do + [ -e "$PWD/prebuilts/clang/host/linux-x86/clang-master/lib64/clang/$LLVM_RELEASE_VERSION/lib/linux/$(basename $i)" ] || cp -a $i $PWD/prebuilts/clang/host/linux-x86/clang-master/lib64/clang/$LLVM_RELEASE_VERSION/lib/linux/ + done fi if [ -x "${TARGET_TOOLS_PREFIX}gcc" ]; then @@ -228,7 +236,7 @@ else trap - ERR export TIMEFORMAT="TIME: Compilation: %lR" - time $MAKE $MAKE_OPTS -j$MAKE_JOBS $MAKE_TARGETS $SHOWCOMMANDS WITH_HOST_DALVIK="$WITH_HOST_DALVIK" USE_CLANG_PLATFORM_BUILD="$USE_CLANG_PLATFORM_BUILD" + time $MAKE $MAKE_OPTS -j$MAKE_JOBS $MAKE_TARGETS $SHOWCOMMANDS USE_CLANG_PLATFORM_BUILD="$USE_CLANG_PLATFORM_BUILD" unset TIMEFORMAT trap infrastructure_error ERR diff --git a/build-scripts/build-android-lcr b/build-scripts/build-android-lcr new file mode 100755 index 0000000..68cc7b3 --- /dev/null +++ b/build-scripts/build-android-lcr @@ -0,0 +1,135 @@ +############################################################################### +# 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 diff --git a/build-scripts/helpers b/build-scripts/helpers index f1f5048..5080dee 100644 --- a/build-scripts/helpers +++ b/build-scripts/helpers @@ -166,8 +166,7 @@ EOF flatten_artifacts () { if [ "$FLATTEN_ARTIFACTS" != "0" ]; then - mv out/target/product/$TARGET_OUT_DIR/* out/ - rm -r out/target + cp -r out/target/product/$TARGET_OUT_DIR/* out/ fi } diff --git a/node/prepare_build_config.py b/node/prepare_build_config.py index ca88cda..4343d5c 100755 --- a/node/prepare_build_config.py +++ b/node/prepare_build_config.py @@ -95,7 +95,7 @@ def convert_config_to_shell(config_text, out_filename): if not l or l[0] == "#": continue if not re.match(r"[A-Za-z][A-Za-z0-9_]*=", l): - print "Invalid build config syntax: " + l + print("Invalid build config syntax: " + l) sys.exit(1) var, val = l.split("=", 1) val = shell_unquote(val) @@ -107,7 +107,7 @@ def convert_config_to_shell(config_text, out_filename): def main(config_in, is_base64): if is_base64: - config_in = base64.b64decode(config_in) + config_in = base64.b64decode(config_in).decode() if is_on_ec2(): BUILD_CONFIG_FILE=BUILD_CONFIG_FILE_EC2 else: |