update doc generation script (#103)

motivation: source-kitten has changed how its invoked

changes:
* invoke source-kitten with the correct flags
* make location of source-kitten source checkout more robust
* udpate docker to install jazzy on on focal
This commit is contained in:
tomer doron 2021-12-16 15:17:27 -08:00 committed by GitHub
parent 992b87907d
commit 495aca6d51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 7 deletions

View File

@ -18,10 +18,9 @@ RUN apt-get update && apt-get install -y lsof dnsutils netcat-openbsd net-tools
# ruby and jazzy for docs generation # ruby and jazzy for docs generation
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
# switch of gem docs building
RUN echo "gem: --no-document" > ~/.gemrc
# jazzy no longer works on xenial as ruby is too old. # jazzy no longer works on xenial as ruby is too old.
RUN if [ "${ubuntu_version}" != "xenial" ] ; then gem install jazzy; fi 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

View File

@ -26,20 +26,20 @@ if [[ "$(uname -s)" == "Linux" ]]; then
swift build swift build
fi fi
# setup source-kitten if required # setup source-kitten if required
source_kitten_source_path="$root_path/.SourceKitten" mkdir -p "$root_path/.build/sourcekitten"
source_kitten_source_path="$root_path/.build/sourcekitten/source"
if [[ ! -d "$source_kitten_source_path" ]]; then if [[ ! -d "$source_kitten_source_path" ]]; then
git clone https://github.com/jpsim/SourceKitten.git "$source_kitten_source_path" git clone https://github.com/jpsim/SourceKitten.git "$source_kitten_source_path"
fi fi
source_kitten_path="$source_kitten_source_path/.build/x86_64-unknown-linux/debug" source_kitten_path="$source_kitten_source_path/.build/debug"
if [[ ! -d "$source_kitten_path" ]]; then if [[ ! -d "$source_kitten_path" ]]; then
rm -rf "$source_kitten_source_path/.swift-version" rm -rf "$source_kitten_source_path/.swift-version"
cd "$source_kitten_source_path" && swift build && cd "$root_path" cd "$source_kitten_source_path" && swift build && cd "$root_path"
fi fi
# generate # generate
mkdir -p "$root_path/.build/sourcekitten"
for module in "${modules[@]}"; do for module in "${modules[@]}"; do
if [[ ! -f "$root_path/.build/sourcekitten/$module.json" ]]; then if [[ ! -f "$root_path/.build/sourcekitten/$module.json" ]]; then
"$source_kitten_path/sourcekitten" doc --spm-module $module > "$root_path/.build/sourcekitten/$module.json" "$source_kitten_path/sourcekitten" doc --spm --module-name $module > "$root_path/.build/sourcekitten/$module.json"
fi fi
done done
fi fi