mirror of
https://github.com/apple/swift-nio-extras.git
synced 2025-05-14 17:02:43 +08:00
Remove Jazzy doc generation
Motivation: Docs are generated by and hosted on the Swift Package Index. We no longer need the script to generate docs via Jazzy. Modifications: - Remove the generate_docs script - Remove Jazzy from the Dockerfile but keep Ruby; it's used for generating test manifests. - Remove SwiftFormat from the Dockerfile; we don't use it. Result: Fewer unused things.
This commit is contained in:
parent
e4efedbf47
commit
b5af9273f6
@ -17,19 +17,9 @@ RUN apt-get update && apt-get install -y wget
|
|||||||
RUN apt-get update && apt-get install -y lsof dnsutils netcat-openbsd net-tools curl jq # used by integration tests
|
RUN apt-get update && apt-get install -y lsof dnsutils netcat-openbsd net-tools curl jq # used by integration tests
|
||||||
RUN apt-get update && apt-get install -y zlib1g-dev
|
RUN apt-get update && apt-get install -y zlib1g-dev
|
||||||
|
|
||||||
# ruby and jazzy for docs generation
|
# ruby for soundness
|
||||||
RUN apt-get update && apt-get install -y ruby ruby-dev libsqlite3-dev build-essential
|
RUN apt-get update && apt-get install -y ruby ruby-dev libsqlite3-dev build-essential
|
||||||
# jazzy no longer works on xenial as ruby is too old.
|
|
||||||
RUN if [ "${ubuntu_version}" = "focal" ] ; then echo "gem: --no-document" > ~/.gemrc ; fi
|
|
||||||
RUN if [ "${ubuntu_version}" = "focal" ] ; then gem install jazzy ; fi
|
|
||||||
|
|
||||||
# tools
|
# tools
|
||||||
RUN mkdir -p $HOME/.tools
|
RUN mkdir -p $HOME/.tools
|
||||||
RUN echo 'export PATH="$HOME/.tools:$PATH"' >> $HOME/.profile
|
RUN echo 'export PATH="$HOME/.tools:$PATH"' >> $HOME/.profile
|
||||||
|
|
||||||
# swiftformat (until part of the toolchain)
|
|
||||||
|
|
||||||
ARG swiftformat_version=0.40.12
|
|
||||||
RUN git clone --branch $swiftformat_version --depth 1 https://github.com/nicklockwood/SwiftFormat $HOME/.tools/swift-format
|
|
||||||
RUN cd $HOME/.tools/swift-format && swift build -c release
|
|
||||||
RUN ln -s $HOME/.tools/swift-format/.build/release/swiftformat $HOME/.tools/swiftformat
|
|
||||||
|
@ -1,120 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
##===----------------------------------------------------------------------===##
|
|
||||||
##
|
|
||||||
## This source file is part of the SwiftNIO open source project
|
|
||||||
##
|
|
||||||
## Copyright (c) 2017-2018 Apple Inc. and the SwiftNIO project authors
|
|
||||||
## Licensed under Apache License v2.0
|
|
||||||
##
|
|
||||||
## See LICENSE.txt for license information
|
|
||||||
## See CONTRIBUTORS.txt for the list of SwiftNIO project authors
|
|
||||||
##
|
|
||||||
## SPDX-License-Identifier: Apache-2.0
|
|
||||||
##
|
|
||||||
##===----------------------------------------------------------------------===##
|
|
||||||
|
|
||||||
set -e
|
|
||||||
|
|
||||||
my_path="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
root_path="$my_path/.."
|
|
||||||
version=$(git describe --abbrev=0 --tags || echo "0.0.0")
|
|
||||||
modules=(NIOExtras NIOHTTPCompression NIOSOCKS)
|
|
||||||
|
|
||||||
if [[ "$(uname -s)" == "Linux" ]]; then
|
|
||||||
# build code if required
|
|
||||||
if [[ ! -d "$root_path/.build/x86_64-unknown-linux" ]]; then
|
|
||||||
swift build
|
|
||||||
fi
|
|
||||||
# setup source-kitten if required
|
|
||||||
mkdir -p "$root_path/.build/sourcekitten"
|
|
||||||
source_kitten_source_path="$root_path/.build/sourcekitten/source"
|
|
||||||
if [[ ! -d "$source_kitten_source_path" ]]; then
|
|
||||||
git clone https://github.com/jpsim/SourceKitten.git "$source_kitten_source_path"
|
|
||||||
fi
|
|
||||||
source_kitten_path="$source_kitten_source_path/.build/debug"
|
|
||||||
if [[ ! -d "$source_kitten_path" ]]; then
|
|
||||||
rm -rf "$source_kitten_source_path/.swift-version"
|
|
||||||
cd "$source_kitten_source_path" && swift build && cd "$root_path"
|
|
||||||
fi
|
|
||||||
# generate
|
|
||||||
for module in "${modules[@]}"; do
|
|
||||||
if [[ ! -f "$root_path/.build/sourcekitten/$module.json" ]]; then
|
|
||||||
"$source_kitten_path/sourcekitten" doc --spm --module-name $module > "$root_path/.build/sourcekitten/$module.json"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
[[ -d docs/$version ]] || mkdir -p docs/$version
|
|
||||||
[[ -d swift-nio-extras.xcodeproj ]] || swift package generate-xcodeproj
|
|
||||||
|
|
||||||
# run jazzy
|
|
||||||
if ! command -v jazzy > /dev/null; then
|
|
||||||
gem install jazzy --no-ri --no-rdoc
|
|
||||||
fi
|
|
||||||
|
|
||||||
jazzy_dir="$root_path/.build/jazzy"
|
|
||||||
rm -rf "$jazzy_dir"
|
|
||||||
mkdir -p "$jazzy_dir"
|
|
||||||
|
|
||||||
module_switcher="$jazzy_dir/README.md"
|
|
||||||
jazzy_args=(--clean
|
|
||||||
--author 'swift-nio team'
|
|
||||||
--readme "$module_switcher"
|
|
||||||
--author_url https://github.com/apple/swift-nio-extras
|
|
||||||
--github_url https://github.com/apple/swift-nio-extras
|
|
||||||
--theme fullwidth
|
|
||||||
--xcodebuild-arguments -scheme,swift-nio-extras-Package)
|
|
||||||
cat > "$module_switcher" <<"EOF"
|
|
||||||
# swift-nio-extras Docs
|
|
||||||
|
|
||||||
swift-nio-extras is a good place for code that is related to NIO but not core.
|
|
||||||
It can also be used to incubate APIs for tasks that are possible with core-NIO but are cumbersome today.
|
|
||||||
|
|
||||||
swift-nio-extras contains multiple modules:
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
For the API documentation of the other repositories in the SwiftNIO family check:
|
|
||||||
|
|
||||||
- [`swift-nio` API docs](https://apple.github.io/swift-nio)
|
|
||||||
- [`swift-nio-ssl` API docs](https://apple.github.io/swift-nio-ssl)
|
|
||||||
- [`swift-nio-http2` API docs](https://apple.github.io/swift-nio-http2)
|
|
||||||
- [`swift-nio-extras` API docs](https://apple.github.io/swift-nio-extras/docs/current/NIOExtras/index.html)
|
|
||||||
|
|
||||||
EOF
|
|
||||||
|
|
||||||
for module in "${modules[@]}"; do
|
|
||||||
args=("${jazzy_args[@]}" --output "$jazzy_dir/docs/$version/$module" --docset-path "$jazzy_dir/docset/$version/$module"
|
|
||||||
--module "$module" --module-version $version
|
|
||||||
--root-url "https://apple.github.io/swift-nio-extras/docs/$version/$module/")
|
|
||||||
if [[ -f "$root_path/.build/sourcekitten/$module.json" ]]; then
|
|
||||||
args+=(--sourcekitten-sourcefile "$root_path/.build/sourcekitten/$module.json")
|
|
||||||
fi
|
|
||||||
jazzy "${args[@]}"
|
|
||||||
done
|
|
||||||
|
|
||||||
# push to github pages
|
|
||||||
if [[ $PUSH == true ]]; then
|
|
||||||
BRANCH_NAME=$(git rev-parse --abbrev-ref HEAD)
|
|
||||||
GIT_AUTHOR=$(git --no-pager show -s --format='%an <%ae>' HEAD)
|
|
||||||
git fetch origin +gh-pages:gh-pages
|
|
||||||
git checkout gh-pages
|
|
||||||
rm -rf "docs/$version"
|
|
||||||
rm -rf "docs/current"
|
|
||||||
cp -r "$jazzy_dir/docs/$version" docs/
|
|
||||||
cp -r "docs/$version" docs/current
|
|
||||||
git add --all docs
|
|
||||||
echo '<html><head><meta http-equiv="refresh" content="0; url=docs/current/NIOExtras/index.html" /></head></html>' > index.html
|
|
||||||
git add index.html
|
|
||||||
touch .nojekyll
|
|
||||||
git add .nojekyll
|
|
||||||
changes=$(git diff-index --name-only HEAD)
|
|
||||||
if [[ -n "$changes" ]]; then
|
|
||||||
echo -e "changes detected\n$changes"
|
|
||||||
git commit --author="$GIT_AUTHOR" -m "publish $version docs"
|
|
||||||
git push origin gh-pages
|
|
||||||
else
|
|
||||||
echo "no changes detected"
|
|
||||||
fi
|
|
||||||
git checkout -f $BRANCH_NAME
|
|
||||||
fi
|
|
Loading…
x
Reference in New Issue
Block a user