Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dd2f9076 authored by Mohammed Althaf T's avatar Mohammed Althaf T 😊
Browse files

Drop legacy android support (below a12)

parent 5ec12af4
Loading
Loading
Loading
Loading
+3 −44
Original line number Original line Diff line number Diff line
@@ -91,7 +91,7 @@ exit_script() {
sync_successful=true
sync_successful=true


use_openjdk_from_ubuntu=false
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|u|a14|a15)(-[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}-(s|t|u|a14|a15)(-[a-zA-Z0-9_]*)*$/\5/' <<<"${BRANCH_NAME}")
branch_dir=${branch_dir^^}
branch_dir=${branch_dir^^}
default_key_dir="user-keys"
default_key_dir="user-keys"


@@ -99,25 +99,7 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then
  vendor=lineage
  vendor=lineage
  regex_part1="^v[0-9](\.[0-9]*){0,2}(-(beta|alpha|rc)(\.[0-9]*){0,1}){0,1}-("
  regex_part1="^v[0-9](\.[0-9]*){0,2}(-(beta|alpha|rc)(\.[0-9]*){0,1}){0,1}-("
  regex_part2=")(-[a-zA-Z0-9_]*)*$"
  regex_part2=")(-[a-zA-Z0-9_]*)*$"
  if [[ "${BRANCH_NAME}" =~ $regex_part1"nougat"$regex_part2 ]]; then
  if [[ "${BRANCH_NAME}" =~ $regex_part1"s"$regex_part2 ]]; then
    vendor="cm"
    themuppets_branch="cm-14.1"
    android_version="7.1.2"
    use_openjdk_from_ubuntu=true
  elif [[ "${BRANCH_NAME}" =~ $regex_part1"oreo"$regex_part2 ]]; then
    themuppets_branch="lineage-15.1"
    android_version="8.1"
    use_openjdk_from_ubuntu=true
  elif [[ "${BRANCH_NAME}" =~ $regex_part1"pie"$regex_part2 ]]; then
    themuppets_branch="lineage-16.0"
    android_version="9"
  elif [[ "${BRANCH_NAME}" =~ $regex_part1"q"$regex_part2 ]]; then
    themuppets_branch="lineage-17.1"
    android_version="10"
  elif [[ "${BRANCH_NAME}" =~ $regex_part1"r"$regex_part2 ]]; then
    themuppets_branch="lineage-18.1"
    android_version="11"
  elif [[ "${BRANCH_NAME}" =~ $regex_part1"s"$regex_part2 ]]; then
    themuppets_branch="lineage-19.1"
    themuppets_branch="lineage-19.1"
    android_version="12"
    android_version="12"
  elif [[ "${BRANCH_NAME}" =~ $regex_part1"t"$regex_part2 ]]; then
  elif [[ "${BRANCH_NAME}" =~ $regex_part1"t"$regex_part2 ]]; then
@@ -250,10 +232,6 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then
  fi
  fi


  config_file="vendor/lineage/config/version.mk"
  config_file="vendor/lineage/config/version.mk"
  if [ ! -f "$config_file" ]; then
    # If version.mk doesn't exist, use common.mk
    config_file="vendor/lineage/config/common.mk"
  fi


  # Extract version information
  # Extract version information
  PRODUCT_VERSION_MAJOR=$(grep -oP 'PRODUCT_VERSION_MAJOR = \K.*' "$config_file")
  PRODUCT_VERSION_MAJOR=$(grep -oP 'PRODUCT_VERSION_MAJOR = \K.*' "$config_file")
@@ -271,11 +249,6 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then
    echo ">> [$(date)] Adding keys path ($KEYS_DIR)"
    echo ">> [$(date)] Adding keys path ($KEYS_DIR)"
    # Soong (Android 9+) complains if the signing keys are outside the build path
    # Soong (Android 9+) complains if the signing keys are outside the build path
    ln -sf "$KEYS_DIR" $default_key_dir
    ln -sf "$KEYS_DIR" $default_key_dir
    if [ "$android_version_major" -lt "10" ]; then
      sed -i "1s;^;PRODUCT_DEFAULT_DEV_CERTIFICATE := $default_key_dir/releasekey\nPRODUCT_OTA_PUBLIC_KEYS := $default_key_dir/releasekey\nPRODUCT_EXTRA_RECOVERY_KEYS := $default_key_dir/releasekey\n\n;" "vendor/$vendor/config/common.mk"
    elif [ "$android_version_major" -lt "12" ]; then
      sed -i "1s;^;PRODUCT_DEFAULT_DEV_CERTIFICATE := $default_key_dir/releasekey\nPRODUCT_OTA_PUBLIC_KEYS := $default_key_dir/releasekey\n\n;" "vendor/$vendor/config/common.mk"
    fi
  fi
  fi


  # Prepare the environment
  # Prepare the environment
@@ -384,14 +357,6 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then
          build_success=true
          build_success=true
        fi
        fi
      fi
      fi
    elif [ "$android_version_major" -lt "12" ]; then
      if [ "${BUILD_SUPER_IMAGE}" = true ]; then
        if breakfast_device && mka bacon superimage; then
          build_success=true
        fi
      elif brunch "${DEVICE}" "${BUILD_TYPE}"; then
        build_success=true
      fi
    elif breakfast_device; then
    elif breakfast_device; then
      # Apply patch for vendor prebuilt devices.
      # Apply patch for vendor prebuilt devices.
      if [ "${DEVICE}" = "one" ] || [ "${DEVICE}" = "two" ]; then
      if [ "${DEVICE}" = "one" ] || [ "${DEVICE}" = "two" ]; then
@@ -418,7 +383,7 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then
        SIGN_KEY=(-k "$default_key_dir/releasekey")
        SIGN_KEY=(-k "$default_key_dir/releasekey")
      fi
      fi


      if [ "$android_version_major" -ge 12 ] && [ "$SIGN_BUILDS" = true ]; then
      if [ "$SIGN_BUILDS" = true ]; then
        APEX_PACKAGE_LIST=$(cat "/root/apex.list")
        APEX_PACKAGE_LIST=$(cat "/root/apex.list")
        for PACKAGE in $APEX_PACKAGE_LIST; do
        for PACKAGE in $APEX_PACKAGE_LIST; do
          if [ -f "$default_key_dir/$PACKAGE.pem" ] &&
          if [ -f "$default_key_dir/$PACKAGE.pem" ] &&
@@ -602,17 +567,11 @@ if [ -n "${BRANCH_NAME}" ] && [ -n "${DEVICE}" ]; then
      fi
      fi


      IMG_OUT=$OUT
      IMG_OUT=$OUT
      if [ "$android_version_major" -lt "12" ]; then
        IMG_OUT=obj/PACKAGING/target_files_intermediates/lineage_*/IMAGES
      fi


      # Move produced ZIP files to the main OUT directory
      # Move produced ZIP files to the main OUT directory
      echo ">> [$(date)] Moving build artifacts for ${DEVICE} to '$ZIP_DIR/$zipsubdir'"
      echo ">> [$(date)] Moving build artifacts for ${DEVICE} to '$ZIP_DIR/$zipsubdir'"
      cd "${OUT}" || return 1
      cd "${OUT}" || return 1
      for build in $(ls e-*.zip); do
      for build in $(ls e-*.zip); do
        if [ "$android_version_major" -lt "12" ]; then
          sha256sum "$build" >"$ZIP_DIR/$zipsubdir/$build.sha256sum"
        fi
        find . -maxdepth 1 \( -name 'e-*.zip*' -o -name 'IMG-e*.zip*' -o -name 'QFIL-e*.zip*' \) -type f -exec mv {} "$ZIP_DIR/$zipsubdir/" \;
        find . -maxdepth 1 \( -name 'e-*.zip*' -o -name 'IMG-e*.zip*' -o -name 'QFIL-e*.zip*' \) -type f -exec mv {} "$ZIP_DIR/$zipsubdir/" \;


        SKIP_DYNAMIC_IMAGES="odm.img product.img system.img system_ext.img vendor.img"
        SKIP_DYNAMIC_IMAGES="odm.img product.img system.img system_ext.img vendor.img"