Skip to content
Open
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
14 changes: 13 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ CURRENT_DIR = ${CURDIR}
BUILD_DIR ?= $(CURRENT_DIR)/build
PYTHON_BIN ?= python3

API_VERSION := $(shell python3 -c "exec(open('$(CURRENT_DIR)/web/codechecker_web/shared/version.py').read()); print(f'{max(SUPPORTED_VERSIONS)}.{SUPPORTED_VERSIONS[max(SUPPORTED_VERSIONS)]}.0')")
VENV_API_VERSION := $(shell pip show codechecker-api 2>/dev/null | grep "^Version:" | cut -d' ' -f2)

CC_BUILD_DIR = $(BUILD_DIR)/CodeChecker
CC_BUILD_BIN_DIR = $(CC_BUILD_DIR)/bin
CC_BUILD_WEB_DIR = $(CC_BUILD_DIR)/www
Expand Down Expand Up @@ -41,7 +44,7 @@ mkdocs_build:
package_gerrit_skiplist: package_dir_structure
cp -p scripts/gerrit_changed_files_to_skipfile.py $(CC_BUILD_BIN_DIR)

package: package_dir_structure set_git_commit_template package_gerrit_skiplist
package: package_dir_structure set_git_commit_template package_gerrit_skiplist check_api_version
BUILD_DIR=$(BUILD_DIR) BUILD_LOGGER_64_BIT_ONLY=$(BUILD_LOGGER_64_BIT_ONLY) $(MAKE) -C $(CC_ANALYZER) package_analyzer
BUILD_DIR=$(BUILD_DIR) $(MAKE) -C $(CC_WEB) package_web

Expand Down Expand Up @@ -245,3 +248,12 @@ test_functional_in_env:

set_git_commit_template:
if [ -d "$(CURRENT_DIR)/.git" ]; then git config --local commit.template .gitmessage; fi

check_api_version:
@if [ "$(API_VERSION)" != "$(VENV_API_VERSION)" ]; then \
echo "ERROR: API version mismatch! Source: $(API_VERSION), venv: $(VENV_API_VERSION)"; \
echo "Please run './web/api/completly-rebuild-thrift.sh <venv|venv_dev>' to rebuild the Thrift API."; \
exit 1; \
else \
echo "API versions match: $(API_VERSION)"; \
fi
58 changes: 58 additions & 0 deletions web/api/completly-rebuild-thrift.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#!/bin/bash

set -e # Exit on any error

echo "Starting CodeChecker Thrift rebuild process..."

# Resolve the repository root from the script's location.
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"

# check if which enviroment to create is passed as an argument.
if [[ "$1" == "venv" || "$1" == "venv_dev" ]]; then
ENV_TYPE="$1"
else
echo "Error: You must specify 'venv' or 'venv_dev' as the first argument."
echo "Usage: $0 <venv|venv_dev>"
exit 1
fi

# Step 1: Build the API
echo "Step 1: Building API..."
cd "$REPO_ROOT/web/api"
make build

# Step 2: Execute the main rebuild process
echo "Step 2: Executing main rebuild..."
cd "$REPO_ROOT"

# Deactivation of virtual enviroment
echo "Deactivating current environment..."
if command -v deactivate &> /dev/null; then
deactivate 2>/dev/null || true
fi

# Resetting the package-lock.json just in case
echo "Resetting package-lock.json..."
git checkout master -- "$REPO_ROOT/web/server/vue-cli/package-lock.json"
git reset HEAD "$REPO_ROOT/web/server/vue-cli/package-lock.json"

# Cleaning
echo "Cleaning previous builds..."
make clean
make "clean_${ENV_TYPE}"

# Creating new virtual environment
echo "Creating new virtual environment ($ENV_TYPE)..."
make "$ENV_TYPE"

echo "Building package..."
make package

# Again just in case
echo "Activating virtual environment and setting PATH..."
source "$REPO_ROOT/${ENV_TYPE}/bin/activate"
export PATH="$REPO_ROOT/build/CodeChecker/bin:$PATH"

echo "CodeChecker rebuild completed successfully!"
echo "You can now use CodeChecker commands."
Loading