build_zip.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/bash
  2. # Copyright 2020 Google LLC
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. # http://www.apache.org/licenses/LICENSE-2.0
  7. # Unless required by applicable law or agreed to in writing, software
  8. # distributed under the License is distributed on an "AS IS" BASIS,
  9. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. # See the License for the specific language governing permissions and
  11. # limitations under the License.
  12. set -x
  13. REPO=`pwd`
  14. if [[ $# -lt 2 ]]; then
  15. cat 2>&2 <<EOF
  16. USAGE: $0 [output_directory]
  17. USAGE: $1 [custom-spec-repos]
  18. EOF
  19. exit 1
  20. fi
  21. # The release build won't generage Carthage distro if the curreent
  22. # PackageManifest version has already been released.
  23. carthage_version_check="--enable-carthage-version-check"
  24. # If there is a third option set, add options to build from head instead of
  25. # staging and/or trunk.
  26. if [[ $# -gt 2 ]]; then
  27. build_head_option="--local-podspec-path"
  28. build_head_value="$REPO"
  29. carthage_version_check="--disable-carthage-version-check"
  30. fi
  31. # The first and only argument to this script should be the name of the
  32. # output directory.
  33. OUTPUT_DIR="$REPO/$1"
  34. CUSTOM_SPEC_REPOS="$2"
  35. source_repo=()
  36. IFS=','
  37. read -a specrepo <<< "${CUSTOM_SPEC_REPOS}"
  38. cd ReleaseTooling
  39. swift run zip-builder --keep-build-artifacts --update-pod-repo \
  40. ${build_head_option} ${build_head_value} \
  41. --output-dir "${OUTPUT_DIR}" \
  42. "${carthage_version_check}" \
  43. --custom-spec-repos "${specrepo[@]}"