mirror of
https://github.com/apple/swift-nio-http2
synced 2026-11-29 05:24:22 +00:00
Update build_podspec and added SwiftNIOHPACK Dependency (#185)
Co-authored-by: Jake Prickett <jpricke1@ford.com>
This commit is contained in:
1 parent
a8550db895
commit
0c7d697b5f
3 files changed
+138
-14
No files matched your search
+47
-13
@@ -16,18 +16,23 @@
|
||||
set -eu
|
||||
|
||||
function usage() {
|
||||
echo "$0 [-u] version"
|
||||
echo "$0 [-u] version nio_version"
|
||||
echo
|
||||
echo "OPTIONS:"
|
||||
echo " -u: Additionally upload the podspec"
|
||||
echo " -f: Skip over all targets before the specified target"
|
||||
}
|
||||
|
||||
upload=false
|
||||
skip_until=""
|
||||
while getopts ":u" opt; do
|
||||
case $opt in
|
||||
u)
|
||||
upload=true
|
||||
;;
|
||||
f)
|
||||
skip_until="$OPTARG"
|
||||
;;
|
||||
\?)
|
||||
usage
|
||||
exit 1
|
||||
@@ -42,15 +47,43 @@ if [[ $# -eq 0 ]]; then
|
||||
fi
|
||||
|
||||
version=$1
|
||||
name="SwiftNIOHTTP2"
|
||||
|
||||
# Current SwiftNIO Version to add as dependency in the .podspec
|
||||
nio_version=$2
|
||||
newline=$'\n'
|
||||
|
||||
here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
tmpdir=$(mktemp -d /tmp/.build_podspecsXXXXXX)
|
||||
|
||||
echo "Building podspec in $tmpdir"
|
||||
|
||||
cat > "${tmpdir}/${name}.podspec" <<- EOF
|
||||
# We only want to generate Podspec files for the two targets
|
||||
targets=( "SwiftNIOHPACK" "SwiftNIOHTTP2" )
|
||||
|
||||
for target in "${targets[@]}"; do
|
||||
|
||||
if [[ -n "$skip_until" && "$target" != "$skip_until" ]]; then
|
||||
echo "Skipping $target"
|
||||
continue
|
||||
elif [[ "$skip_until" == "$target" ]]; then
|
||||
skip_until=""
|
||||
fi
|
||||
|
||||
echo "Building podspec for $target"
|
||||
|
||||
dependencies=()
|
||||
|
||||
while read -r raw_dependency; do
|
||||
if [ "$raw_dependency" == "SwiftNIOHPACK" ]; then
|
||||
dependencies+=( "${newline} s.dependency '$raw_dependency', s.version.to_s" )
|
||||
else
|
||||
dependencies+=( "${newline} s.dependency '$raw_dependency', '$nio_version'" )
|
||||
fi
|
||||
done < <("${here}/list_topsorted_dependencies.sh" -d "${target#Swift}" | sed 's/^NIO/SwiftNIO/')
|
||||
|
||||
cat > "${tmpdir}/${target}.podspec" <<- EOF
|
||||
Pod::Spec.new do |s|
|
||||
s.name = '$name'
|
||||
s.name = '$target'
|
||||
s.version = '$version'
|
||||
s.license = { :type => 'Apache 2.0', :file => 'LICENSE.txt' }
|
||||
s.summary = 'Useful code around SwiftNIO.'
|
||||
@@ -58,22 +91,23 @@ Pod::Spec.new do |s|
|
||||
s.author = 'Apple Inc.'
|
||||
s.source = { :git => 'https://github.com/apple/swift-nio-http2.git', :tag => s.version.to_s }
|
||||
s.documentation_url = 'https://apple.github.io/swift-nio-http2/'
|
||||
s.module_name = 'NIOHTTP2'
|
||||
s.module_name = '${target#Swift}'
|
||||
|
||||
s.swift_version = '5.0'
|
||||
s.cocoapods_version = '>=1.6.0'
|
||||
s.ios.deployment_target = '10.0'
|
||||
s.osx.deployment_target = '10.12'
|
||||
s.tvos.deployment_target = '10.0'
|
||||
s.dependency 'SwiftNIO', '~> 2.0.0'
|
||||
|
||||
s.source_files = 'Sources/NIOHTTP2/**/*.swift'
|
||||
s.source_files = 'Sources/${target#Swift}/**/*.{swift,c,h}'
|
||||
${dependencies[*]-}
|
||||
end
|
||||
EOF
|
||||
|
||||
if $upload; then
|
||||
echo "Uploading ${tmpdir}/${name}.podspec"
|
||||
pod trunk push "${tmpdir}/${name}.podspec"
|
||||
else
|
||||
echo "Generated podspec available at ${tmpdir}/${name}.podspec"
|
||||
fi
|
||||
pod repo update # last chance of getting the latest versions of previous pushed pods
|
||||
if $upload; then
|
||||
echo "Uploading ${tmpdir}/${target}.podspec"
|
||||
pod trunk push "${tmpdir}/${target}.podspec"
|
||||
fi
|
||||
|
||||
done
|
||||
Reference in new issue
Block a user