diff --git a/.conan/profiles/linux_aarch64_debug b/.conan/profiles/linux_aarch64_debug deleted file mode 100644 index 0af0118..0000000 --- a/.conan/profiles/linux_aarch64_debug +++ /dev/null @@ -1,7 +0,0 @@ -[settings] -os=Linux -arch=armv8 -compiler=gcc -compiler.version=11 -compiler.libcxx=libstdc++11 -build_type=Debug diff --git a/.conan/profiles/linux_aarch64_release b/.conan/profiles/linux_aarch64_release deleted file mode 100644 index 0cc37f3..0000000 --- a/.conan/profiles/linux_aarch64_release +++ /dev/null @@ -1,7 +0,0 @@ -[settings] -os=Linux -arch=armv8 -compiler=gcc -compiler.version=11 -compiler.libcxx=libstdc++11 -build_type=Release diff --git a/.conan/profiles/linux_x86_64_debug b/.conan/profiles/linux_x86_64_debug deleted file mode 100644 index 50797d4..0000000 --- a/.conan/profiles/linux_x86_64_debug +++ /dev/null @@ -1,7 +0,0 @@ -[settings] -os=Linux -arch=x86_64 -compiler=gcc -compiler.version=11 -compiler.libcxx=libstdc++11 -build_type=Debug diff --git a/.conan/profiles/linux_x86_64_release b/.conan/profiles/linux_x86_64_release deleted file mode 100644 index c823b20..0000000 --- a/.conan/profiles/linux_x86_64_release +++ /dev/null @@ -1,7 +0,0 @@ -[settings] -os=Linux -arch=x86_64 -compiler=gcc -compiler.version=11 -compiler.libcxx=libstdc++11 -build_type=Release diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 5356602..c1672eb 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -115,7 +115,8 @@ "cs128.cs128-clang-tidy", "matepek.vscode-catch2-test-adapter", "sanaajani.taskrunnercode", - "augustocdias.tasks-shell-input" + "augustocdias.tasks-shell-input", + "ms-vscode.cpptools-extension-pack" ] } }, diff --git a/.devcontainer/scripts/configure-codespaces.sh b/.devcontainer/scripts/configure-codespaces.sh new file mode 100755 index 0000000..c87599a --- /dev/null +++ b/.devcontainer/scripts/configure-codespaces.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json +# Copyright (c) 2023-2024 Contributors to the Eclipse Foundation +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +if [ "${CODESPACES}" = "true" ]; then + echo "#######################################################" + echo "### Setup Access to Codespaces ###" + echo "#######################################################" + + # restart Docker connection if in Codespaces + # Workaround according to https://github.com/devcontainers/features/issues/671#issuecomment-1701754897 + sudo pkill dockerd && sudo pkill containerd + /usr/local/share/docker-init.sh + + # Remove the default credential helper + sudo sed -i -E 's/helper =.*//' /etc/gitconfig + + # Add one that just uses secrets available in the Codespace + git config --global credential.helper '!f() { sleep 1; echo "username=${GITHUB_USER}"; echo "password=${MY_GH_TOKEN}"; }; f' +fi diff --git a/.devcontainer/scripts/onCreateCommand.sh b/.devcontainer/scripts/onCreateCommand.sh index 36cd560..1ebf260 100755 --- a/.devcontainer/scripts/onCreateCommand.sh +++ b/.devcontainer/scripts/onCreateCommand.sh @@ -14,75 +14,31 @@ # # SPDX-License-Identifier: Apache-2.0 -# exit when any command fails -set -e - -# restart Docker connection if in Codespaces -# Workaround according to https://github.com/devcontainers/features/issues/671#issuecomment-1701754897 -if [ "${CODESPACES}" = "true" ]; then - sudo pkill dockerd && sudo pkill containerd - /usr/local/share/docker-init.sh -fi - -echo "#######################################################" -echo "### Run VADF Lifecycle Management ###" -echo "#######################################################" -# needed to get rid of old leftovers -sudo rm -rf ~/.velocitas -velocitas init -velocitas sync - sudo chmod +x .devcontainer/scripts/*.sh sudo chown -R $(whoami) $HOME -echo "#######################################################" -echo "### Install Prerequisites and Tools ###" -echo "#######################################################" - -# Optionally install the cmake for vcpkg -.devcontainer/scripts/reinstall-cmake.sh ${REINSTALL_CMAKE_VERSION_FROM_SOURCE} - -# Install python, conan and ccache -sudo apt-get update -sudo apt-get install -y python3 -sudo apt-get install -y python3-distutils -curl -fsSL https://bootstrap.pypa.io/get-pip.py | sudo python3 -sudo apt-get -y install --no-install-recommends ccache - -pip3 install -r ./requirements.txt - -# Install static analyzer tools -sudo apt-get install -y cppcheck clang-format-14 clang-tidy-14 -sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-14 100 -sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-14 100 - -if [ "${CODESPACES}" = "true" ]; then - echo "#######################################################" - echo "### Setup Access to Codespaces ###" - echo "#######################################################" - - # Remove the default credential helper - sudo sed -i -E 's/helper =.*//' /etc/gitconfig +.devcontainer/scripts/setup-git.sh - # Add one that just uses secrets available in the Codespace - git config --global credential.helper '!f() { sleep 1; echo "username=${GITHUB_USER}"; echo "password=${MY_GH_TOKEN}"; }; f' +if [[ -z "${VELOCITAS_OFFLINE}" ]]; then + .devcontainer/scripts/configure-codespaces.sh + .devcontainer/scripts/upgrade-cli.sh +elif [[ -x .devcontainer/scripts/local-setup.sh ]]; then + .devcontainer/scripts/local-setup.sh fi echo "#######################################################" -echo "### Init submodules ###" +echo "### Run VADF Lifecycle Management ###" echo "#######################################################" -git config --global --add safe.directory "*" -git submodule update --init +velocitas init +velocitas sync -echo "#######################################################" -echo "### Install Dependencies ###" -echo "#######################################################" -velocitas exec build-system install 2>&1 | tee -a $HOME/install_dependencies.log +# Some setup might be required even in offline mode +.devcontainer/scripts/setup-dependencies.sh echo "#######################################################" echo "### VADF package status ###" echo "#######################################################" -velocitas upgrade --dry-run +velocitas upgrade --dry-run --ignore-bounds # Don't let container creation fail if lifecycle management fails echo "Done!" diff --git a/.devcontainer/scripts/postStartCommand.sh b/.devcontainer/scripts/postStartCommand.sh index c090c91..e9ad48a 100755 --- a/.devcontainer/scripts/postStartCommand.sh +++ b/.devcontainer/scripts/postStartCommand.sh @@ -1,6 +1,6 @@ #!/bin/bash # This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json -# Copyright (c) 2023-2024 Contributors to the Eclipse Foundation +# Copyright (c) 2024 Contributors to the Eclipse Foundation # # This program and the accompanying materials are made available under the # terms of the Apache License, Version 2.0 which is available at @@ -14,68 +14,4 @@ # # SPDX-License-Identifier: Apache-2.0 -echo "#######################################################" -echo "### Auto-Upgrade CLI ###" -echo "#######################################################" - -ROOT_DIRECTORY=$( realpath "$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )/../.." ) -DESIRED_VERSION=$(cat $ROOT_DIRECTORY/.velocitas.json | jq .cliVersion | tr -d '"') - -# Get installed CLI version -INSTALLED_VERSION=v$(velocitas --version | sed -E 's/velocitas-cli\/(\w+.\w+.\w+).*/\1/') - -if [ "$DESIRED_VERSION" = "$INSTALLED_VERSION" ]; then - echo "> Already up to date!" - exit 0 -else - echo "> Checking upgrade to $DESIRED_VERSION" -fi - -AUTHORIZATION_HEADER="" -if [ "${GITHUB_API_TOKEN}" != "" ]; then - AUTHORIZATION_HEADER="-H \"Authorization: Bearer ${GITHUB_API_TOKEN}\"" -fi - -if [ "$DESIRED_VERSION" = "latest" ]; then - CLI_RELEASES_URL=https://api.github.com/repos/eclipse-velocitas/cli/releases/latest -else - CLI_RELEASES_URL=https://api.github.com/repos/eclipse-velocitas/cli/releases/tags/${DESIRED_VERSION} -fi - -CLI_RELEASES=$(curl -s -L \ --H "Accept: application/vnd.github+json" \ --H "X-GitHub-Api-Version: 2022-11-28" \ -${AUTHORIZATION_HEADER} \ -${CLI_RELEASES_URL}) - -res=$? -if test "$res" != "0"; then - echo "the curl command failed with exit code: $res" - exit 0 -fi - -DESIRED_VERSION_TAG=$(echo ${CLI_RELEASES} | jq -r .name) - -if [ "$DESIRED_VERSION_TAG" = "null" ] || [ "$DESIRED_VERSION_TAG" = "" ]; then - echo "> Can't find desired Velocitas CLI version: $DESIRED_VERSION. Skipping Auto-Upgrade." - exit 0 -fi - -if [ "$DESIRED_VERSION_TAG" != "$INSTALLED_VERSION" ]; then - echo "> Upgrading CLI..." - if [[ $(arch) == "aarch64" ]]; then - CLI_ASSET_NAME=velocitas-linux-arm64 - else - CLI_ASSET_NAME=velocitas-linux-x64 - fi - CLI_INSTALL_PATH=/usr/bin/velocitas - CLI_DOWNLOAD_URL="https://github.com/eclipse-velocitas/cli/releases/download/${DESIRED_VERSION_TAG}/${CLI_ASSET_NAME}" - - echo "> Downloading Velocitas CLI from ${CLI_DOWNLOAD_URL}" - sudo curl -s -L ${CLI_DOWNLOAD_URL} -o "${CLI_INSTALL_PATH}" - sudo chmod +x "${CLI_INSTALL_PATH}" -else - echo "> Up to date!" -fi - -echo "> Using CLI: $(velocitas --version)" +.devcontainer/scripts/upgrade-cli.sh diff --git a/.devcontainer/scripts/setup-dependencies.sh b/.devcontainer/scripts/setup-dependencies.sh new file mode 100755 index 0000000..8773ac1 --- /dev/null +++ b/.devcontainer/scripts/setup-dependencies.sh @@ -0,0 +1,50 @@ +#!/bin/bash +# This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json +# Copyright (c) 2022-2024 Contributors to the Eclipse Foundation +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +echo "#######################################################" +echo "### Install Prerequisites and Tools ###" +echo "#######################################################" + +if [[ -z "${VELOCITAS_OFFLINE}" ]]; then + # Optionally install the cmake for vcpkg + .devcontainer/scripts/reinstall-cmake.sh ${REINSTALL_CMAKE_VERSION_FROM_SOURCE} + + # Install python, conan and ccache + sudo apt-get update + sudo apt-get install -y python3 + sudo apt-get install -y python3-distutils + curl -fsSL https://bootstrap.pypa.io/get-pip.py | sudo python3 + sudo apt-get -y install --no-install-recommends ccache + + build_arch=$(arch) + + # ensure we can always build for an arm target + if [ "${build_arch}" != "aarch64" ]; then + sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu + fi + + pip3 install -r ./requirements.txt + + # Install static analyzer tools + sudo apt-get install -y cppcheck clang-format-14 clang-tidy-14 + sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-14 100 + sudo update-alternatives --install /usr/bin/clang-tidy clang-tidy /usr/bin/clang-tidy-14 100 +fi + +echo "#######################################################" +echo "### Install Dependencies ###" +echo "#######################################################" +velocitas exec build-system install 2>&1 | tee -a $HOME/install_dependencies.log diff --git a/.devcontainer/scripts/setup-git.sh b/.devcontainer/scripts/setup-git.sh new file mode 100755 index 0000000..764a086 --- /dev/null +++ b/.devcontainer/scripts/setup-git.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json +# Copyright (c) 2022-2024 Contributors to the Eclipse Foundation +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +echo "#######################################################" +echo "### Setup Git ###" +echo "#######################################################" +# Add git name and email from env variables +if [[ -n "${GIT_CONFIG_NAME}" && -n "${GIT_CONFIG_EMAIL}" ]]; then + git config --global user.name $GIT_CONFIG_NAME + git config --global user.email $GIT_CONFIG_EMAIL +fi + +git config --global --add safe.directory "*" diff --git a/.devcontainer/scripts/upgrade-cli.sh b/.devcontainer/scripts/upgrade-cli.sh new file mode 100755 index 0000000..cb86141 --- /dev/null +++ b/.devcontainer/scripts/upgrade-cli.sh @@ -0,0 +1,81 @@ +#!/bin/bash +# This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json +# Copyright (c) 2023-2024 Contributors to the Eclipse Foundation +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +echo "#######################################################" +echo "### Auto-upgrade CLI ###" +echo "#######################################################" + +ROOT_DIRECTORY=$( realpath "$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )/../.." ) +DESIRED_VERSION=$(cat $ROOT_DIRECTORY/.velocitas.json | jq .cliVersion | tr -d '"') + +# Get installed CLI version +INSTALLED_VERSION=v$(velocitas --version | sed -E 's/velocitas-cli\/(\w+.\w+.\w+).*/\1/') + +if [ "$DESIRED_VERSION" = "$INSTALLED_VERSION" ]; then + echo "> Already up to date!" + exit 0 +else + echo "> Checking upgrade to $DESIRED_VERSION" +fi + +AUTHORIZATION_HEADER="" +if [ "${GITHUB_API_TOKEN}" != "" ]; then + AUTHORIZATION_HEADER="-H \"Authorization: Bearer ${GITHUB_API_TOKEN}\"" +fi + +if [ "$DESIRED_VERSION" = "latest" ]; then + CLI_RELEASES_URL=https://api.github.com/repos/eclipse-velocitas/cli/releases/latest +else + CLI_RELEASES_URL=https://api.github.com/repos/eclipse-velocitas/cli/releases/tags/${DESIRED_VERSION} +fi + +CLI_RELEASES=$(curl -s -L \ +-H "Accept: application/vnd.github+json" \ +-H "X-GitHub-Api-Version: 2022-11-28" \ +${AUTHORIZATION_HEADER} \ +${CLI_RELEASES_URL}) + +res=$? +if test "$res" != "0"; then + echo "the curl command failed with exit code: $res" + exit 0 +fi + +DESIRED_VERSION_TAG=$(echo ${CLI_RELEASES} | jq -r .name) + +if [ "$DESIRED_VERSION_TAG" = "null" ] || [ "$DESIRED_VERSION_TAG" = "" ]; then + echo "> Can't find desired Velocitas CLI version: $DESIRED_VERSION. Skipping Auto-Upgrade." + exit 0 +fi + +if [ "$DESIRED_VERSION_TAG" != "$INSTALLED_VERSION" ]; then + echo "> Upgrading CLI..." + if [[ $(arch) == "aarch64" ]]; then + CLI_ASSET_NAME=velocitas-linux-arm64 + else + CLI_ASSET_NAME=velocitas-linux-x64 + fi + CLI_INSTALL_PATH=/usr/bin/velocitas + CLI_DOWNLOAD_URL="https://github.com/eclipse-velocitas/cli/releases/download/${DESIRED_VERSION_TAG}/${CLI_ASSET_NAME}" + + echo "> Downloading Velocitas CLI from ${CLI_DOWNLOAD_URL}" + sudo curl -s -L ${CLI_DOWNLOAD_URL} -o "${CLI_INSTALL_PATH}" + sudo chmod +x "${CLI_INSTALL_PATH}" +else + echo "> Up to date!" +fi + +echo "> Using CLI: $(velocitas --version)" diff --git a/.github/workflows/check-devcontainer.yml b/.github/workflows/check-devcontainer.yml index 280a856..95a1a14 100644 --- a/.github/workflows/check-devcontainer.yml +++ b/.github/workflows/check-devcontainer.yml @@ -40,6 +40,7 @@ jobs: with: runCmd: | pip3 install -r .devcontainer/tests/automated_tests/requirements.txt + export PATH=$HOME/.local/bin:$PATH pytest -sx .devcontainer/tests - name: Upload logs diff --git a/.github/workflows/check-licenses.yml b/.github/workflows/check-licenses.yml index c8dcbf8..e2cffa6 100644 --- a/.github/workflows/check-licenses.yml +++ b/.github/workflows/check-licenses.yml @@ -26,6 +26,8 @@ on: pull_request: branches: - main + schedule: + - cron: "0 4 * * *" jobs: check-licenses: diff --git a/.github/workflows/check-updates.yml b/.github/workflows/check-updates.yml new file mode 100644 index 0000000..81fa6fb --- /dev/null +++ b/.github/workflows/check-updates.yml @@ -0,0 +1,75 @@ +# This file is maintained by velocitas CLI, do not modify manually. Change settings in .velocitas.json +# Copyright (c) 2024 Contributors to the Eclipse Foundation +# +# This program and the accompanying materials are made available under the +# terms of the Apache License, Version 2.0 which is available at +# https://www.apache.org/licenses/LICENSE-2.0. +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. +# +# SPDX-License-Identifier: Apache-2.0 + +name: Automatic Package Update Check + +on: + workflow_dispatch: + schedule: + - cron: "0 4 * * *" + +jobs: + package_update_check: + if: github.repository_owner == 'eclipse-velocitas' + runs-on: ubuntu-22.04 + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + with: + token: ${{ secrets.VELOCITAS_PROJECT_TOKEN }} + + - name: Use devcontainer for upgrade and PR creation + uses: devcontainers/ci@v0.3 + with: + runCmd: | + sudo apt-get update && sudo apt-get install -y gh + + echo "${{ secrets.VELOCITAS_PROJECT_TOKEN }}" | gh auth login --with-token + + velocitas upgrade --ignore-bounds && velocitas init && velocitas sync + + git config --global user.name "${{ github.actor }}" + git config --global user.email "${{ github.actor }}@users.noreply.github.com" + + if [ -n "$(git status --porcelain)" ]; then + PR_TITLE="Automated Package Update" + PR_BODY="This pull request was created automatically by GitHub Actions to update package versions." + + # Check if a PR with the same title already exists + PR_EXISTING=$(gh pr list --state open --search "$PR_TITLE" --json number | jq -r '.[0].number // empty') + + if [ -n "$PR_EXISTING" ]; then + echo "Existing PR found (#${PR_EXISTING}). Editing..." + git checkout . + gh pr checkout "$PR_EXISTING" + velocitas upgrade --ignore-bounds && velocitas init && velocitas sync + git add . + git commit -m "Update velocitas package versions" + if [ $? -eq 0 ]; then + git push + gh pr comment "$PR_EXISTING" --body "Updated PR with latest package updates" + fi + else + git add . + git commit -m "Update velocitas package versions" + BRANCH_NAME="automated-update-${{ github.sha }}" + git push origin HEAD:$BRANCH_NAME + echo "Creating new PR..." + gh pr create --title "$PR_TITLE" --body "$PR_BODY" --head $BRANCH_NAME --base main + fi + else + echo "No changes detected. Skip creating Pull Request." + fi diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 36cf598..c87467c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -65,7 +65,10 @@ jobs: run: ./build.sh -r - name: Run Unit Tests - run: build/bin/app_utests > test-results.md + shell: bash + run: | + set -o pipefail + build/bin/app_utests | tee test-results.md - name: Generate coverage report run: cd build && gcovr -r .. @@ -90,7 +93,9 @@ jobs: - name: Add test results to job summary run: | + echo -e "Unit test results: \n\`\`\` " >> $GITHUB_STEP_SUMMARY cat test-results.md >> $GITHUB_STEP_SUMMARY + echo -e "\n\`\`\`" >> $GITHUB_STEP_SUMMARY cat code-coverage-results.md >> $GITHUB_STEP_SUMMARY - name: Run Linters diff --git a/.github/workflows/ensure-lifecycle.yml b/.github/workflows/ensure-lifecycle.yml index 4c0ca3c..c6a88b9 100644 --- a/.github/workflows/ensure-lifecycle.yml +++ b/.github/workflows/ensure-lifecycle.yml @@ -23,6 +23,8 @@ on: pull_request: branches: - main + schedule: + - cron: "0 4 * * *" jobs: check-sync: @@ -51,6 +53,15 @@ jobs: echo "changed=0" >> $GITHUB_OUTPUT else echo "changed=1" >> $GITHUB_OUTPUT + + echo -e "## Summary of detected changes\n" >> $GITHUB_STEP_SUMMARY + echo -e "\`\`\`bash" >> $GITHUB_STEP_SUMMARY + git status --porcelain >> $GITHUB_STEP_SUMMARY + echo -e "\`\`\`" >> $GITHUB_STEP_SUMMARY + echo -e "## Diff Details\n" >> $GITHUB_STEP_SUMMARY + echo -e "\`\`\`bash" >> $GITHUB_STEP_SUMMARY + git diff >> $GITHUB_STEP_SUMMARY + echo -e "\`\`\`" >> $GITHUB_STEP_SUMMARY fi shell: bash diff --git a/.gitignore b/.gitignore index 9929e85..61f902e 100644 --- a/.gitignore +++ b/.gitignore @@ -49,7 +49,7 @@ *.pyc # CMake -build +build* # Mac files .DS_Store diff --git a/.velocitas-lock.json b/.velocitas-lock.json index 1bc2265..bcbb346 100644 --- a/.velocitas-lock.json +++ b/.velocitas-lock.json @@ -1,8 +1,8 @@ { "packages": { - "devenv-runtimes": "v4.0.5", - "devenv-github-workflows": "v6.0.4", + "devenv-runtimes": "v4.0.6", + "devenv-github-workflows": "v6.1.3", "devenv-github-templates": "v1.0.5", - "devenv-devcontainer-setup": "v2.4.4" + "devenv-devcontainer-setup": "v2.5.1" } } diff --git a/.velocitas.json b/.velocitas.json index 0a57d18..3256bb7 100644 --- a/.velocitas.json +++ b/.velocitas.json @@ -1,9 +1,9 @@ { "packages": { - "devenv-runtimes": "v4.0.5", - "devenv-github-workflows": "v6.0.4", + "devenv-runtimes": "v4.0.6", + "devenv-github-workflows": "v6.1.3", "devenv-github-templates": "v1.0.5", - "devenv-devcontainer-setup": "v2.4.4" + "devenv-devcontainer-setup": "v2.5.1" }, "components": [ "runtime-local", @@ -22,8 +22,7 @@ "language": "cpp", "repoType": "app", "appManifestPath": "app/AppManifest.json", - "githubRepoId": "eclipse-velocitas/vehicle-app-cpp-template", - "vehicleAppPort": -1 + "githubRepoId": "eclipse-velocitas/vehicle-app-cpp-template" }, - "cliVersion": "v0.10.1" + "cliVersion": "v0.13.0" } diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 6108515..1ad491a 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -34,7 +34,7 @@ ], "presentation": { "close": true, - "reveal": "never" + "reveal": "always" }, "problemMatcher": [ ] }, diff --git a/NOTICE-3RD-PARTY-CONTENT.md b/NOTICE-3RD-PARTY-CONTENT.md index 6a3ebbc..8c93b1e 100644 --- a/NOTICE-3RD-PARTY-CONTENT.md +++ b/NOTICE-3RD-PARTY-CONTENT.md @@ -4,7 +4,7 @@ | Dependency | Version | License | |:-----------|:-------:|--------:| |bottle|0.12.25|MIT| -|certifi|2024.7.4|Mozilla Public License 2.0| +|certifi|2024.8.30|Mozilla Public License 2.0| |cfgv|3.4.0|MIT| |charset-normalizer|3.3.2|MIT| |colorama|0.4.6|BSD| @@ -16,9 +16,9 @@ |filelock|3.15.4|The Unlicense (Unlicense)| |gcovr|5.2|BSD| |identify|2.6.0|MIT| -|idna|3.7|BSD| +|idna|3.8|BSD| |jinja2|3.1.4|BSD| -|lxml|5.2.2|New BSD| +|lxml|5.3.0|New BSD| |MarkupSafe|2.1.5|New BSD| |node-semver|0.6.1|MIT| |nodeenv|1.9.1|BSD| @@ -27,13 +27,13 @@ |pluginbase|1.0.1|BSD| |pre-commit|3.5.0|MIT| |pygments|2.18.0|Simplified BSD| -|PyJWT|2.8.0|MIT| +|PyJWT|2.9.0|MIT| |python-dateutil|2.9.0.post0|Apache 2.0
BSD| -|PyYAML|6.0.1|MIT| +|PyYAML|6.0.2|MIT| |requests|2.32.3|Apache 2.0| |six|1.16.0|MIT| -|tqdm|4.66.4|MIT
Mozilla Public License 2.0 (MPL 2.0)| -|urllib3|1.26.19|MIT| +|tqdm|4.66.5|MIT
Mozilla Public License 2.0 (MPL 2.0)| +|urllib3|1.26.20|MIT| |virtualenv|20.26.3|MIT| ## Workflows | Dependency | Version | License | diff --git a/README.md b/README.md index 6b17fdb..4be5b0e 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,6 @@ The Vehicle App Template for C++ allows to create `Vehicle Apps` from the [Veloc * 📁 `app` - base directory for a vehicle app * 📁 `src` - source code of the vehicle app * 📁 `tests` - tests for the vehicle app - * 📁 `vehicle_model` - vehicle model to be used by the vehicle app ## Building diff --git a/build.py b/build.py deleted file mode 100644 index ec2ac4d..0000000 --- a/build.py +++ /dev/null @@ -1,193 +0,0 @@ -# Copyright (c) 2024 Contributors to the Eclipse Foundation -# -# This program and the accompanying materials are made available under the -# terms of the Apache License, Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0. -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# -# SPDX-License-Identifier: Apache-2.0 - -import json -import os -import subprocess -from argparse import ArgumentParser -from pathlib import Path -from typing import List - -from velocitas_lib import get_valid_arch, get_workspace_dir - -CMAKE_EXECUTABLE = "cmake" -CONAN_EXECUTABLE = "conan" - - -def safe_get_workspace_dir() -> str: - """A safe version of get_workspace_dir which defaults to '.'.""" - try: - return get_workspace_dir() - except Exception: - return "." - - -def get_build_tools_path(build_folder_path: str) -> str: - paths: List[str] = [] - with open( - os.path.join(build_folder_path, "conanbuildinfo.txt"), encoding="utf-8" - ) as file: - for line in file: - if line.startswith("PATH="): - path_list = json.loads(line[len("PATH=") :]) - paths.extend(path_list) - return ";".join(paths) - - -def print_build_info( - build_variant: str, - build_arch: str, - host_arch: str, - build_target: str, - is_static_build: bool, -) -> None: - """Print information about the build. - - Args: - build_variant (str): The variant of the build: "release" or "debug" - build_arch (str): The architecture the app is built for. - build_target (str): Which artefact is being built. - is_static_build (bool): Enable static building. - """ - cmake_version = subprocess.check_output( - [CMAKE_EXECUTABLE, "--version"], encoding="utf-8" - ).strip() - conan_version = subprocess.check_output( - [CONAN_EXECUTABLE, "--version"], encoding="utf-8" - ).strip() - - print(f"CMake version {cmake_version}") - print(f"Conan version {conan_version}") - print(f"Build arch {build_arch}") - print(f"Host arch {host_arch}") - print(f"Build variant {build_variant}") - print(f"Build target {build_target}") - print(f"Static build {'yes' if is_static_build else 'no'}") - - -def build( - build_variant: str, - build_arch: str, - host_arch: str, - build_target: str, - static_build: bool, - coverage: bool = True, -) -> None: - build_folder = os.path.join(safe_get_workspace_dir(), "build") - - cxx_flags = ["-g"] - if coverage: - cxx_flags.append("--coverage") - - if build_variant == "release": - cxx_flags.append("-O3") - else: - cxx_flags.append("-O0") - - os.makedirs(build_folder, exist_ok=True) - - xcompile_toolchain_file = "" - if build_arch != host_arch: - profile_build_path = ( - Path(__file__) - .absolute() - .parent.joinpath("cmake", f"{build_arch}_to_{host_arch}.cmake") - ) - xcompile_toolchain_file = f"-DCMAKE_TOOLCHAIN_FILE={profile_build_path}" - - subprocess.run( - [ - CMAKE_EXECUTABLE, - "--no-warn-unused-cli", - "-DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE", - f"-DCMAKE_BUILD_TYPE:STRING={build_variant}", - f'-DBUILD_TOOLS_PATH:STRING="{get_build_tools_path(build_folder)}"', - f"-DSTATIC_BUILD:BOOL={'TRUE' if static_build else 'FALSE'}", - xcompile_toolchain_file, - "-S..", - "-B.", - "-G", - "Ninja", - f"-DCMAKE_CXX_FLAGS={' '.join(cxx_flags)}", - ], - cwd=build_folder, - ) - subprocess.run( - [ - CMAKE_EXECUTABLE, - "--build", - ".", - "--config", - build_variant, - "--target", - build_target, - ], - cwd=build_folder, - ) - - -def cli() -> None: - parser = ArgumentParser( - description="""Build targets of the project -============================================================================ -Builds the targets of the project in different flavors.""" - ) - parser.add_argument( - "-d", - "--debug", - action="store_const", - const="debug", - dest="variant", - help="Builds the target(s) in debug mode.", - ) - parser.add_argument( - "-r", - "--release", - action="store_const", - const="release", - dest="variant", - help="Builds the target(s) in release mode.", - ) - parser.add_argument( - "-t", "--target", help="Builds only the target instead of all targets." - ) - parser.add_argument( - "-s", "--static", action="store_true", help="Links all dependencies statically." - ) - parser.add_argument( - "-x", - "--cross", - action="store", - help="Enables cross-compilation to the defined target architecture.", - ) - args = parser.parse_args() - if not args.variant: - args.variant = "debug" - if not args.target: - args.target = "all" - build_arch = subprocess.check_output(["arch"], encoding="utf-8").strip() - - host_arch = args.cross - - if host_arch is None: - host_arch = build_arch - else: - host_arch = get_valid_arch(host_arch) - - print_build_info(args.variant, build_arch, host_arch, args.target, args.static) - build(args.variant, build_arch, host_arch, args.target, args.static) - - -if __name__ == "__main__": - cli() diff --git a/build.sh b/build.sh index b1098d7..73381b4 100755 --- a/build.sh +++ b/build.sh @@ -15,6 +15,7 @@ # # SPDX-License-Identifier: Apache-2.0 -# Provides backward compatibility for all scripts and pipelines -# which use the bash variant. -python3 ./build.py $@ +# Keeping this script provides backward compatibility for all scripts and +# pipelines relying on it. + +velocitas exec build-system build $@ diff --git a/cmake/aarch64_to_x86_64.cmake b/cmake/aarch64_to_x86_64.cmake deleted file mode 100644 index f1a4cd1..0000000 --- a/cmake/aarch64_to_x86_64.cmake +++ /dev/null @@ -1,20 +0,0 @@ -# the name of the target operating system -set(CMAKE_SYSTEM_NAME Linux) -set(CMAKE_SYSTEM_PROCESSOR x86_64) - -set(TARGET_HOST x86_64-linux-gnu) - -# which compilers to use for C and C++ -set(CMAKE_C_COMPILER ${TARGET_HOST}-gcc) -set(CMAKE_CXX_COMPILER ${TARGET_HOST}-g++) - -# where is the target environment located -set(CMAKE_FIND_ROOT_PATH /usr/bin/x86_64-linux-gnu) - -# adjust the default behavior of the FIND_XXX() commands: -# search programs in the host environment -set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) - -# search headers and libraries in the target environment -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/cmake/x86_64_to_aarch64.cmake b/cmake/x86_64_to_aarch64.cmake deleted file mode 100644 index 473f4f9..0000000 --- a/cmake/x86_64_to_aarch64.cmake +++ /dev/null @@ -1,20 +0,0 @@ -# the name of the target operating system -set(CMAKE_SYSTEM_NAME Linux) -set(CMAKE_SYSTEM_PROCESSOR aarch64) - -set(TARGET_HOST aarch64-linux-gnu) - -# which compilers to use for C and C++ -set(CMAKE_C_COMPILER ${TARGET_HOST}-gcc) -set(CMAKE_CXX_COMPILER ${TARGET_HOST}-g++) - -# where is the target environment located -set(CMAKE_FIND_ROOT_PATH /usr/bin/aarch64-linux-gnu) - -# adjust the default behavior of the FIND_XXX() commands: -# search programs in the host environment -set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) - -# search headers and libraries in the target environment -set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) diff --git a/install_dependencies.sh b/install_dependencies.sh index 6089dfc..2309dde 100755 --- a/install_dependencies.sh +++ b/install_dependencies.sh @@ -15,6 +15,7 @@ # # SPDX-License-Identifier: Apache-2.0 -# Provides backward compatibility for all scripts and pipelines -# which use the bash variant. -python3 ./install_deps.py $@ +# Keeping this script provides backward compatibility for all scripts and +# pipelines relying on it. + +velocitas exec build-system install $@ diff --git a/install_deps.py b/install_deps.py deleted file mode 100644 index 28b00e5..0000000 --- a/install_deps.py +++ /dev/null @@ -1,148 +0,0 @@ -# Copyright (c) 2023-2024 Contributors to the Eclipse Foundation -# -# This program and the accompanying materials are made available under the -# terms of the Apache License, Version 2.0 which is available at -# https://www.apache.org/licenses/LICENSE-2.0. -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations -# under the License. -# -# SPDX-License-Identifier: Apache-2.0 - -""" -Install all software depenencies of the given Velocitas project via a -simple command line interface. -""" - -import os -import subprocess -from argparse import ArgumentParser -from pathlib import Path - -from velocitas_lib import get_valid_arch, get_workspace_dir - - -def safe_get_workspace_dir() -> str: - """A safe version of get_workspace_dir which defaults to '.'.""" - try: - return get_workspace_dir() - except Exception: - return "." - - -def get_profile_name(arch: str, build_variant: str) -> str: - """Return the Conan profile name for the given `arch` and - `build_variant`. - - Args: - arch (str): The architecture of the profile. - build_variant (str): The build variant (debug or release). - - Returns: - str: The Conan profile name. - """ - return f"linux_{get_valid_arch(arch)}_{build_variant}" - - -def install_deps_via_conan( - build_arch: str, - host_arch: str, - is_debug: bool = False, - build_all_deps: bool = False, -) -> None: - build_variant = "debug" if is_debug else "release" - - profile_build_path = ( - Path(__file__) - .absolute() - .parent.joinpath( - ".conan", "profiles", get_profile_name(build_arch, build_variant) - ) - ) - - profile_host_path = ( - Path(__file__) - .absolute() - .parent.joinpath( - ".conan", "profiles", get_profile_name(host_arch, build_variant) - ) - ) - - build_folder = os.path.join(safe_get_workspace_dir(), "build") - os.makedirs(build_folder, exist_ok=True) - - deps_to_build = "missing" if not build_all_deps else "*" - - toolchain = f"/usr/bin/{host_arch}-linux-gnu" - build_host = f"{host_arch}-linux-gnu" - cc_compiler = "gcc" - cxx_compiler = "g++" - - os.environ["CONAN_CMAKE_FIND_ROOT_PATH"] = toolchain - os.environ["CONAN_CMAKE_SYSROOT"] = toolchain - os.environ["CC"] = f"{build_host}-{cc_compiler}" - os.environ["CXX"] = f"{build_host}-{cxx_compiler}" - - subprocess.check_call( - [ - "conan", - "install", - "-pr:h", - profile_host_path, - "-pr:b", - profile_build_path, - "--build", - deps_to_build, - "..", - ], - env=os.environ, - cwd=build_folder, - ) - - -def cli() -> None: - argument_parser = ArgumentParser(description="Installs dependencies") - argument_parser.add_argument( - "-d", - "--debug", - action="store_true", - help="Installs all dependencies in debug mode.", - ) - argument_parser.add_argument( - "-r", - "--release", - action="store_true", - help="Installs all dependencies in release mode.", - ) - argument_parser.add_argument( - "-ba", - "--build-all-deps", - action="store_true", - help="Forces all dependencies to be rebuild from source.", - ) - argument_parser.add_argument( - "-x", - "--cross", - action="store", - help="Enables cross-compilation to the defined target architecture.", - ) - args = argument_parser.parse_args() - - build_arch = subprocess.check_output(["arch"], encoding="utf-8").strip() - host_arch = args.cross - - if host_arch is None: - host_arch = build_arch - - subprocess.check_call(["conan", "config", "set", "general.revisions_enabled=1"]) - - install_deps_via_conan( - build_arch, host_arch, args.debug and not args.release, args.build_all_deps - ) - - -if __name__ == "__main__": - cli()