You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2022/08/24 12:31:47 UTC
[camel-k] 02/02: chore(build): Account for staging repository when loading Maven overlay artifacts
This is an automated email from the ASF dual-hosted git repository.
acosentino pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-k.git
commit 753da061ed7c1700bfa9dd981b48bd64d8e76627
Author: Christoph Deppisch <cd...@redhat.com>
AuthorDate: Tue Aug 23 13:17:45 2022 +0200
chore(build): Account for staging repository when loading Maven overlay artifacts
---
script/Makefile | 2 +-
script/maven_overlay.sh | 91 +++++++++++++++++++++++++++++++++++--------------
2 files changed, 67 insertions(+), 26 deletions(-)
diff --git a/script/Makefile b/script/Makefile
index f548595ee..8aab58b68 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -379,7 +379,7 @@ check-platform:
maven-overlay:
@echo "####### Preparing maven dependencies bundle..."
mkdir -p build/_maven_overlay
- ./script/maven_overlay.sh $(RUNTIME_VERSION) build/_maven_overlay $(CAMEL_K_RUNTIME_DIR)
+ ./script/maven_overlay.sh $(RUNTIME_VERSION) build/_maven_overlay $(STAGING_RUNTIME_REPO) $(CAMEL_K_RUNTIME_DIR)
kamel-overlay:
@echo "####### Copying kamel CLI to output build directory..."
diff --git a/script/maven_overlay.sh b/script/maven_overlay.sh
index 2804f847d..e02786fa8 100755
--- a/script/maven_overlay.sh
+++ b/script/maven_overlay.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
@@ -19,7 +19,7 @@ location=$(dirname $0)
rootdir=$(realpath ${location}/../)
if [ "$#" -lt 2 ]; then
- echo "usage: $0 <output directory> <Camel K runtime version> [<local Camel K runtime project directory>]"
+ echo "usage: $0 <Camel K runtime version> <output directory> [<staging repository>] [<local Camel K runtime project directory>]"
exit 1
fi
@@ -30,7 +30,45 @@ fi
runtime_version=$1
output_dir=$2
-local_runtime_dir=${3:-}
+staging_repo=${3:-}
+local_runtime_dir=${4:-}
+
+if [ -n "$staging_repo" ]; then
+ if [[ $staging_repo == http:* ]] || [[ $staging_repo == https:* ]]; then
+ options="${options} -s ${rootdir}/settings.xml"
+ cat << EOF > ${rootdir}/settings.xml
+<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 https://maven.apache.org/xsd/settings-1.0.0.xsd">
+ <profiles>
+ <profile>
+ <id>camel-k-staging</id>
+ <repositories>
+ <repository>
+ <id>camel-k-staging-releases</id>
+ <name>Camel K Staging</name>
+ <url>${staging_repo}</url>
+ <releases>
+ <enabled>true</enabled>
+ <updatePolicy>never</updatePolicy>
+ </releases>
+ <snapshots>
+ <enabled>false</enabled>
+ </snapshots>
+ </repository>
+ </repositories>
+ </profile>
+ </profiles>
+ <activeProfiles>
+ <activeProfile>camel-k-staging</activeProfile>
+ </activeProfiles>
+</settings>
+EOF
+ else
+ local_runtime_dir="${staging_repo}"
+ staging_repo=""
+ fi
+fi
+
if [ -z "$local_runtime_dir" ]; then
mvn -q \
@@ -39,31 +77,34 @@ if [ -z "$local_runtime_dir" ]; then
-Dartifact=org.apache.camel.k:camel-k-maven-logging:${runtime_version}:zip \
-DoutputDirectory=${rootdir}/${output_dir}
- mv ${rootdir}/${output_dir}/camel-k-maven-logging-${runtime_version}.zip ${rootdir}/${output_dir}/camel-k-maven-logging.zip
+ mv ${rootdir}/${output_dir}/camel-k-maven-logging-${runtime_version}.zip ${rootdir}/${output_dir}/camel-k-maven-logging.zip
else
- # Take the dependencies from a local development environment
- camel_k_runtime_source=$3
- camel_k_runtime_source_version=$(mvn -f $camel_k_runtime_source/pom.xml help:evaluate -Dexpression=project.version -q -DforceStdout)
-
- if [ "$runtime_version" != "$camel_k_runtime_source_version" ]; then
- echo "WARNING! You're building Camel K project using $runtime_version but trying to bundle dependencies from local Camel K runtime $camel_k_runtime_source_version"
- fi
-
- mvn -q \
- $options \
- -am \
- -f $camel_k_runtime_source/support/camel-k-maven-logging/pom.xml \
- install
-
- mvn -q \
- $options \
- dependency:copy \
- -Dartifact=org.apache.camel.k:camel-k-maven-logging:$camel_k_runtime_source_version:zip \
- -DoutputDirectory=${rootdir}/${output_dir}
-
- mv ${rootdir}/${output_dir}/camel-k-maven-logging-$camel_k_runtime_source_version.zip ${rootdir}/${output_dir}/camel-k-maven-logging.zip
+ # Take the dependencies from a local development environment
+ camel_k_runtime_source_version=$(mvn -f $local_runtime_dir/pom.xml help:evaluate -Dexpression=project.version -q -DforceStdout)
+
+ if [ "$runtime_version" != "$camel_k_runtime_source_version" ]; then
+ echo "WARNING! You're building Camel K project using $runtime_version but trying to bundle dependencies from local Camel K runtime $camel_k_runtime_source_version"
+ fi
+
+ mvn -q \
+ $options \
+ -am \
+ -f $local_runtime_dir/support/camel-k-maven-logging/pom.xml \
+ install
+
+ mvn -q \
+ $options \
+ dependency:copy \
+ -Dartifact=org.apache.camel.k:camel-k-maven-logging:$camel_k_runtime_source_version:zip \
+ -DoutputDirectory=${rootdir}/${output_dir}
+
+ mv ${rootdir}/${output_dir}/camel-k-maven-logging-$camel_k_runtime_source_version.zip ${rootdir}/${output_dir}/camel-k-maven-logging.zip
fi
unzip -q -o ${rootdir}/${output_dir}/camel-k-maven-logging.zip -d ${rootdir}/${output_dir}
+if [ -n "$staging_repo" ]; then
+ rm ${rootdir}/settings.xml
+fi
+
rm ${rootdir}/${output_dir}/camel-k-maven-logging.zip