From 01977217a6fa56a5e587468165555ccbd31f2b8b Mon Sep 17 00:00:00 2001 From: Jihoon Kang Date: Thu, 17 Oct 2024 00:05:13 +0000 Subject: Modify disabled flags to be exposed in keep-flagged-apis Currently, keep-flagged-apis filters flags that are disabled (so that the apis associated with the disabled flags are not exposed in the "exportable" stubs), but sdk_with_runtime_apis product builds require disabled flagged apis to be exposed. Filtering of the flags should be done by aconfig, and keep-flagged-apis should only convert the list of flags to the metalava-consumable format. Test: lunch sdk_with_runtime_apis-trunk_staging-eng && m sdk dist and observe outputs Bug: 371248797 Change-Id: If1622a6b81bc69a99e8f89c60a11ebec7899b95b --- scripts/keep-flagged-apis.sh | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) (limited to 'scripts') diff --git a/scripts/keep-flagged-apis.sh b/scripts/keep-flagged-apis.sh index 9c48fdbad..48efb7a29 100755 --- a/scripts/keep-flagged-apis.sh +++ b/scripts/keep-flagged-apis.sh @@ -25,21 +25,12 @@ FLAGGED="android.annotation.FlaggedApi" # Convert the list of feature flags in the input file to Metalava options # of the form `--revert-annotation !android.annotation.FlaggedApi("")` # to prevent the annotated APIs from being hidden, i.e. include the annotated -# APIs in the SDK snapshots. This also preserves the line comments, they will -# be ignored by Metalava but might be useful when debugging. +# APIs in the SDK snapshots. while read -r line; do - key=$(echo "$line" | cut -d= -f1) - value=$(echo "$line" | cut -d= -f2) - - # Skip if value is not true and line does not start with '#' - if [[ ( $value != "true" ) && ( $line =~ ^[^#] )]]; then - continue - fi - # Escape and quote the key for sed - escaped_key=$(echo "$key" | sed "s/'/\\\'/g; s/ /\\ /g") + escaped_line=$(echo "$line" | sed "s/'/\\\'/g; s/ /\\ /g") - echo $line | sed "s|^[^#].*$|--revert-annotation '!$FLAGGED(\"$escaped_key\")'|" + echo "--revert-annotation '!$FLAGGED(\"$escaped_line\")'" done < "$FLAGS" # Revert all flagged APIs, unless listed above. -- cgit v1.2.3-59-g8ed1b