From 30ae1f958506c3716158de270035f97e820cd6f0 Mon Sep 17 00:00:00 2001 From: SahilSonar Date: Thu, 11 Jul 2024 11:44:28 +0530 Subject: [PATCH 1/2] docker: Add support for android 14 - Android 14 introduced a new lunch format --. - Add support to handle release case Co-authored-by: Mohammed Althaf Thayyil --- build-community.sh | 10 +++++++--- src/build.sh | 33 ++++++++++++++++++++++----------- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/build-community.sh b/build-community.sh index b2b73b5..947b025 100755 --- a/build-community.sh +++ b/build-community.sh @@ -114,6 +114,9 @@ for branch in ${BRANCH_NAME//,/ }; do elif [[ "${BRANCH_NAME}" =~ $regex_part1"t"$regex_part2 ]]; then themuppets_branch="lineage-20.0" android_version="13" + elif [[ "${BRANCH_NAME}" =~ $regex_part1"u"$regex_part2 ]]; then + themuppets_branch="lineage-21.0" + android_version="14" else echo ">> [$(date)] Building branch $branch is not (yet) suppported" exit 1 @@ -326,13 +329,14 @@ for branch in ${BRANCH_NAME//,/ }; do fi BRUNCH_DEVICE=${codename} + BUILD_TYPE=userdebug if [ "${ENG_BUILD}" = true ]; then - BRUNCH_DEVICE=lineage_${codename}-eng + BUILD_TYPE=eng fi if [ "$android_version_major" -lt "12" ]; then - if brunch ${BRUNCH_DEVICE} &>>"$DEBUG_LOG"; then + if brunch ${BRUNCH_DEVICE} ${BUILD_TYPE} &>>"$DEBUG_LOG"; then currentdate=$(date +%Y%m%d) if [ "$builddate" != "$currentdate" ]; then find out/target/product/$codename -maxdepth 1 -name "e-*-$currentdate-*.zip*" -type f -exec sh /root/fix_build_date.sh {} $currentdate $builddate \; &>>"$DEBUG_LOG" @@ -350,7 +354,7 @@ for branch in ${BRANCH_NAME//,/ }; do else echo ">> [$(date)] Failed build for $codename" | tee -a "$DEBUG_LOG" fi - elif breakfast ${BRUNCH_DEVICE} &>>"$DEBUG_LOG"; then + elif breakfast ${BRUNCH_DEVICE} ${BUILD_TYPE} &>>"$DEBUG_LOG"; then mka target-files-package otatools echo ">> [$(date)] Starting signing target-files-package" diff --git a/src/build.sh b/src/build.sh index f7679cc..f8b7122 100755 --- a/src/build.sh +++ b/src/build.sh @@ -91,7 +91,7 @@ exit_script() { sync_successful=true use_openjdk_from_ubuntu=false -branch_dir=$(sed -E 's/^v[0-9](\.[0-9]*){0,2}(-(beta|alpha|rc)(\.[0-9]*){0,1}){0,1}-(nougat|oreo|pie|q|r|s|t)(-[a-zA-Z0-9_]*)*$/\5/' <<<"${BRANCH_NAME}") +branch_dir=$(sed -E 's/^v[0-9](\.[0-9]*){0,2}(-(beta|alpha|rc)(\.[0-9]*){0,1}){0,1}-(nougat|oreo|pie|q|r|s|t|u)(-[a-zA-Z0-9_]*)*$/\5/' <<<"${BRANCH_NAME}") branch_dir=${branch_dir^^} if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then @@ -122,6 +122,9 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then elif [[ "${BRANCH_NAME}" =~ $regex_part1"t"$regex_part2 ]]; then themuppets_branch="lineage-20.0" android_version="13" + elif [[ "${BRANCH_NAME}" =~ $regex_part1"u"$regex_part2 ]]; then + themuppets_branch="lineage-21.0" + android_version="14" else echo ">> [$(date)] Building branch $branch is not (yet) suppported" exit 1 @@ -314,16 +317,16 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then build_successful=false echo ">> [$(date)] ANDROID_JACK_VM_ARGS=${ANDROID_JACK_VM_ARGS}" - BRUNCH_DEVICE=${DEVICE} + BUILD_TYPE=userdebug if [ "${ENG_BUILD}" = true ]; then - BRUNCH_DEVICE=lineage_${DEVICE}-eng + BUILD_TYPE=eng elif [ "${USER_BUILD}" = true ]; then - BRUNCH_DEVICE=lineage_${DEVICE}-user - elif [ "${IS_EMULATOR}" = true ]; then - BRUNCH_DEVICE=lineage_${DEVICE}-userdebug + BUILD_TYPE=user fi + BRUNCH_DEVICE=lineage_${DEVICE}-${BUILD_TYPE} + if [[ "${BRANCH_NAME}" = *"rc"* ]] || [[ "${BRANCH_NAME}" = *"alpha"* ]] || [[ "${BRANCH_NAME}" == *"beta"* ]]; then PRODUCT_PRERELEASE=$(echo ${BRANCH_NAME} | sed -E 's/v[0-9]*\.[0-9]*(\.[0-9]*)?-(beta|alpha|rc).*/\2/') export PRODUCT_PRERELEASE @@ -334,24 +337,32 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then fi build_success=false + breakfast_device() { + if [ "$android_version_major" -gt "13" ]; then + breakfast "${DEVICE}" "${BUILD_TYPE}" + else + breakfast "${BRUNCH_DEVICE}" + fi + } + if [ "${BUILD_ONLY_SYSTEMIMAGE}" = true ]; then - breakfast "${BRUNCH_DEVICE}" + breakfast_device if make systemimage; then build_success=true fi elif [ "${IS_EMULATOR}" = true ]; then - if lunch "${BRUNCH_DEVICE}" && mka sdk_addon; then + if breakfast_device && mka && mka sdk_addon; then build_success=true fi elif [ "$android_version_major" -lt "12" ]; then if [ "${BUILD_SUPER_IMAGE}" = true ]; then - if breakfast "${BRUNCH_DEVICE}" && mka bacon superimage; then + if breakfast_device && mka bacon superimage; then build_success=true fi - elif brunch "${BRUNCH_DEVICE}"; then + elif brunch "${DEVICE}" "${BUILD_TYPE}"; then build_success=true fi - elif breakfast "${BRUNCH_DEVICE}"; then + elif breakfast_device; then # Apply patch for vendor prebuilt devices. if [ "${DEVICE}" = "one" ] || [ "${DEVICE}" = "two" ]; then echo ">> [$(date)] Applying patch for prebuilt vendor device" -- GitLab From b33d5fcfdd062ff810e88f18c501c40874771a8a Mon Sep 17 00:00:00 2001 From: althafvly Date: Fri, 26 Jul 2024 13:38:17 +0530 Subject: [PATCH 2/2] docker: Build emu for android 14 --- src/build.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/build.sh b/src/build.sh index f8b7122..da30dfc 100755 --- a/src/build.sh +++ b/src/build.sh @@ -351,9 +351,11 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then build_success=true fi elif [ "${IS_EMULATOR}" = true ]; then - if breakfast_device && mka && mka sdk_addon; then - build_success=true - fi + if breakfast_device && mka; then + if ( [ "$android_version_major" -lt "13" ] && mka sdk_addon ) || mka emu_img_zip; then + build_success=true + fi + fi elif [ "$android_version_major" -lt "12" ]; then if [ "${BUILD_SUPER_IMAGE}" = true ]; then if breakfast_device && mka bacon superimage; then @@ -684,7 +686,11 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then if [ "$IS_EMULATOR" = true -a "$BACKUP_EMULATOR" = true ]; then EMULATOR_ARCHIVE="IMG-e-$(grep lineage.version system/build.prop | sed s/#.*// | sed s/.*=// | tr -d '\n').zip" - mv ../../../host/linux-x86/sdk_addon/*-img.zip "$ZIP_DIR/$zipsubdir/$EMULATOR_ARCHIVE" + if [ "$android_version_major" -gt "13" ]; then + mv sdk-repo-linux-system-images.zip "$ZIP_DIR/$zipsubdir/$EMULATOR_ARCHIVE" + else + mv ../../../host/linux-x86/sdk_addon/*-img.zip "$ZIP_DIR/$zipsubdir/$EMULATOR_ARCHIVE" + fi pushd "$ZIP_DIR/$zipsubdir" sha256sum "$EMULATOR_ARCHIVE" >"$EMULATOR_ARCHIVE.sha256sum" popd -- GitLab