Docker-in-Docker (DinD) capabilities of public runners deactivated. More info

Commit b7fb577e authored by Pierre Aubert's avatar Pierre Aubert
Browse files

Add the ability to choose the tag or branch to be used when pulling a Phoenix project dependencies

parent 7e464a1f
Pipeline #126416 passed with stages
in 1 minute and 5 seconds
......@@ -9,9 +9,14 @@ set(SCRIPT_CLONE_PACKAGE "${CMAKE_CURRENT_SOURCE_DIR}/scriptClonePackage.sh" CAC
# Parameter :
# packageName : name of the package to be found (classic parameter of find_package)
# urlGitToPackage : url of the git repository to be used to fetch it if it is not found
# ARGN : optional branch name or tag name to be used
function(get_extra_module packageName urlGitToPackage)
set(PHOENIX_TARGET_NAME "phoenix_${packageName}_found")
if(PHOENIX_TAG)
set(SPECIFIC_BRANCH ${PHOENIX_TAG})
else()
set(SPECIFIC_BRANCH ${ARGN})
endif()
if(TARGET ${PHOENIX_TARGET_NAME})
message(STATUS "Project ${packageName} already found, target ${PHOENIX_TARGET_NAME} exits")
else()
......@@ -23,7 +28,7 @@ function(get_extra_module packageName urlGitToPackage)
if(EXISTS ${MODULE_PROJECT_DIR})
message(STATUS "Find project ${packageName} in ${MODULE_PROJECT_DIR}")
execute_process(COMMAND ${SCRIPT_PULL_MODULE} ${MODULE_PROJECT_DIR}
execute_process(COMMAND ${SCRIPT_PULL_MODULE} ${MODULE_PROJECT_DIR} ${SPECIFIC_BRANCH}
WORKING_DIRECTORY ${SUB_MODULE_DIRECTORY}/
ERROR_QUIET
OUTPUT_QUIET
......@@ -36,7 +41,7 @@ function(get_extra_module packageName urlGitToPackage)
if(urlGitToPackage)
get_filename_component(basePackageDirName ${urlGitToPackage} NAME_WE)
message(STATUS "Get project ${packageName} with url '${urlGitToPackage}'")
execute_process(COMMAND ${SCRIPT_CLONE_MODULE} ${urlGitToPackage}
execute_process(COMMAND ${SCRIPT_CLONE_MODULE} ${urlGitToPackage} ${SPECIFIC_BRANCH}
WORKING_DIRECTORY ${SUB_MODULE_DIRECTORY}/)
if(EXISTS ${MODULE_PROJECT_DIR})
message(STATUS "Find project ${packageName} in ${MODULE_PROJECT_DIR}")
......@@ -59,6 +64,7 @@ endfunction(get_extra_module)
# Parameter :
# packageName : name of the package to be found (classic parameter of find_package)
# urlGitToPackage : url of the git repository to be used to fetch it if it is not found
# ARGN : optional branch name or tag name to be used
function(pull_extra_module packageName urlGitToPackage)
# There is one global varialbe PHOENIX_FORCE_PULL_MODULE
# - if the PHOENIX_FORCE_PULL_MODULE == no
......@@ -73,7 +79,7 @@ function(pull_extra_module packageName urlGitToPackage)
# - if the module is found, we pull it even if the package does exist (we recompile it and reinstall it)
if(PHOENIX_FORCE_PULL_MODULE)
# We always pull the module
get_extra_module(${packageName} ${urlGitToPackage})
get_extra_module(${packageName} ${urlGitToPackage} ${ARGN})
else()
# Try to find the package
find_package(${packageName} QUIET)
......@@ -88,7 +94,7 @@ function(pull_extra_module packageName urlGitToPackage)
else()
# The module is not found, so we get it
message(STATUS "${packageName} not found")
get_extra_module(${packageName} ${urlGitToPackage})
get_extra_module(${packageName} ${urlGitToPackage} ${ARGN})
endif()
endif()
endfunction(pull_extra_module)
......
......@@ -4,4 +4,12 @@ urlGitToPackage="$1"
git clone $urlGitToPackage
if [ ! -z $2 ]
then
USED_BRANCH="$2"
echo "Switching to '${USED_BRANCH}'"
git checkout ${USED_BRANCH}
fi
......@@ -5,4 +5,11 @@ packageDir="$1"
cd "$packageDir"
git pull
if [ ! -z $2 ]
then
USED_BRANCH="$2"
echo "Switching to '${USED_BRANCH}'"
git checkout ${USED_BRANCH}
fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment