diff --git a/etc/jenkins/documentation/build_documentation.sh b/etc/jenkins/documentation/build_documentation.sh new file mode 100755 index 0000000000..691a2d1a30 --- /dev/null +++ b/etc/jenkins/documentation/build_documentation.sh @@ -0,0 +1,37 @@ +#!/bin/bash -lex + +# +# Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v. 2.0, which is available at +# http://www.eclipse.org/legal/epl-2.0. +# +# This Source Code may also be made available under the following Secondary +# Licenses when the conditions for such availability set forth in the +# Eclipse Public License v. 2.0 are satisfied: GNU General Public License, +# version 2 with the GNU Classpath Exception, which is available at +# https://www.gnu.org/software/classpath/license.html. +# +# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +# + +#Environment paths for Jenkins + +#TOOLS_PREFIX=/opt/tools +#JAVA_PREFIX=/opt/tools/java/oracle +#MVN_HOME=/opt/tools/apache-maven/latest +#JAVA_HOME=/opt/tools/java/oracle/jdk-8/latest +#PATH=/opt/tools/apache-maven/latest/bin:/opt/tools/java/oracle/jdk-8/latest/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + +# script shall be run before documentation generation to build jersey, site for jersey and docbook. Ideally it shall be run from Jenkins but +# if Jenkins does not provide required tools - java, maven, python, perl - to generate documentation the script can be run from local host. + +# IMPORTANT - modify environmen.sh before running the script. +source environment.sh + +mvn clean install -V -q -PtestsSkip,checkstyleSkip -Dtests.excluded '-Dmaven.test.skip=true' + +mvn clean site -V -q -PtestsSkip,checkstyleSkip -Dtests.excluded -Dtests.excluded -Djavadoc.stylesheet=etc/config/javadoc-stylesheet.css -Dmaven.test.skip=true -Ddependency.locations.enabled=false -Dbundles.excluded -Djersey.version=${RELEASE_VERSION} + +mvn clean install -V -q -e -U -B -f docs/pom.xml -Djersey.version=$RELEASE_VERSION \ No newline at end of file diff --git a/etc/jenkins/documentation/environment.sh b/etc/jenkins/documentation/environment.sh new file mode 100644 index 0000000000..51f8eec468 --- /dev/null +++ b/etc/jenkins/documentation/environment.sh @@ -0,0 +1,32 @@ +#!/bin/bash + +# +# Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v. 2.0, which is available at +# http://www.eclipse.org/legal/epl-2.0. +# +# This Source Code may also be made available under the following Secondary +# Licenses when the conditions for such availability set forth in the +# Eclipse Public License v. 2.0 are satisfied: GNU General Public License, +# version 2 with the GNU Classpath Exception, which is available at +# https://www.gnu.org/software/classpath/license.html. +# +# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +# + +#ALL main input parameters are collected here. Ideally these shall be set as input parameters for +#Jenkins job but if for some reason the script is being run from local host this file shall be used +#and mdified accordingly to provide correct intput data for the main script + +export RELEASE_VERSION='2.29.1' +export WEBSITE_URL='https://github.com/eclipse-ee4j/jersey.github.io' +export BRANCH_SPECIFIER='master' +export UPDATE_LATEST=true +export WEBSITE_SOURCE_REPO='https://github.com/eclipse-ee4j/jersey-web' +export WORKSPACE=`pwd` +export DRY_RUN=false + +export USER_NAME='' #ideally shall be taken from job's credentials but for local run it's user name +export USER_TOKEN='' #ideally shall be taken from job's credentials but for local run it's user password or token diff --git a/etc/jenkins/documentation/generate_documentation_after_build.sh b/etc/jenkins/documentation/generate_documentation_after_build.sh new file mode 100755 index 0000000000..fff1e8938b --- /dev/null +++ b/etc/jenkins/documentation/generate_documentation_after_build.sh @@ -0,0 +1,165 @@ +#!/bin/bash -lex + +# +# Copyright (c) 2019 Oracle and/or its affiliates. All rights reserved. +# +# This program and the accompanying materials are made available under the +# terms of the Eclipse Public License v. 2.0, which is available at +# http://www.eclipse.org/legal/epl-2.0. +# +# This Source Code may also be made available under the following Secondary +# Licenses when the conditions for such availability set forth in the +# Eclipse Public License v. 2.0 are satisfied: GNU General Public License, +# version 2 with the GNU Classpath Exception, which is available at +# https://www.gnu.org/software/classpath/license.html. +# +# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 +# + +#Environment paths for Jenkins + +#TOOLS_PREFIX=/opt/tools +#JAVA_PREFIX=/opt/tools/java/oracle +#MVN_HOME=/opt/tools/apache-maven/latest +#JAVA_HOME=/opt/tools/java/oracle/jdk-8/latest +#PATH=/opt/tools/apache-maven/latest/bin:/opt/tools/java/oracle/jdk-8/latest/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin + +# IMPORTANT - modify environmen.sh before running the script. +source environment.sh + +#Script REQUIRES Curl, Perl, Python, Git and Maven (3.6.0) to be installed on running host. +#Configures and moves documentation to proper locations, +#Generates release notes by milestone (same as version number) +#Moves release notes to proper location +#Sends release notes to GitHub (rest api) +#Commits all modifications to proper repositories (web and src-web) + + +DIRS="$RELEASE_VERSION" +if $UPDATE_LATEST; +then + DIRS="latest $DIRS" +fi + +#export PATH=/opt/csw/bin:$PATH +WEB_DIR=$WORKSPACE/target/jersey-web +WEB_SRC_DIR=$WORKSPACE/target/jersey-web-src + + +function copyDocs { + APIDOCS_DIR=$WEB_DIR/apidocs/$1 + DOCS_DIR=$WEB_DIR/documentation/$1 + + # + # API docs + # + if test ! -e $APIDOCS_DIR ; then + mkdir -p $APIDOCS_DIR + fi + cd $APIDOCS_DIR + + rm -rf jersey || true + cp -R $WORKSPACE/target/site/apidocs ./jersey + + # + # user guide + # + rm -rf $DOCS_DIR || true + mkdir -p $DOCS_DIR + cp -r $WORKSPACE/docs/target/docbook/index/* $DOCS_DIR + rm $DOCS_DIR/*.fo || true +} + +if test -e $WEB_DIR ; then + rm -rf $WEB_DIR +fi + +# would couse shallow reject: git clone --depth 1 $WEBSITE_URL $WEB_DIR +git clone $WEBSITE_URL $WEB_DIR +git clone $WEBSITE_SOURCE_REPO $WEB_SRC_DIR + +cd $WEB_DIR + +for dir in $DIRS; do + copyDocs $dir +done + +cd $WEB_DIR + +git config --local user.email "jersey-bot@eclipse.org" +git config --local user.name "jersey-bot" +git add -A . +git diff --cached --exit-code || git commit -m "[jenkins] automatic javadoc and documentation update [$RELEASE_VERSION @ $BRANCH_SPECIFIER]" + +# [1] update site +mvn versions:set -DnewVersion=$RELEASE_VERSION -DgenerateBackupPoms=false -f $WEB_SRC_DIR/pom.xml + +# [2] update scm.md +perl -0777 -i' ' -pe 's@(