|
| 1 | +#!/bin/bash |
| 2 | +##===----------------------------------------------------------------------===## |
| 3 | +## |
| 4 | +## This source file is part of the Swift Logging API open source project |
| 5 | +## |
| 6 | +## Copyright (c) 2019 Apple Inc. and the Swift Logging API project authors |
| 7 | +## Licensed under Apache License v2.0 |
| 8 | +## |
| 9 | +## See LICENSE.txt for license information |
| 10 | +## See CONTRIBUTORS.txt for the list of Swift Logging API project authors |
| 11 | +## |
| 12 | +## SPDX-License-Identifier: Apache-2.0 |
| 13 | +## |
| 14 | +##===----------------------------------------------------------------------===## |
| 15 | + |
| 16 | +##===----------------------------------------------------------------------===## |
| 17 | +## |
| 18 | +## This source file is part of the SwiftNIO open source project |
| 19 | +## |
| 20 | +## Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors |
| 21 | +## Licensed under Apache License v2.0 |
| 22 | +## |
| 23 | +## See LICENSE.txt for license information |
| 24 | +## See CONTRIBUTORS.txt for the list of SwiftNIO project authors |
| 25 | +## |
| 26 | +## SPDX-License-Identifier: Apache-2.0 |
| 27 | +## |
| 28 | +##===----------------------------------------------------------------------===## |
| 29 | + |
| 30 | +set -eu |
| 31 | + |
| 32 | +function usage() { |
| 33 | + echo "$0 [-u] version" |
| 34 | + echo |
| 35 | + echo "OPTIONS:" |
| 36 | + echo " -u: Additionally upload the podspec" |
| 37 | +} |
| 38 | + |
| 39 | +upload=false |
| 40 | +while getopts ":u" opt; do |
| 41 | + case $opt in |
| 42 | + u) |
| 43 | + upload=true |
| 44 | + ;; |
| 45 | + \?) |
| 46 | + usage |
| 47 | + exit 1 |
| 48 | + ;; |
| 49 | + esac |
| 50 | +done |
| 51 | +shift "$((OPTIND-1))" |
| 52 | + |
| 53 | +if [[ $# -eq 0 ]]; then |
| 54 | + echo "Must provide target version" |
| 55 | + exit 1 |
| 56 | +fi |
| 57 | + |
| 58 | +version=$1 |
| 59 | +podspec_name="Logging" |
| 60 | + |
| 61 | +here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
| 62 | +tmpdir=$(mktemp -d /tmp/.build_podspecsXXXXXX) |
| 63 | +echo "Building podspec in $tmpdir" |
| 64 | + |
| 65 | +cat > "${tmpdir}/${podspec_name}.podspec" <<- EOF |
| 66 | +Pod::Spec.new do |s| |
| 67 | + s.name = '$podspec_name' |
| 68 | + s.version = '$version' |
| 69 | + s.license = { :type => 'Apache 2.0', :file => 'LICENSE.txt' } |
| 70 | + s.summary = 'A Logging API for Swift.' |
| 71 | + s.homepage = 'https://github.com/apple/swift-log' |
| 72 | + s.author = 'Apple Inc.' |
| 73 | + s.source = { :git => 'https://github.com/apple/swift-log.git', :tag => s.version.to_s } |
| 74 | + s.documentation_url = 'https://apple.github.io/swift-log' |
| 75 | + s.module_name = 'Logging' |
| 76 | +
|
| 77 | + s.swift_version = '5.0' |
| 78 | + s.cocoapods_version = '>=1.6.0' |
| 79 | + s.ios.deployment_target = '8.0' |
| 80 | + s.osx.deployment_target = '10.9' |
| 81 | + s.tvos.deployment_target = '9.0' |
| 82 | + s.watchos.deployment_target = '2.0' |
| 83 | +
|
| 84 | + s.source_files = 'Sources/Logging/**/*.swift' |
| 85 | +end |
| 86 | +EOF |
| 87 | + |
| 88 | +if $upload; then |
| 89 | + echo "Uploading ${tmpdir}/${podspec_name}.podspec" |
| 90 | + pod trunk push "${tmpdir}/${podspec_name}.podspec" |
| 91 | +else |
| 92 | + echo "Linting ${tmpdir}/${podspec_name}.podspec" |
| 93 | + pod spec lint "${tmpdir}/${podspec_name}.podspec" |
| 94 | +fi |
0 commit comments