Skip to content

Commit

Permalink
Use common function and remove PROJECT_FORMULA
Browse files Browse the repository at this point in the history
Signed-off-by: Jose Luis Rivero <[email protected]>
  • Loading branch information
j-rivero committed Nov 10, 2023
1 parent 03cc3d0 commit def8917
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 34 deletions.
43 changes: 18 additions & 25 deletions jenkins-scripts/dsl/gazebo_libs.dsl
Original file line number Diff line number Diff line change
Expand Up @@ -151,32 +151,37 @@ void generate_ci_job(gz_ci_job, lib_name, branch, ci_config,
}
}

void generate_brew_ci_job(gz_brew_ci_job, lib_name, branch, ci_config)
void add_brew_shell_build_step(gz_brew_ci_job, lib_name, ws_checkout_dir)
{
def script_name_prefix = cleanup_library_name(lib_name)
def ws_checkout_dir = lib_name
def project_formula = lib_name.replaceAll(/^ign_/, 'ignition_')
OSRFBrewCompilation.create(gz_brew_ci_job,
is_testing_enabled(lib_name, ci_config),
are_cmake_warnings_enabled(lib_name, ci_config))
OSRFGitHub.create(gz_brew_ci_job,
"gazebosim/${lib_name}",
branch,
ws_checkout_dir)
// ignition formulas does not match the lib name, expand the prefix
lib_name = lib_name.replaceAll(/^ign-/, 'ignition-')
gz_brew_ci_job.with
{
steps {
shell("""\
#!/bin/bash -xe

export PROJECT_PATH="${ws_checkout_dir}"
export PROJECT_FORMULA="${project_formula}"
/bin/bash -xe ./scripts/jenkins-scripts/lib/project-default-devel-homebrew-amd64.bash "${lib_name}"
""".stripIndent())
}
}
}

void generate_brew_ci_job(gz_brew_ci_job, lib_name, branch, ci_config)
{
def script_name_prefix = cleanup_library_name(lib_name)
def ws_checkout_dir = lib_name
OSRFBrewCompilation.create(gz_brew_ci_job,
is_testing_enabled(lib_name, ci_config),
are_cmake_warnings_enabled(lib_name, ci_config))
OSRFGitHub.create(gz_brew_ci_job,
"gazebosim/${lib_name}",
branch,
ws_checkout_dir)
add_brew_shell_build_step(gz_brew_ci_job, lib_name, ws_checkout_dir)
}

def ciconf_per_lib_index = [:].withDefault { [:] }
def pkgconf_per_src_index = [:].withDefault { [:] }
generate_ciconfigs_by_lib(gz_collections_yaml, ciconf_per_lib_index, pkgconf_per_src_index)
Expand Down Expand Up @@ -288,25 +293,13 @@ ciconf_per_lib_index.each { lib_name, lib_configs ->
def gz_brew_ci_any_job_name = "${gz_job_name_prefix}-ci-pr_any-homebrew-amd64"
def gz_brew_ci_any_job = job(gz_brew_ci_any_job_name)
def ws_checkout_dir = lib_name
def project_formula = lib_name.replaceAll(/^ign_/, 'ignition_')
OSRFBrewCompilationAnyGitHub.create(gz_brew_ci_any_job,
"gazebosim/${lib_name}",
is_testing_enabled(lib_name, ci_config),
branch_names,
ENABLE_GITHUB_PR_INTEGRATION,
are_cmake_warnings_enabled(lib_name, ci_config))
gz_brew_ci_any_job.with
{
steps {
shell("""\
#!/bin/bash -xe

export PROJECT_PATH="${ws_checkout_dir}"
export PROJECT_FORMULA="${project_formula}"
/bin/bash -xe "./scripts/jenkins-scripts/lib/project-default-devel-homebrew-amd64.bash" "${lib_name}"
""".stripIndent())
}
}
add_brew_shell_build_step(gz_brew_ci_any_job, lib_name, ws_checkout_dir)
}
} //en of lib_configs
} // end of lib
Expand Down
14 changes: 5 additions & 9 deletions jenkins-scripts/lib/project-default-devel-homebrew-amd64.bash
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,11 @@ PROJECT=$1 # project will have the major version included (ex gazebo2)
PROJECT_ARGS=${2}
# PROJECT_PATH can be passed as env variable or assume that is the same than project name
PROJECT_PATH=${:-PROJECT}
# PROJECT_FORMULA can be passed as env varible or assume that will be generated
# from PROJECT and the major version in the CMakeLists.txt
if [[ -z ${PROJECT_FORMULA} ]]; then
# Check for major version number
# the PROJECT_FORMULA variable is only used for dependency resolution
PROJECT_FORMULA=${PROJECT//[0-9]}$(\
python3 ${SCRIPT_DIR}/tools/detect_cmake_major_version.py \
${WORKSPACE}/${PROJECT_PATH}/CMakeLists.txt || true)
fi
# Check for major version number
# the PROJECT_FORMULA variable is only used for dependency resolution
PROJECT_FORMULA=${PROJECT//[0-9]}$(\
python3 ${SCRIPT_DIR}/tools/detect_cmake_major_version.py \
${WORKSPACE}/${PROJECT_PATH}/CMakeLists.txt || true)

export HOMEBREW_PREFIX=/usr/local
export HOMEBREW_CELLAR=${HOMEBREW_PREFIX}/Cellar
Expand Down

0 comments on commit def8917

Please sign in to comment.