From 9cfd01c83dadc5932c05462c617816715a1c98f7 Mon Sep 17 00:00:00 2001 From: Petros Paraskevopoulos Date: Thu, 20 Feb 2025 18:22:35 +0200 Subject: [PATCH] Android: Enhance manifest save, restore and diff with build variant --- bin/comment_with_manifest_diff | 20 +++++++++++--------- bin/restore_android_merged_manifest | 7 ++++--- bin/save_android_merged_manifest | 9 +++++---- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/bin/comment_with_manifest_diff b/bin/comment_with_manifest_diff index 52c257f0..6da98bff 100755 --- a/bin/comment_with_manifest_diff +++ b/bin/comment_with_manifest_diff @@ -5,10 +5,11 @@ # trunk version and the PR version to identify changes caused by updates to the project. # # Usage: -# ./comment_with_manifest_diff +# ./comment_with_manifest_diff # # Parameters: # : The project module whose manifest will be checked. +# : The build variant to inspect for manifest changes (e.g., "debug", "vanillaRelease). # # Steps: # 1. It copies the manifest reports for both the trunk and PR versions. @@ -20,20 +21,21 @@ # - The comment on the PR will include a detailed list of changes. # # Example: -# ./comment_with_manifest_diff app +# ./comment_with_manifest_diff app release # -# This will analyze the `app` module and post the result to the PR. +# This will analyze the `app` module on `release` build variant and post the result to the PR. set -euo pipefail MODULE="${1:-}" +BUILD_VARIANT="${2:-}" -ANDROID_MERGED_MANIFEST="${HOME}/.android/merged_manifest/${MODULE}" -TRUNK_MANIFEST_PATH="${ANDROID_MERGED_MANIFEST}/jalapenoDebug/processJalapenoDebugMainManifest/AndroidManifest.xml" -PR_MANIFEST_PATH="${MODULE}/build/intermediates/merged_manifest/jalapenoDebug/processJalapenoDebugMainManifest/AndroidManifest.xml" +ANDROID_MERGED_MANIFEST="${HOME}/.android/merged_manifest/${MODULE}_${BUILD_VARIANT}" +TRUNK_MANIFEST_PATH="${ANDROID_MERGED_MANIFEST}/AndroidManifest.xml" +PR_MANIFEST_PATH="${MODULE}/build/intermediates/merged_manifest/${BUILD_VARIANT}/process${BUILD_VARIANT^}MainManifest/AndroidManifest.xml" -if [ -z "$MODULE" ]; then - echo "Not enough arguments provided. Usage: ./comment_with_manifest_diff " +if [ -z "$MODULE" ] || [ -z "$BUILD_VARIANT" ]; then + echo "Not enough arguments provided. Usage: ./comment_with_manifest_diff " exit 1 fi @@ -60,7 +62,7 @@ diff -u "$TRUNK_MANIFEST_FILE" "$PR_MANIFEST_FILE" > "$DIFF_MANIFEST_FILE" || tr generate_manifest_comment_body() { cat <