Skip to content

Instantly share code, notes, and snippets.

@BelooS
Last active October 14, 2022 21:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BelooS/3a36a5f2130a0a6357641aebc360b3f9 to your computer and use it in GitHub Desktop.
Save BelooS/3a36a5f2130a0a6357641aebc360b3f9 to your computer and use it in GitHub Desktop.
persist manifest
#!/bin/bash
set -eo pipefail
#extract_manifest.sh {TARGET_APP_NAME} {BUILD_TYPE}
#launch example: ./ci/extract_manifest.sh app debug
TARGET_APP_NAME=$1
BUILD_TYPE=$2
echo "extract manifest for $TARGET_APP_NAME"
build_dir="$WORKSPACE/$TARGET_APP_NAME/build"
source_file="$build_dir/intermediates/merged_manifest/$BUILD_TYPE/AndroidManifest.xml"
source_log_file="$build_dir/outputs/logs/manifest-merger-$BUILD_TYPE-report.txt"
manifest_target_dir="$MANIFESTS_WORKSPACE_DIR/$BUILD_TYPE/$TARGET_APP_NAME"
mkdir -p "$manifest_target_dir"
cp "$source_log_file" "$manifest_target_dir" || echo "Failed to copy manifest log for $TARGET_APP_NAME"
cp "$source_file" "$manifest_target_dir" || echo "Failed to copy manifest for $TARGET_APP_NAME"
export TARGET_MANIFEST_PATH=$source_file
export SORTED_MANIFEST_PATH="$manifest_target_dir/AndroidManifest-sorted.xml"
function failedManifestSorting {
echo "Failed to sort&copy manifest for $TARGET_APP_NAME"
exit 1
}
#sort and store copy of manifest to $SORTED_MANIFEST_PATH
python3 ./sort_manifest.py || failedManifestSorting
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment