blob: 9d96cf74edf4ea00957a991cd61ffc3323c2a22a [file] [log] [blame]
Stephan Herrmann21972f62021-03-04 19:29:10 +01001#! /bin/bash
Stephan Herrmannf80b55d2016-10-31 23:56:48 +01002# Copyright (c) 2010 Stephan Herrmann.
Stephan Herrmann35705382020-03-03 21:42:19 +01003# This program and the accompanying materials
4# are made available under the terms of the Eclipse Public License 2.0
Stephan Herrmannf80b55d2016-10-31 23:56:48 +01005# which accompanies this distribution, and is available at
Stephan Herrmann35705382020-03-03 21:42:19 +01006# https://www.eclipse.org/legal/epl-2.0/
7#
8# SPDX-License-Identifier: EPL-2.0
Stephan Herrmannf80b55d2016-10-31 23:56:48 +01009#
10# Contributors:
11# Stephan Herrmann - initial API and implementation
12###############################################################################
13
14# =============================================================================
15# MAIN BUILD AND TEST SCRIPT FOR THE OBJECT TEAMS DEVELOPMENT TOOLING (OTDT)
16# =============================================================================
17# INPUT: Variables from otdt_prerequisites:
18# -----------------------------------------------------------------------------
19# TMPDIR for log output
20# TEST_TMPDIR for temp test files
21# OT_TESTSUITE_DIR root directory for building and testing
22# METADATA directory for metadata from previous builds
Stephan Herrmannf80b55d2016-10-31 23:56:48 +010023# SDK_QUALIFIER build qualifier of the base eclipse SDK
24# ECLIPSE_SDK_TGZ archive file of the base eclipse SDK build (full path)
25# ECLIPSE_TESTLIB_ZIP archive file of the eclipse test framework (full path)
26# PUBLISHED_UPDATES directory of previously published plugins&features
Stephan Herrmann434a0842016-11-01 18:02:29 +010027# FETCH_CACHE_LOCATION git working area holding caches for fetch
28# MAP_FILE_PATH path to the otdt.map file (original location of otdt.map.in)
Stephan Herrmannf80b55d2016-10-31 23:56:48 +010029# ANT_PROFILE configure the ant process
Stephan Herrmann040b4e02021-03-05 00:25:26 +010030# SIGN "nosign" or empty
Stephan Herrmannf80b55d2016-10-31 23:56:48 +010031# =============================================================================
32# OUTPUT: Variables passed to the toplevel ant script
33# -----------------------------------------------------------------------------
34## As Environment Variables:
35## ANT_OPTS configure Ant
36## As Ant Arguments (from ANT_PROFILE):
37## -verbose configure Ant
38## As Java Properties:
39## -Declipse-app.tgz path of eclipse SDK
40## -Declipse.tests.zip path of eclipse test framework
41## -Dpublished.updates path to previously published things
Stephan Herrmannf80b55d2016-10-31 23:56:48 +010042## -Ddo.run.tests true|false: should test be run?
Stephan Herrmann434a0842016-11-01 18:02:29 +010043## -DfetchCacheLocation git working area holding caches for fetch
44## -Dmap.file.path path to the otdt.map file (original location of otdt.map.in)
45## -D_hasSaxon.jar to prevent copying of saxon8.jar (was needed on build.eclipse.org)
Stephan Herrmannf80b55d2016-10-31 23:56:48 +010046# =============================================================================
47
Stephan Herrmann21972f62021-03-04 19:29:10 +010048# CONSTANTS (FOR NOW):
Stephan Herrmann040b4e02021-03-05 00:25:26 +010049# option baseRepo is currently broken
Stephan Herrmannfa37d542021-03-04 21:13:39 +010050baseRepo=none
Stephan Herrmann040b4e02021-03-05 00:25:26 +010051export UPDATE_SITE_BASE=ot2.8
52export OT_VERSION=2.8.2
53# during the build we always publish to 'staging':
Stephan Herrmann21972f62021-03-04 19:29:10 +010054export PROMOTE=staging
Stephan Herrmann21972f62021-03-04 19:29:10 +010055
Stephan Herrmannf80b55d2016-10-31 23:56:48 +010056usage()
57{
58 echo "Usage:"
59 echo "$0 [-b|-nobuild]"
60 echo " -b: build OTDT only, no testing."
61 echo " -nobuild: don't build OTDT, directly invoke testing."
62}
63
Stephan Herrmannf80b55d2016-10-31 23:56:48 +010064cleanup()
65{
Stephan Herrmann423ec262016-11-01 00:11:19 +010066 echo "cleanup(): Currently no cleanup is configured"
Stephan Herrmannf80b55d2016-10-31 23:56:48 +010067}
68
69_prefix=`dirname $0`
70_prefix=`readlink -f $_prefix`
71. "${_prefix}/otdt_prerequisites-hipp.sh"
72
73echo "=== Sourced otdt_prerequisites-hipp.sh ==="
74env
75echo "====================================="
76
77#LOCAL: log file:
78OT_SUITE_LOG=$TMPDIR/ot-testsuite.log
79
80# LOCAL: the initial ant build file:
81BUILDFILE="${_prefix}/run.xml"
82
83#LOCAL: main ant target:
84MAIN_TARGET=${MAIN_TARGET:="ot-junit-all"}
85
Stephan Herrmannf80b55d2016-10-31 23:56:48 +010086#LOCAL: should the tests be run?
87DO_RUN="true"
88
Stephan Herrmann434a0842016-11-01 18:02:29 +010089case ${MAIN_TARGET} in
Stephan Herrmann434a0842016-11-01 18:02:29 +010090 "ot-compiler-build")
91 ;&
92 "ot-junit-build")
93 DO_RUN="false"
94 ;;
95esac
Stephan Herrmannd9a85732016-11-01 16:32:04 +010096
Stephan Herrmannf80b55d2016-10-31 23:56:48 +010097# start working:
98
99test -d "$TMPDIR" || mkdir -p "$TMPDIR"
100test -d "$OT_TESTSUITE_DIR" || mkdir -p "$OT_TESTSUITE_DIR"
101cd "$OT_TESTSUITE_DIR"
102
Stephan Herrmannf80b55d2016-10-31 23:56:48 +0100103
104# preload metadata for appending:
105if [ -f "${METADATA}/content.xml" ]
106then
107 mkdir -p metadata
108 cp ${METADATA}/*.xml metadata
109fi
110
111trap "echo Aborting by SIGTERM; cleanup; exit 130" INT
112
113# Assemble the Ant call:
114ANT_OPTIONS="${ANT_PROFILE} \
115 -Declipse-app.tgz=${ECLIPSE_SDK_TGZ} \
116 -Declipse.tests.zip=${ECLIPSE_TESTLIB_ZIP} \
117 -Declipse.sdk.qualifier=${SDK_QUALIFIER} \
118 -Dpublished.updates=${PUBLISHED_UPDATES} \
119 -Ddo.run.tests=${DO_RUN} \
Stephan Herrmanne73f8852016-11-01 00:23:59 +0100120 -Dtest.tmpDir=${TEST_TMPDIR} \
Stephan Herrmanncf1ce3f2016-11-01 01:04:19 +0100121 -DfetchCacheLocation=${FETCH_CACHE_LOCATION} \
Stephan Herrmannd9a85732016-11-01 16:32:04 +0100122 -Dmap.file.path=${MAP_FILE_PATH} \
Stephan Herrmann74cc41d2016-11-01 16:33:39 +0100123 -D_hasSaxon.jar=true"
Stephan Herrmannf80b55d2016-10-31 23:56:48 +0100124
125ANT_OPTS="-Xmx1024m"
126export ANT_OPTS
127
Stephan Herrmann040b4e02021-03-05 00:25:26 +0100128# 1. build OTDT
129# 2. create & publish the update site
130# 3. run tests using (1)
Stephan Herrmann21972f62021-03-04 19:29:10 +0100131ant -f ${BUILDFILE} ${ANT_OPTIONS} createOTDTEclipse && \
Stephan Herrmann040b4e02021-03-05 00:25:26 +0100132 ( cd .. ; ./releng/build-scripts/bin/createRepository-hipp.sh ${baseRepo} ${UPDATE_SITE_BASE} ${OT_VERSION} ) && \
Stephan Herrmann21972f62021-03-04 19:29:10 +0100133 ant -f ${BUILDFILE} ${ANT_OPTIONS} ${MAIN_TARGET}
Stephan Herrmannf80b55d2016-10-31 23:56:48 +0100134
135trap - INT
136
137