1+ #! /usr/bin/env bash
12#
23# Copyright 2012-2018 The Feign Authors
34#
@@ -73,8 +74,12 @@ check_release_tag() {
7374 fi
7475}
7576
77+ print_project_version () {
78+ ./mvnw help:evaluate -N -Dexpression=project.version| sed -n ' /^[0-9]/p'
79+ }
80+
7681is_release_commit () {
77- project_version=$( ./mvnw help:evaluate -N -Dexpression=project.version | sed -n ' /^[0-9]/p ' )
82+ project_version=" $( print_project_version ) "
7883 if [[ " $project_version " =~ ^[[:digit:]]+\. [[:digit:]]+\. [[:digit:]]+$ ]]; then
7984 echo " Build started by release commit $project_version . Will synchronize to maven central."
8085 return 0
@@ -101,6 +106,49 @@ safe_checkout_master() {
101106 fi
102107}
103108
109+ javadoc_to_gh_pages () {
110+ version=" $( print_project_version) "
111+ rm -rf javadoc-builddir
112+ builddir=" javadoc-builddir/$version "
113+
114+ # Collect javadoc for all modules
115+ for jar in $( find . -name " *${version} -javadoc.jar" ) ; do
116+ module=" $( echo " $jar " | sed " s~.*/\(.*\)-${version} -javadoc.jar~\1~" ) "
117+ this_builddir=" $builddir /$module "
118+ if [ -d " $this_builddir " ]; then
119+ # Skip modules we've already processed.
120+ # We may find multiple instances of the same javadoc jar because of, for instance,
121+ # integration tests copying jars around.
122+ continue
123+ fi
124+ mkdir -p " $this_builddir "
125+ unzip " $jar " -d " $this_builddir "
126+ # Build a simple module-level index
127+ echo " <li><a href=\" ${module} /index.html\" >${module} </a></li>" >> " ${builddir} /index.html"
128+ done
129+
130+ # Update gh-pages
131+ git fetch origin gh-pages:gh-pages
132+ git checkout gh-pages
133+ rm -rf " $version "
134+ mv " javadoc-builddir/$version " ./
135+ rm -rf " javadoc-builddir"
136+
137+ # Update simple version-level index
138+ if ! grep " $version " index.html 2> /dev/null; then
139+ echo " <li><a href=\" ${version} /index.html\" >${version} </a></li>" >> index.html
140+ fi
141+
142+ # Ensure links are ordered by versions, latest on top
143+ sort -rV index.html > index.html.sorted
144+ mv index.html.sorted index.html
145+
146+ git add " $version "
147+ git add index.html
148+ git commit -m " Automatically updated javadocs for $version "
149+ git push origin gh-pages
150+ }
151+
104152# ----------------------
105153# MAIN
106154# ----------------------
@@ -110,24 +158,27 @@ if ! is_pull_request && build_started_by_tag; then
110158 check_release_tag
111159fi
112160
113- ./mvnw install -nsu
161+ # skip license on travis due to #1512
162+ ./mvnw install -nsu -Dlicense.skip=true
114163
115164# If we are on a pull request, our only job is to run tests, which happened above via ./mvnw install
116165if is_pull_request; then
117166 true
167+
118168# If we are on master, we will deploy the latest snapshot or release version
119169# - If a release commit fails to deploy for a transient reason, delete the broken version from bintray and click rebuild
120170elif is_travis_branch_master; then
121- ./mvnw --batch-mode -s ./.settings.xml -Prelease -nsu -DskipTests deploy
171+ ./mvnw --batch-mode -s ./.settings.xml -Prelease -nsu -pl -:benchmark - DskipTests deploy
122172
123173 # If the deployment succeeded, sync it to Maven Central. Note: this needs to be done once per project, not module, hence -N
124174 if is_release_commit; then
125175 ./mvnw --batch-mode -s ./.settings.xml -nsu -N io.zipkin.centralsync-maven-plugin:centralsync-maven-plugin:sync
176+ javadoc_to_gh_pages
126177 fi
127178
128179# If we are on a release tag, the following will update any version references and push a version tag for deployment.
129180elif build_started_by_tag; then
130181 safe_checkout_master
131- ./mvnw --batch-mode -s ./.settings.xml -Prelease -nsu -DreleaseVersion=" $( release_version) " -Darguments=" -DskipTests" release:prepare
182+ # skip license on travis due to #1512
183+ ./mvnw --batch-mode -s ./.settings.xml -Prelease -nsu -DreleaseVersion=" $( release_version) " -Darguments=" -DskipTests -Dlicense.skip=true" release:prepare
132184fi
133-
0 commit comments