Commit 7dde4392 authored by illsilin's avatar illsilin
Browse files

run check_host function when enabling sccache

parent b6a381d3
......@@ -65,9 +65,9 @@ def getDockerImageName(){
}
def check_host() {
if ("${env.CK_SCCACHE}" != "null" && params.USE_SCCACHE){
if ("${env.CK_SCCACHE}" != "null"){
def SCCACHE_SERVER="${env.CK_SCCACHE.split(':')[0]}"
echo "ccache server: ${SCCACHE_SERVER}"
echo "sccache server: ${SCCACHE_SERVER}"
sh '''ping -c 1 -p 6379 "${SCCACHE_SERVER}" | echo $? > tmp.txt'''
def output = readFile(file: "tmp.txt")
echo "tmp.txt contents: \$output"
......@@ -189,7 +189,7 @@ def cmake_build(Map conf=[:]){
}else{
setup_args = " -DCMAKE_BUILD_TYPE=release" + setup_args
}
if(env.CK_SCCACHE && params.USE_SCCACHE)
if(env.CK_SCCACHE && params.USE_SCCACHE && check_host())
{
setup_args = " -DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache " + setup_args
}
......@@ -202,7 +202,9 @@ def cmake_build(Map conf=[:]){
rm -rf install
mkdir install
cd build
if [ "${env.CK_SCCACHE}" != "null" ] && [ "${params.USE_SCCACHE}" = "true" ]; then \
"""
if(check_host() && params.USE_SCCACHE && "${env.CK_SCCACHE}" != "null") {
pre_setup_cmd = pre_setup_cmd + """#!/bin/bash
export ROCM_PATH=/opt/rocm
export SCCACHE_ENABLED=true
export SCCACHE_LOG_LEVEL=debug
......@@ -225,8 +227,8 @@ def cmake_build(Map conf=[:]){
echo \$SCCACHE_C_CUSTOM_CACHE_BUSTER
stunnel ../script/redis-cli.conf
../script/sccache_wrapper.sh --enforce_redis
fi
"""
}
def setup_cmd = conf.get("setup_cmd", "${cmake_envs} cmake ${setup_args} .. ")
// reduce parallelism when compiling, clang uses too much memory
def nt = nthreads()
......
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