1 #!/bin/bash 2 # 3 # Copyright 2016 The Bazel Authors. All rights reserved. 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 set -eu 17 18 out="$(mktemp)" 19 if ! "devtools/blaze/singlejar/singlejar" --output "${out}" --check_desugar_deps --sources "$@"; then 20 rm "${out}" 21 case "$0" in 22 *_fail_test) echo "Singlejar failed as expected!"; exit 0;; 23 esac 24 echo "Singlejar unexpectedly failed" 25 exit 1 26 fi 27 28 case "$0" in 29 *_fail_test) rm "${out}"; echo "Singlejar unexpectedly succeeded :("; exit 1;; 30 esac 31 32 if third_party/java/jdk/jar/jar tf "${out}" | grep 'desugar_deps'; then 33 rm "${out}" 34 echo "Singlejar output unexpectedly contains desugaring metadata" 35 exit 2 36 fi # else grep didn't find anything -> pass 37 rm "${out}" 38 exit 0 39