blob: 55802b4a0d198b422f1950f16ba45cde4cc24e16 [file] [log] [blame]
Romain Grecourtf7e3a482018-11-20 00:47:09 -08001#!/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
42merge_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"`
50 do
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
58archive_bundles(){
59 mkdir -p ${WORKSPACE}/bundles
60 cp appserver/distributions/glassfish/target/*.zip ${WORKSPACE}/bundles
61 cp appserver/distributions/web/target/*.zip ${WORKSPACE}/bundles
62 cp nucleus/distributions/nucleus/target/*.zip ${WORKSPACE}/bundles
63}
64
65dev_build(){
arjantijmse93cce92020-01-22 13:42:36 +010066 mvn -U clean install -Dmaven.test.failure.ignore=true -Pstaging ${MVN_EXTRA}
Romain Grecourtf7e3a482018-11-20 00:47:09 -080067}
68
69build_re_dev(){
70 dev_build
71 archive_bundles
72 merge_junits
73}
74
75if [ -z "${WORKSPACE}" ] ; then
76 export WORKSPACE=`dirname ${0}`
77fi
78
Romain Grecourtf7e3a482018-11-20 00:47:09 -080079"$@"
80
81if [ ! -z "${JENKINS_HOME}" ] ; then
82 # archive the local repository org.glassfish.main
83 # the output is a tar archive split into 1MB chunks.
84 tar -cz -f - -C ${HOME}/.m2/repository org/glassfish/main | split -b 1m - ${WORKSPACE}/bundles/_maven-repo
Romain Grecourt107d6992018-11-21 15:42:52 -080085fi