diff options
author | Ted Xie <tedx@google.com> | 2024-04-09 08:22:14 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2024-04-09 08:22:56 -0700 |
commit | 609b993429b85eb88ffa08e03eefbcd5038475c6 (patch) | |
tree | 5ea92a714dff5845b5cedc9509caca69b82963b8 | |
parent | 65eb82ba971186d8758262b248dfa51db7891ea9 (diff) | |
download | bazelbuild-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-x | tools/android/d8_desugar.sh | 13 |
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 |