From e7d0198adc04faf4b5864730657c4f9e03216bc5 Mon Sep 17 00:00:00 2001 From: Oleksandr Grytsov Date: Tue, 26 Aug 2025 11:28:12 +0300 Subject: [PATCH 1/5] build: remove unused variables from build.sh Signed-off-by: Oleksandr Grytsov Reviewed-by: Mykola Solianko Reviewed-by: Mykola Kobets --- build.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/build.sh b/build.sh index 3857f3a31..f51ed9e90 100755 --- a/build.sh +++ b/build.sh @@ -24,7 +24,6 @@ print_usage() { echo echo "Options:" echo " --clean cleans build artifacts" - echo " --aos-service specifies services (e.g., sm,mp,iam)" echo " --ci uses build-wrapper for CI analysis (SonarQube)" echo " --parallel specifies number of parallel jobs for build (default: all available cores)" echo @@ -176,7 +175,6 @@ command="$1" shift ARG_CLEAN_FLAG=false -ARG_AOS_SERVICES="" ARG_CI_FLAG=false ARG_PARALLEL_JOBS=$(nproc) From 174be848ee86dbdc6e43b7104b5fc43d1fb2f259 Mon Sep 17 00:00:00 2001 From: Oleksandr Grytsov Date: Tue, 26 Aug 2025 17:37:51 +0300 Subject: [PATCH 2/5] build: allow continue build with --clean option `clean` now means: clean build artifacts before build. Signed-off-by: Oleksandr Grytsov Reviewed-by: Mykola Solianko Reviewed-by: Mykola Kobets --- build.sh | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/build.sh b/build.sh index f51ed9e90..696baac04 100755 --- a/build.sh +++ b/build.sh @@ -23,7 +23,7 @@ print_usage() { echo " doc generates documentation" echo echo "Options:" - echo " --clean cleans build artifacts" + echo " --clean cleans build artifacts before building" echo " --ci uses build-wrapper for CI analysis (SonarQube)" echo " --parallel specifies number of parallel jobs for build (default: all available cores)" echo @@ -116,8 +116,6 @@ parse_arguments() { build_target() { if [ "$ARG_CLEAN_FLAG" == "true" ]; then clean_build - - return fi conan_setup From db53712f4c0f9843212a4d0f5df6ea2291bdaaeb Mon Sep 17 00:00:00 2001 From: Oleksandr Grytsov Date: Tue, 26 Aug 2025 17:40:02 +0300 Subject: [PATCH 3/5] build: add --build-type option to select build type `build-type` option allows to choose `Release`, `Debug`, `RelWithDebInfo` and `MinSizeRel` build type. Signed-off-by: Oleksandr Grytsov Reviewed-by: Mykola Solianko Reviewed-by: Mykola Kobets --- build.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index 696baac04..594ddcdcf 100755 --- a/build.sh +++ b/build.sh @@ -26,6 +26,7 @@ print_usage() { echo " --clean cleans build artifacts before building" echo " --ci uses build-wrapper for CI analysis (SonarQube)" echo " --parallel specifies number of parallel jobs for build (default: all available cores)" + echo " --build-type specifies build type (default: Debug, other options: Release, RelWithDebInfo, MinSizeRel)" echo } @@ -57,7 +58,7 @@ conan_setup() { print_next_step "Generate conan toolchain" - conan install ./conan/ --output-folder build --settings=build_type=Debug --build=missing + conan install ./conan/ --output-folder build --settings=build_type="$ARG_BUILD_TYPE" --build=missing } build_project() { @@ -65,7 +66,7 @@ build_project() { cmake -S . -B build \ -DCMAKE_TOOLCHAIN_FILE=./conan_toolchain.cmake \ - -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_BUILD_TYPE="$ARG_BUILD_TYPE" \ -G "Unix Makefiles" \ -DCoverage_SONARQUBE=ON \ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ @@ -77,11 +78,11 @@ build_project() { if [ "$ARG_CI_FLAG" == "true" ]; then print_next_step "Run build-wrapper and build (CI mode)" - build-wrapper-linux-x86-64 --out-dir "$BUILD_WRAPPER_OUT_DIR" cmake --build ./build/ --config Debug --parallel ${ARG_PARALLEL_JOBS} + build-wrapper-linux-x86-64 --out-dir "$BUILD_WRAPPER_OUT_DIR" cmake --build ./build/ --config "$ARG_BUILD_TYPE" --parallel "$ARG_PARALLEL_JOBS" else print_next_step "Run build" - cmake --build ./build/ --config Debug --parallel ${ARG_PARALLEL_JOBS} + cmake --build ./build/ --config "$ARG_BUILD_TYPE" --parallel "$ARG_PARALLEL_JOBS" fi echo @@ -106,6 +107,11 @@ parse_arguments() { shift 2 ;; + --build-type) + ARG_BUILD_TYPE="$2" + shift 2 + ;; + *) error_with_usage "Unknown option: $1" ;; @@ -175,6 +181,7 @@ shift ARG_CLEAN_FLAG=false ARG_CI_FLAG=false ARG_PARALLEL_JOBS=$(nproc) +ARG_BUILD_TYPE="Debug" case "$command" in build) From b43269a7a60abc5a84b8ce7c7aa74019ab2b38ea Mon Sep 17 00:00:00 2001 From: Oleksandr Grytsov Date: Tue, 26 Aug 2025 17:58:13 +0300 Subject: [PATCH 4/5] ci: add relase build on CI Signed-off-by: Oleksandr Grytsov Reviewed-by: Mykola Solianko Reviewed-by: Mykola Kobets --- .github/workflows/build-test.yaml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 4205d9ac3..0040bd673 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -44,9 +44,13 @@ jobs: - name: Install build wrapper uses: SonarSource/sonarqube-scan-action/install-build-wrapper@v5 - - name: Build + - name: Build (Release) run: | - ./build.sh build --ci + ./build.sh build --build-type Release + + - name: Build (Debug) + run: | + ./build.sh build --ci --clean - name: Test run: | @@ -62,7 +66,7 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} files: ./build/coverage.total - - name: SonarQube analysis + - name: SonarQube analysis (on push) if: github.event_name == 'push' uses: SonarSource/sonarqube-scan-action@v5 env: @@ -73,7 +77,7 @@ jobs: --define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json" --define sonar.coverageReportPaths=build/coverage_sonarqube.xml - - name: SonarQube analysis + - name: SonarQube analysis (on pull request) if: github.event_name == 'pull_request_target' uses: SonarSource/sonarqube-scan-action@v5 env: From f2407225e30ad1a4368a99b0f865fdb6b9005b74 Mon Sep 17 00:00:00 2001 From: Oleksandr Grytsov Date: Tue, 26 Aug 2025 17:58:49 +0300 Subject: [PATCH 5/5] cmake: increase stack usage warning up to 8192 bytes As we don't use dynamic memory allocation, we need more stack for local variables. Signed-off-by: Oleksandr Grytsov Reviewed-by: Mykola Solianko Reviewed-by: Mykola Kobets --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1f6c2b070..8d479eb26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,7 +33,7 @@ message(STATUS) # Check compiler using static library instead of application set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY) -set(AOS_STACK_USAGE 4096) +set(AOS_STACK_USAGE 8192) # ###################################################################################################################### # Compiler flags