From b04c0b5258f26a3f8ce3c3cf7df9cc43d25ef6f5 Mon Sep 17 00:00:00 2001 From: Roberto Oliveira Date: Fri, 1 Sep 2023 14:01:53 +0200 Subject: [PATCH] allow to inject jboss-parent in serverless-workflow-project/pom.xml via build-quarkus-app.sh script --- scripts/logic/build-quarkus-app.sh | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/scripts/logic/build-quarkus-app.sh b/scripts/logic/build-quarkus-app.sh index 095a3ee28..3c571c839 100755 --- a/scripts/logic/build-quarkus-app.sh +++ b/scripts/logic/build-quarkus-app.sh @@ -16,6 +16,9 @@ quarkus_platform_groupid="${2}" quarkus_platform_version="${3}" kogito_version="${KOGITO_VERSION:-${4}}" +# jboss-parent version to be injected as parent of serverless-workflow-project project +jboss_parent_version="39" + # arch specific dependencies quarkus_extensions_arch_specific="com.aayushatharva.brotli4j:native-linux-aarch64:1.8.0" # common extensions used by the kogito-swf-builder and kogito-swf-devmode @@ -74,6 +77,9 @@ mvn ${MAVEN_OPTIONS} \ -Dextensions="${quarkus_extensions}" \ "${quarkus_platform_groupid}":quarkus-maven-plugin:"${quarkus_platform_version}":create +# backup original pom +cp serverless-workflow-project/pom.xml serverless-workflow-project/pom.xml.bak + # Fix as we cannot rely on Quarkus platform # Should be removed once https://issues.redhat.com/browse/KOGITO-9120 is implemented if [ ! -z ${kogito_version} ]; then @@ -89,7 +95,27 @@ if [ ! -z ${kogito_version} ]; then replace_3=" ${kogito_version}<\/version>\n" complete_replace="$replace_1$replace_2$replace_3" - sed -i.bak -e "/$pattern_1/{ + sed -i -e "/$pattern_1/{ + N;N;N + s/$complete_pattern/$complete_replace/ + }" serverless-workflow-project/pom.xml +fi + +if [ ! -z ${jboss_parent_version} ]; then + echo "Adding jboss-parent ${jboss_parent_version} as project parent" + # [ ]* -> is a regexp pattern to match any number of spaces + pattern_1="[ ]*<\/modelVersion>" + complete_pattern="$pattern_1" + + replace_1="<\/modelVersion>\n" + replace_2=" \n" + replace_3=" org.jboss<\/groupId>\n" + replace_4=" jboss-parent<\/artifactId>\n" + replace_5=" ${jboss_parent_version}<\/version>\n" + replace_6=" <\/parent>" + complete_replace="$replace_1$replace_2$replace_3$replace_4$replace_5$replace_6" + + sed -i -e "/$pattern_1/{ N;N;N s/$complete_pattern/$complete_replace/ }" serverless-workflow-project/pom.xml