Skip to content

Commit aba89a4

Browse files
authored
Merge pull request #273 from ashawley/api-docs
Publish API docs on GitHub pages
2 parents 02bed6e + d4a38aa commit aba89a4

File tree

2 files changed

+71
-1
lines changed

2 files changed

+71
-1
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Since Scala 2.11, this library is a separate jar that can be omitted from Scala
1212

1313
The decoupling works because the compiler desugars XML literals in Scala source code into a set of method calls. Alternative implementations of these calls are welcome! (The calls are unfortunately only defined by the [implementation](https://github.com/scala/scala/blob/2.11.x/src/compiler/scala/tools/nsc/ast/parser/SymbolicXMLBuilder.scala).)
1414

15-
API documentation is available [here](http://www.scala-lang.org/api/current/scala-xml/scala/xml/index.html).
15+
API documentation is available [here](https://scala.github.io/scala-xml/api/1.1.0/scala/xml/).
1616

1717
How to documentation is available in the [wiki](https://github.com/scala/scala-xml/wiki)
1818

admin/api-docs.sh

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/bin/bash
2+
3+
###
4+
# Copyright (C) 2019 LAMP/EPFL and Lightbend, Inc.
5+
#
6+
# Build API docs for scala-xml.
7+
#
8+
# Runs Scaladoc, then commits to the gh-pages branch, so they are
9+
# published to https://docs.scala-lang.org/scala-xml/api/1.0.0/
10+
#
11+
# Usage:
12+
# ./admin/api-docs.sh SCALA-XML-VERSION SCALA-VERSION
13+
#
14+
# SCALA-XML-VERSION is the scala-xml version, e.g. v1.0.5
15+
# SCALA-VERSION is the Scala version, e.g. 2.11.12
16+
#
17+
# Example:
18+
# ./admin/api-docs.sh v1.0.6 2.12.0
19+
#
20+
# Required dependencies:
21+
# - sbt 1.x
22+
# - git
23+
# - rsync
24+
##
25+
26+
set -e
27+
28+
if [ -z "$1" ]; then
29+
echo "Error: Missing scala-xml version" >&2
30+
exit 1
31+
elif [ -z "$2" ]; then
32+
echo "Error: Missing Scala version" >&2
33+
exit 1
34+
fi
35+
36+
SCALA_XML_VERSION=${1%%#*} # Cleanup tags, e.g. v1.1.1#2.13.0-M5#8
37+
SCALA_VERSION=$2
38+
39+
TARGET_DIR=${TARGET_DIR-./jvm/target}
40+
API_DIR=$TARGET_DIR/scala-${SCALA_VERSION%.*}/api
41+
GIT_DIR=${GIT_DIR-./jvm/target}
42+
DOC_DIR=$GIT_DIR/api/${SCALA_XML_VERSION#v}
43+
44+
git checkout $SCALA_XML_VERSION
45+
sbt "++$SCALA_VERSION" doc
46+
mkdir $GIT_DIR/api
47+
rsync -a $API_DIR/ $DOC_DIR/
48+
echo "Initializing git directory in $GIT_DIR"
49+
cd $GIT_DIR
50+
git init
51+
git remote add upstream [email protected]:scala/scala-xml.git
52+
git fetch upstream gh-pages
53+
git checkout gh-pages
54+
git add -A ./api
55+
git commit -m"Scaladoc for $SCALA_XML_VERSION with Scala $SCALA_VERSION"
56+
echo "Please review the commit in $GIT_DIR and push upstream"
57+
58+
exit 0
59+
## End of script
60+
61+
## Rebuild the universe with:
62+
63+
env JAVA_HOME=$(/usr/libexec/java_home -v 1.6) TARGET_DIR=./target ./admin/api-docs.sh v1.0.1 2.11.12
64+
env JAVA_HOME=$(/usr/libexec/java_home -v 1.6) TARGET_DIR=./target ./admin/api-docs.sh v1.0.2 2.11.12
65+
env JAVA_HOME=$(/usr/libexec/java_home -v 1.6) TARGET_DIR=./target ./admin/api-docs.sh v1.0.3 2.11.12
66+
env JAVA_HOME=$(/usr/libexec/java_home -v 1.6) TARGET_DIR=./target ./admin/api-docs.sh v1.0.4 2.11.12
67+
env JAVA_HOME=$(/usr/libexec/java_home -v 1.6) TARGET_DIR=./target ./admin/api-docs.sh v1.0.5 2.11.12
68+
env JAVA_HOME=$(/usr/libexec/java_home -v 1.8) TARGET_DIR=./target ./admin/api-docs.sh v1.0.6 2.12.0
69+
env JAVA_HOME=$(/usr/libexec/java_home -v 1.8) ./admin/api-docs.sh v1.1.0 2.12.4
70+
env JAVA_HOME=$(/usr/libexec/java_home -v 1.8) ./admin/api-docs.sh v1.1.1 2.12.6

0 commit comments

Comments
 (0)