7 # Workaround for at least Debian Buster
8 # Require to build bonita-portal-js due to issue with PhantomJS launched by Karma
9 # See https://github.com/ariya/phantomjs/issues/14520
10 export OPENSSL_CONF=/etc/ssl
12 # Script configuration
13 # You can set the following environment variables
14 BONITA_BUILD_NO_CLEAN=${BONITA_BUILD_NO_CLEAN:-true}
15 BONITA_BUILD_QUIET=${BONITA_BUILD_QUIET:-false}
16 BONITA_BUILD_STUDIO_ONLY=${BONITA_BUILD_STUDIO_ONLY:-true}
17 BONITA_BUILD_STUDIO_SKIP=${BONITA_BUILD_STUDIO_SKIP:-false}
24 ########################################################################################################################
25 # SCM AND BUILD FUNCTIONS
26 ########################################################################################################################
28 # $1: the message to be displayed as header
32 echo "============================================================"
34 echo "============================================================"
38 # - Git repository name
39 # - Tag name (optional)
40 # - Checkout folder name (optional)
42 # We need at least one parameter (the repository name) and no more than three (repository name, tag name and checkout folder name)
43 if [ "$#" -lt 1 ] || [ "$#" -gt 3 ]; then
44 echo "Incorrect number of parameters: $@"
50 if [ "$#" -ge 2 ]; then
53 # If we don't have a tag name assume that the tag is named with the Bonita version
54 tag_name=$BONITA_VERSION
56 echoHeaders "Processing ${repository_name} ${tag_name}"
58 if [ "$#" -eq 3 ]; then
59 checkout_folder_name="$3"
61 # If no checkout folder path is provided use the repository name as destination folder name
62 checkout_folder_name="$repository_name"
65 # If we don't already clone the repository do it
66 if [ ! -d "$checkout_folder_name/.git" ]; then
67 git clone --depth 1 "https://github.com/bonitasoft/$repository_name.git" $checkout_folder_name
69 # Ensure we fetch all the tags and that we are on the appropriate one
70 git -C $checkout_folder_name fetch --tags
71 git -C $checkout_folder_name reset --hard tags/$tag_name
73 # Move to the repository clone folder (required to run Maven/Gradle wrapper)
74 cd $checkout_folder_name
77 run_maven_with_standard_system_properties() {
78 build_command="$build_command -Dengine.version=$BONITA_VERSION -Dfilters.version=$BONITA_VERSION"
79 echo "[DEBUG] Running build command: $build_command"
81 # Go back to script folder (checkout move current directory to project checkout folder.
85 run_gradle_with_standard_system_properties() {
86 echo "[DEBUG] Running build command: $build_command"
88 # Go back to script folder (checkout move current directory to project checkout folder.
92 build_maven_wrapper() {
93 build_command="./mvnw"
96 build_gradle_wrapper() {
97 build_command="./gradlew"
100 build_quiet_if_requested() {
101 if [[ "${BONITA_BUILD_QUIET}" == "true" ]]; then
102 echo "Configure quiet build"
103 build_command="$build_command --quiet"
108 build_command="$build_command build"
111 publishToMavenLocal() {
112 build_command="$build_command publishToMavenLocal"
116 if [[ "${BONITA_BUILD_NO_CLEAN}" == "true" ]]; then
117 echo "Configure build to skip clean task"
119 build_command="$build_command clean"
124 build_command="$build_command install"
128 build_command="$build_command verify"
132 build_command="$build_command -DskipTests"
136 build_command="$build_command -x test"
140 build_command="$build_command -P$1"
144 # - Git repository name
146 build_maven_wrapper_verify_skiptest_with_profile()
150 build_quiet_if_requested
155 run_maven_with_standard_system_properties
159 # - Git repository name
160 build_maven_wrapper_install_skiptest()
164 unzip -o JDSmessages.zip
165 cp bonita-studio.pom.xml bonita-studio/pom.xml
166 cp bundles.plugins.pom.xml bonita-studio/bundles/plugins/pom.xml
167 cp console.libs.pom.xml bonita-studio/bundles/plugins/org.bonitasoft.studio.console.libs/pom.xml
168 cp bundles.features.studio-feature.feature.xml bonita-studio/bundles/features/studio-feature/feature.xml
169 cp console.libs.build.properties bonita-studio/bundles/plugins/org.bonitasoft.studio.console.libs/build.properties
170 rm bonita-studio/bundles/plugins/org.bonitasoft.studio.console.libs/META-INF/p2.inf
171 cp splash.bmp bonita-studio/bundles/plugins/org.bonitasoft.studio-product/splash_without_version.bmp
172 cp splash.bmp bonita-studio/bundles/plugins/org.bonitasoft.studio-product/src/org/bonitasoft/studiosplash_without_version.bmp
173 cp splash.bmp bonita-studio/bundles/plugins/org.bonitasoft.studio-product/splash.bmp
174 cp about.bmp bonita-studio/bundles/plugins/org.bonitasoft.studio-product/about.bmp
175 cp studio-product.pom.xml bonita-studio/bundles/plugins/org.bonitasoft.studio-product/pom.xml
176 cp bundles.plugins.studio-product.plugin.xml bonita-studio/bundles/plugins/org.bonitasoft.studio-product/plugin.xml
177 cp bundles.plugins.intro.plugin.xml bonita-studio/bundles/plugins/org.bonitasoft.studio.intro/plugin.xml
178 cp bundles.plugins.intro.plugin.properties bonita-studio/bundles/plugins/org.bonitasoft.studio.intro/plugin.properties
179 cp bundles.plugins.intro.content.introContent.xml bonita-studio/bundles/plugins/org.bonitasoft.studio.intro/content/introContent.xml
180 cp bundles.plugins.intro.content.welcome.html bonita-studio/bundles/plugins/org.bonitasoft.studio.intro/content/welcome.html
181 cp all-in-one.bonitastudio-features.product bonita-studio/all-in-one/bonitastudio-features.product
182 rm bonita-studio/bundles/plugins/org.bonitasoft.studio.application/src/org/bonitasoft/studio/application/coolbar/WelcomeCoolbarItem.java
183 cp bundles.plugins.application.src.org.bonitasoft.studio.application.actions.OpenIntroCommandHnadler.java bonita-studio/bundles/plugins/org.bonitasoft.studio.application/src/org/bonitasoft/studio/application/actions/OpenIntroCommandHandler.java
184 cp bundles.plugins.application.src.org.bonitasoft.studio.application.BonitaStudioWorkbenchAdvisor.java bonita-studio/bundles/plugins/org.bonitasoft.studio.application/src/org/bonitasoft/studio/application/BonitaStudioWorkbenchAdvisor.java
185 rm bonita-studio/bundles/plugins/org.bonitasoft.studio.engine/src/org/bonitasoft/studio/engine/coolbar/OpenPortalCoolbarItem.java
186 rm bonita-studio/bundles/plugins/org.bonitasoft.studio.engine/src/org/bonitasoft/studio/engine/coolbar/RunCoolbarItem.java
187 cp bundles.plugins.application.plugin.xml bonita-studio/bundles/plugins/org.bonitasoft.studio.application/plugin.xml
188 cp bundles.plugins.engine.plugin.xml bonita-studio/bundles/plugins/org.bonitasoft.studio.engine/plugin.xml
189 cp bundles.plugins.engine.src.org.bonitasoft.studio.engine.BOSEngineManager.java bonita-studio/bundles/plugins/org.bonitasoft.studio.engine/src/org/bonitasoft/studio/engine/BOSEngineManager.java install
191 build_quiet_if_requested
194 run_maven_with_standard_system_properties
197 build_gradle_wrapper_test_skip_publishToMavenLocal() {
200 build_quiet_if_requested
203 profile forceCurrentVersion=7.13.0
205 run_gradle_with_standard_system_properties
208 ########################################################################################################################
209 # PARAMETERS PARSING AND VALIDATIONS
210 ########################################################################################################################
218 CYGWIN*) OS_IS_WINDOWS=true;;
219 MINGW*) OS_IS_WINDOWS=true;;
220 Darwin*) OS_IS_MAC=true;;
221 *) OS_IS_LINUX=true;;
226 echo "OS information"
227 if [[ "${OS_IS_LINUX}" == "true" ]]; then
228 echo " > Run on Linux"
229 echo "$(cat /etc/lsb-release)" | xargs -L 1 -I % echo " %"
230 elif [[ "${OS_IS_MAC}" == "true" ]]; then
231 echo " > Run on MacOS"
232 echo "$(sw_vers)" | xargs -L 1 -I % echo " %"
234 echo " > Run on Windows"
235 echo "$(wmic os get Caption,OSArchitecture,Version //value)" | xargs -L 1 --no-run-if-empty -I % echo " %" | grep -v -e '^[[:space:]]*$'
237 echo " > Generic information: $(uname -a)"
239 echo "Build environment"
240 echo " > Use $(git --version)"
241 echo " > Commit: $(git rev-parse FETCH_HEAD)"
243 echo "Build settings"
244 echo " > BONITA_VERSION: ${BONITA_VERSION}"
245 echo " > BONITA_BUILD_NO_CLEAN: ${BONITA_BUILD_NO_CLEAN}"
246 echo " > BONITA_BUILD_QUIET: ${BONITA_BUILD_QUIET}"
247 echo " > BONITA_BUILD_STUDIO_ONLY: ${BONITA_BUILD_STUDIO_ONLY}"
248 echo " > BONITA_BUILD_STUDIO_SKIP: ${BONITA_BUILD_STUDIO_SKIP}"
251 checkPrerequisites() {
253 # if [[ "${OS_IS_LINUX}" == "true" ]]; then
254 # if [[ "${BONITA_BUILD_STUDIO_SKIP}" == "false" ]]; then
255 # # Test that x server is running. Required to generate Bonita Studio models
256 # # Can be ignored if Studio is build without the "generate" Maven profile
258 # if ! xset q &>/dev/null; then
259 # echo "No X server at \$DISPLAY [$DISPLAY]" >&2
262 # echo " > X server running correctly"
266 # Test if Curl exists
267 if hash curl 2>/dev/null; then
268 CURL_VERSION="$(curl --version 2>&1 | awk -F " " 'NR==1 {print $2}')"
269 echo " > Use curl version: $CURL_VERSION"
271 echo "curl not found. Exiting."
280 echo " > Java prerequisites"
281 echo " Check if Java version is compatible with Bonita"
283 if [[ "x$JAVA" = "x" ]]; then
284 if [[ "x$JAVA_HOME" != "x" ]]; then
285 echo " JAVA_HOME is set"
286 JAVA_CMD="$JAVA_HOME/bin/java"
288 echo " JAVA_HOME is not set. Use java in path"
294 echo " Java command path is $JAVA_CMD"
296 java_full_version_details=$("$JAVA_CMD" -version 2>&1)
298 echo "${java_full_version_details}" | xargs -L 1 -I % echo " %"
300 java_full_version=$("$JAVA_CMD" -version 2>&1 | grep -i version | sed 's/.*version "\(.*\)".*$/\1/g')
301 echo " Java full version: $java_full_version"
302 if [[ "x$java_full_version" = "x" ]]; then
303 echo "No Java command could be found. Please set JAVA_HOME variable to a JDK and/or add the java executable to your PATH"
307 java_version_1st_digit=$(echo "$java_full_version" | sed 's/\(.*\)\..*\..*$/\1/g')
308 java_version_expected=11
309 # pre Java 9 versions, get minor version
310 if [[ "$java_version_1st_digit" -eq "1" ]]; then
311 java_version=$(echo "$java_full_version" | sed 's/.*\.\(.*\)\..*$/\1/g')
313 java_version=${java_version_1st_digit}
315 echo " Java version: $java_version"
317 if [[ "$java_version" -ne "$java_version_expected" ]]; then
318 echo "Invalid Java version $java_version not $java_version_expected. Please set JAVA_HOME environment variable to a valid JDK version, and/or add the java executable to your PATH"
321 echo " Java version is compatible with Bonita"
325 ########################################################################################################################
327 ########################################################################################################################
329 detectWebPagesDependenciesVersions() {
330 echoHeaders "Detecting web-pages dependencies versions"
331 local webPagesGradleBuild=`curl -sS -X GET https://raw.githubusercontent.com/bonitasoft/bonita-web-pages/${BONITA_VERSION}/build.gradle`
333 WEB_PAGES_UID_VERSION=`echo "${webPagesGradleBuild}" | tr -s "[:blank:]" | tr -d "\n" | sed 's@.*UIDesigner {\(.*\)"}.*@\1@g' | sed 's@.*version "\(.*\)@\1@g'`
334 echo "WEB_PAGES_UID_VERSION: ${WEB_PAGES_UID_VERSION}"
337 detectStudioDependenciesVersions() {
338 # echoHeaders "Detecting Studio dependencies versions"
339 # local studioPom=`curl -sS -X GET https://raw.githubusercontent.com/bonitasoft/bonita-studio/${BONITA_VERSION}/pom.xml`
341 # STUDIO_UID_VERSION=`echo "${studioPom}" | grep \<ui.designer.version\> | sed 's@.*>\(.*\)<.*@\1@g'`
342 STUDIO_UID_VERSION=1.13.20
343 echo "STUDIO_UID_VERSION: ${STUDIO_UID_VERSION}"
348 ########################################################################################################################
350 ########################################################################################################################
356 # List of repositories on https://github.com/bonitasoft that you don't need to build
357 # Note that archived repositories are not listed here, as they are only required to build old Bonita versions
359 # angular-strap: automatically downloaded in the build of bonita-web project.
360 # babel-preset-bonita: automatically downloaded in the build of bonita-ui-designer project.
361 # bonita-codesign-windows: use to sign Windows binaries when building using Bonita Continuous Integration.
362 # bonita-connector-talend: deprecated.
363 # bonita-continuous-delivery-doc: Bonita Enterprise Edition Continuous Delivery module documentation.
364 # bonita-custom-page-seed: a project to start building a custom page. Deprecated in favor of UI Designer page + REST API extension.
365 # bonita-doc: Bonita documentation.
366 # bonita-developer-resources: guidelines for contributing to Bonita, contributor license agreement, code style...
367 # bonita-examples: Bonita usage code examples.
368 # bonita-ici-doc: Bonita Enterprise Edition AI module documentation.
369 # bonita-js-components: automatically downloaded in the build of projects that require it.
370 # bonita-migration: migration tool to update a server from a previous Bonita release.
371 # bonita-page-authorization-rules: documentation project to provide an example for page mapping authorization rule.
372 # bonita-connector-sap: deprecated. Use REST connector instead.
373 # bonita-vacation-management-example: an example for Bonita Enterprise Edition Continuous Delivery module.
374 # bonita-web-devtools: Bonitasoft internal development tools.
375 # bonita-widget-contrib: project to start building custom widgets outside UI Designer.
376 # create-react-app: required for Bonita Subscription Intelligent Continuous Improvement module.
377 # dojo: Bonitasoft R&D coding dojos.
378 # jscs-preset-bonita: Bonita JavaScript code guidelines.
379 # ngUpload: automatically downloaded in the build of bonita-ui-designer project.
380 # preact-chartjs-2: required for Bonita Subscription Intelligent Continuous Improvement module.
381 # preact-content-loader: required for Bonita Subscription Intelligent Continuous Improvement module.
382 # restlet-framework-java: /!\
383 # swt-repo: legacy repository required by Bonita Studio. Deprecated.
384 # training-presentation-tool: fork of reveal.js with custom look and feel.
385 # widget-builder: automatically downloaded in the build of bonita-ui-designer project.
386 # bonita-studio-watchdog: obsolete since 7.10 (included in bonita-studio).
389 if [[ "${BONITA_BUILD_STUDIO_ONLY}" == "false" ]]; then
390 build_gradle_wrapper_test_skip_publishToMavenLocal bonita-engine
392 build_maven_wrapper_install_skiptest bonita-web-extensions
394 build_maven_wrapper_install_skiptest bonita-web
395 build_maven_wrapper_install_skiptest bonita-portal-js
397 # bonita-web-pages uses a dedicated UID version
398 detectWebPagesDependenciesVersions
399 build_maven_wrapper_install_skiptest bonita-ui-designer ${WEB_PAGES_UID_VERSION}
400 build_gradle_wrapper_test_skip_publishToMavenLocal bonita-web-pages
402 build_maven_wrapper_install_skiptest bonita-application-directory
403 build_maven_wrapper_install_skiptest bonita-user-application
404 build_maven_wrapper_install_skiptest bonita-admin-application
405 build_maven_wrapper_install_skiptest bonita-super-admin-application
407 build_maven_wrapper_install_skiptest bonita-distrib
409 echoHeaders "Skipping all build prior the Studio part"
410 build_gradle_wrapper_test_skip_publishToMavenLocal bonita-engine
413 if [[ "${BONITA_BUILD_STUDIO_SKIP}" == "false" ]]; then
414 build_maven_wrapper_install_skiptest bonita-data-repository
416 # bonita-studio uses a dedicated UID version
417 detectStudioDependenciesVersions
418 build_maven_wrapper_install_skiptest bonita-ui-designer ${STUDIO_UID_VERSION}
420 build_maven_wrapper_verify_skiptest_with_profile bonita-studio default,all-in-one,!jdk11-tests
422 echoHeaders "Skipping the Studio build"