aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Xie <tedx@google.com>2024-04-09 08:22:14 -0700
committerCopybara-Service <copybara-worker@google.com>2024-04-09 08:22:56 -0700
commit609b993429b85eb88ffa08e03eefbcd5038475c6 (patch)
tree5ea92a714dff5845b5cedc9509caca69b82963b8
parent65eb82ba971186d8758262b248dfa51db7891ea9 (diff)
downloadbazelbuild-rules_android-609b993429b85eb88ffa08e03eefbcd5038475c6.tar.gz
Conditionally pass DESUGAR_CONFIG to desugarer command line
In the near future, we'll remove d8_desugar.sh's custom passing of --desugared_lib_config and hoist that flag handling to the rule implementations. PiperOrigin-RevId: 623173738 Change-Id: Ic0eb12802bb04ad11a40753c826e9df9bf30cafa
-rwxr-xr-xtools/android/d8_desugar.sh13
1 files changed, 10 insertions, 3 deletions
diff --git a/tools/android/d8_desugar.sh b/tools/android/d8_desugar.sh
index f785b19..b44f7c3 100755
--- a/tools/android/d8_desugar.sh
+++ b/tools/android/d8_desugar.sh
@@ -49,9 +49,16 @@ if [[ "$#" -gt 0 ]]; then
@*)
params="${TMPDIR}/desugar.params"
cat "${arg:1}" > "${params}" # cp would create file readonly
- for o in "${DESUGAR_CONFIG[@]}"; do
- echo "${o}" >> "${params}"
- done
+
+ # If --desugared_lib_config already in params file, don't add it again.
+ set +e
+ has_desugared_lib_config=$(grep -c "\-\-desugared_lib_config" "$params")
+ set -e
+ if [[ "$has_desugared_lib_config" == 0 ]]; then
+ for o in "${DESUGAR_CONFIG[@]}"; do
+ echo "${o}" >> "${params}"
+ done
+ fi
"$DESUGAR_BINARY" \
"@${params}"
# temp dir deleted by TRAP installed above