Romain Grecourt | f7e3a48 | 2018-11-20 00:47:09 -0800 | [diff] [blame] | 1 | #!/bin/bash -e |
| 2 | # |
| 3 | # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. |
| 4 | # |
| 5 | # Copyright (c) 2018 Oracle and/or its affiliates. All rights reserved. |
| 6 | # |
| 7 | # The contents of this file are subject to the terms of either the GNU |
| 8 | # General Public License Version 2 only ("GPL") or the Common Development |
| 9 | # and Distribution License("CDDL") (collectively, the "License"). You |
| 10 | # may not use this file except in compliance with the License. You can |
| 11 | # obtain a copy of the License at |
| 12 | # https://oss.oracle.com/licenses/CDDL+GPL-1.1 |
| 13 | # or LICENSE.txt. See the License for the specific |
| 14 | # language governing permissions and limitations under the License. |
| 15 | # |
| 16 | # When distributing the software, include this License Header Notice in each |
| 17 | # file and include the License file at LICENSE.txt. |
| 18 | # |
| 19 | # GPL Classpath Exception: |
| 20 | # Oracle designates this particular file as subject to the "Classpath" |
| 21 | # exception as provided by Oracle in the GPL Version 2 section of the License |
| 22 | # file that accompanied this code. |
| 23 | # |
| 24 | # Modifications: |
| 25 | # If applicable, add the following below the License Header, with the fields |
| 26 | # enclosed by brackets [] replaced by your own identifying information: |
| 27 | # "Portions Copyright [year] [name of copyright owner]" |
| 28 | # |
| 29 | # Contributor(s): |
| 30 | # If you wish your version of this file to be governed by only the CDDL or |
| 31 | # only the GPL Version 2, indicate your decision by adding "[Contributor] |
| 32 | # elects to include this software in this distribution under the [CDDL or GPL |
| 33 | # Version 2] license." If you don't indicate a single choice of license, a |
| 34 | # recipient has the option to distribute your version of this file under |
| 35 | # either the CDDL, the GPL Version 2 or to extend the choice of license to |
| 36 | # its licensees as provided above. However, if you add GPL Version 2 code |
| 37 | # and therefore, elected the GPL Version 2 license, then the option applies |
| 38 | # only if the new code is made subject to such option by the copyright |
| 39 | # holder. |
| 40 | # |
| 41 | |
| 42 | merge_junits(){ |
| 43 | local test_id="build-unit-tests" |
| 44 | rm -rf ${WORKSPACE}/test-results && \ |
| 45 | mkdir -p ${WORKSPACE}/test-results/${test_id}/results/junitreports |
| 46 | local jud="${WORKSPACE}/test-results/${test_id}/results/junitreports/test_results_junit.xml" |
| 47 | echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" > ${jud} |
| 48 | echo "<testsuites>" >> ${jud} |
| 49 | for i in `find . -type d -name "surefire-reports"` |
David Matějček | f4dc06a | 2021-05-17 12:10:57 +0200 | [diff] [blame] | 50 | do |
Romain Grecourt | f7e3a48 | 2018-11-20 00:47:09 -0800 | [diff] [blame] | 51 | ls -d -1 ${i}/*.xml | xargs cat | sed 's/<?xml version=\"1.0\" encoding=\"UTF-8\" *?>//g' >> ${jud} |
| 52 | done |
| 53 | echo "</testsuites>" >> ${jud} |
| 54 | sed -i 's/\([a-zA-Z-]\w*\)\./\1-/g' ${jud} |
| 55 | sed -i "s/\bclassname=\"/classname=\"${test_id}./g" ${jud} |
| 56 | } |
| 57 | |
arjantijms | 2c8e6b6 | 2021-06-25 15:12:40 +0200 | [diff] [blame] | 58 | bundles(){ |
| 59 | archive_bundles |
| 60 | } |
| 61 | |
Romain Grecourt | f7e3a48 | 2018-11-20 00:47:09 -0800 | [diff] [blame] | 62 | archive_bundles(){ |
| 63 | mkdir -p ${WORKSPACE}/bundles |
| 64 | cp appserver/distributions/glassfish/target/*.zip ${WORKSPACE}/bundles |
| 65 | cp appserver/distributions/web/target/*.zip ${WORKSPACE}/bundles |
| 66 | cp nucleus/distributions/nucleus/target/*.zip ${WORKSPACE}/bundles |
| 67 | } |
| 68 | |
| 69 | dev_build(){ |
hs536 | b10e467 | 2021-02-26 14:35:46 +0900 | [diff] [blame] | 70 | mvn -U clean install -Pstaging ${MVN_EXTRA} |
Romain Grecourt | f7e3a48 | 2018-11-20 00:47:09 -0800 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | build_re_dev(){ |
| 74 | dev_build |
| 75 | archive_bundles |
| 76 | merge_junits |
| 77 | } |
| 78 | |
| 79 | if [ -z "${WORKSPACE}" ] ; then |
| 80 | export WORKSPACE=`dirname ${0}` |
| 81 | fi |
| 82 | |
Romain Grecourt | f7e3a48 | 2018-11-20 00:47:09 -0800 | [diff] [blame] | 83 | "$@" |
| 84 | |
| 85 | if [ ! -z "${JENKINS_HOME}" ] ; then |
| 86 | # archive the local repository org.glassfish.main |
| 87 | # the output is a tar archive split into 1MB chunks. |
| 88 | tar -cz -f - -C ${HOME}/.m2/repository org/glassfish/main | split -b 1m - ${WORKSPACE}/bundles/_maven-repo |
Romain Grecourt | 107d699 | 2018-11-21 15:42:52 -0800 | [diff] [blame] | 89 | fi |