From d9684b969918d7ed0808bc781b357f8e2c084583 Mon Sep 17 00:00:00 2001 From: GuilhemSempere Date: Tue, 2 Jul 2024 10:46:49 +0200 Subject: [PATCH] Reverted back to original build.sh --- misc/build.sh | 96 ++++++++++++--------------------------------------- 1 file changed, 23 insertions(+), 73 deletions(-) diff --git a/misc/build.sh b/misc/build.sh index a0ef1a8f..60dc3ce1 100755 --- a/misc/build.sh +++ b/misc/build.sh @@ -10,78 +10,28 @@ set -e -# Function to print the current directory for debugging -print_current_dir() { - echo "Current directory: $(pwd)" -} - -# Clone the Gigwa2 repository -echo "Cloning Gigwa2 repository" -git clone https://github.com/SouthGreenPlatform/Gigwa2.git - -cd ./Gigwa2 -print_current_dir - -# Get the latest tag -echo "Fetching tags" -git fetch --tags - -latest_tag=$(git describe --tags --abbrev=0 $(git rev-list --tags --max-count=1)) -echo "Latest tag: $latest_tag" - -# Check if the latest tag is STAGING -if [ "$latest_tag" == "STAGING" ]; then - previous_tag=$(git describe --tags --abbrev=0 $(git rev-list --tags --skip=1 --max-count=1)) - echo "Latest tag is STAGING, using previous tag: $previous_tag" - git checkout $previous_tag -else - echo "Using latest tag: $latest_tag" - git checkout $latest_tag -fi - -# Get the list of dependencies -echo "Running Maven dependency tree" -dependencies=$(mvn dependency:tree | grep -v WARNING | grep "fr\.cirad.*\-RELEASE" | awk ' -{ - if (match($0, /fr\.cirad:[^:]+:(jar|war):[^:]+/)) { - split(substr($0, RSTART, RLENGTH), arr, ":"); - app_name = arr[2]; - release_name = arr[4]; - print app_name ":" release_name; - } -}') - -echo "Dependencies found: $dependencies" - -# Convert the list of dependencies into an array -subProjects=() -while IFS= read -r line; do - subProjects+=("$line") -done <<< "$dependencies" - -cd .. -print_current_dir - -# Clone the sub-projects -echo "Cloning sub-projects" -for subProject in "${subProjects[@]}"; do - app_name=$(echo "$subProject" | awk -F':' '{print $1}') - release_name=$(echo "$subProject" | awk -F':' '{print $2}') - - echo "Cloning $app_name with tag $release_name" - - if [ "$app_name" == "Gigwa2" ]; then - continue - fi - - git clone -b $release_name --single-branch "https://github.com/GuilhemSempere/$app_name.git" +m2repo=$(mvn help:evaluate -Dexpression=settings.localRepository -q -DforceStdout) + +declare -a subProjects=(GuilhemSempere/GenotypeFileManipulation GuilhemSempere/Mgdb2BrapiModel GuilhemSempere/Mgdb2 GuilhemSempere/Mgdb2Export GuilhemSempere/role_manager GuilhemSempere/Mgdb2BrapiImpl GuilhemSempere/Mgdb2BrapiV2Impl GuilhemSempere/Gigwa2ServiceInterface GuilhemSempere/Gigwa2ServiceImpl SouthGreenPlatform/Gigwa2) + +for subProject in ${subProjects[*]} ; +do + echo + subProjectName="${subProject##*/}" + rm -rf $subProjectName + git clone -b master --single-branch https://github.com/$subProject.git + + cd $subProjectName + tag=$(grep -m 1 project\\\.version pom.xml | sed -n 's/.*\(.*\)<\/project\.version>.*/\1/p') + echo Switching to tag $tag in project $subProjectName + git -c advice.detachedHead=false checkout $tag + artifactId=$(grep -m 1 artifactId pom.xml | sed -n 's/.*\(.*\)<\/artifactId>.*/\1/p') + + echo Cleaning $subProjectName folder in local m2 repository + rm -rf $m2repo/fr/cirad/$artifactId + cd .. done - -cd ./Gigwa2/bom/ -print_current_dir - -echo "Running Maven install" -mvn install "$@" -echo "Maven install completed" + +cd Gigwa2/bom/ +mvn install $@ cd ../.. -print_current_dir