Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions cov_docker_script/common_build_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,16 @@ check_dependencies() {
return 0
}

# Get latest commit id
get_latest_sha() {
local repo_path="$1"

git -C "$repo_path" rev-parse -is-inside-work-tree >/dev/null 2>&1 \
|| { echo "Invalid git repo"; return 1; }

git -C "$repo_path" rev-parse --short HEAD
}
Comment on lines +47 to +51

# Clone a git repository
clone_repo() {
local name="$1" repo="$2" branch="$3" dest="$4"
Expand Down
18 changes: 17 additions & 1 deletion cov_docker_script/setup_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,13 @@ initialize_environment() {
[[ -d "$BUILD_DIR" ]] && rm -rf "$BUILD_DIR"
[[ -d "$USR_DIR" ]] && rm -rf "$USR_DIR"
fi


# Rebuild if requested
if [[ "${RE_BUILD:-false}" == "true" ]]; then
warn "Removing previous build completed flags"
[[ -d "$BUILD_DIR" ]] && find "$BUILD_DIR" -type f -name 'build_*.done' -print -delete
fi

# Create directories
mkdir -p "$BUILD_DIR"
mkdir -p "$USR_DIR/include/rdkb"
Expand Down Expand Up @@ -100,6 +106,15 @@ build_repository() {
log "No build configuration for $name (headers only)"
return 0
fi

local LATEST_SHA="$(get_latest_sha "$repo_dir")"
if [ -f "$repo_dir/build_${LATEST_SHA}.done" ]; then
# Copy libraries
copy_libraries "$repo_dir" "$USR_DIR/local/lib"
copy_libraries "$repo_dir" "$USR_DIR/lib"
log "Build already done for SHA: $LATEST_SHA, skipping rebuild."
return 0
Comment on lines +110 to +116
fi

step "Building $name (type: $build_type)"

Expand Down Expand Up @@ -174,6 +189,7 @@ build_repository() {
copy_libraries "$repo_dir" "$USR_DIR/lib"

ok "$name build completed"
touch "$repo_dir/build_${LATEST_SHA}.done"
Comment on lines 191 to +192
return 0
}

Expand Down
Loading