|
| 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