diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 71c1ae4ac1..43c37afc7f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -7,189 +7,189 @@ on: - 'doc/**' jobs: - build-linux: - name: ${{ matrix.config.name }} - runs-on: ubuntu-latest - timeout-minutes: 60 - strategy: - fail-fast: false - matrix: - config: - - { - name: 'Build on Linux (Jammy, gcc)', - image: 'jammy-qt6', - options: 'modules.cpp.compilerWrapper:ccache - modules.qbs.debugInformation:true - modules.qbsbuildconfig.enableBundledQt:true - products.qbs_archive.targetName:qbs-linux-jammy-${{ github.run_id }} - products.qbs_archive.includeTests:true', - script: './scripts/build-qbs-with-qbs.sh', - cacheid: 'gcc-qt6-jammy', - suffix: 'linux-jammy', - } - env: - BUILD_OPTIONS: ${{ matrix.config.options }} - WITH_TESTS: 0 - steps: - - uses: actions/checkout@v1 - - name: Create .ccache dir - run: mkdir -p ~/.ccache - - name: ccache cache files - uses: actions/cache@v4 - with: - path: ~/.ccache - key: ${{ runner.os }}-${{ matrix.config.cacheid }}-ccache - - name: Pull the Docker Image - run: docker-compose pull ${{ matrix.config.image }} - - name: Print ccache stats - run: docker-compose run ${{ matrix.config.image }} ccache -s - - name: Build Qbs - run: docker-compose run ${{ matrix.config.image }} ${{ matrix.config.script }} - - name: Print ccache stats - run: docker-compose run ${{ matrix.config.image }} ccache -s - - name: Upload artifacts - uses: 'actions/upload-artifact@v4' - with: - name: qbs-${{ matrix.config.suffix }}-${{ github.run_id }}.tar.gz - path: release/qbs-${{ matrix.config.suffix }}-${{ github.run_id }}.tar.gz +# build-linux: +# name: ${{ matrix.config.name }} +# runs-on: ubuntu-latest +# timeout-minutes: 60 +# strategy: +# fail-fast: false +# matrix: +# config: +# - { +# name: 'Build on Linux (Jammy, gcc)', +# image: 'jammy-qt6', +# options: 'modules.cpp.compilerWrapper:ccache +# modules.qbs.debugInformation:true +# modules.qbsbuildconfig.enableBundledQt:true +# products.qbs_archive.targetName:qbs-linux-jammy-${{ github.run_id }} +# products.qbs_archive.includeTests:true', +# script: './scripts/build-qbs-with-qbs.sh', +# cacheid: 'gcc-qt6-jammy', +# suffix: 'linux-jammy', +# } +# env: +# BUILD_OPTIONS: ${{ matrix.config.options }} +# WITH_TESTS: 0 +# steps: +# - uses: actions/checkout@v1 +# - name: Create .ccache dir +# run: mkdir -p ~/.ccache +# - name: ccache cache files +# uses: actions/cache@v4 +# with: +# path: ~/.ccache +# key: ${{ runner.os }}-${{ matrix.config.cacheid }}-ccache +# - name: Pull the Docker Image +# run: docker-compose pull ${{ matrix.config.image }} +# - name: Print ccache stats +# run: docker-compose run ${{ matrix.config.image }} ccache -s +# - name: Build Qbs +# run: docker-compose run ${{ matrix.config.image }} ${{ matrix.config.script }} +# - name: Print ccache stats +# run: docker-compose run ${{ matrix.config.image }} ccache -s +# - name: Upload artifacts +# uses: 'actions/upload-artifact@v4' +# with: +# name: qbs-${{ matrix.config.suffix }}-${{ github.run_id }}.tar.gz +# path: release/qbs-${{ matrix.config.suffix }}-${{ github.run_id }}.tar.gz - build-linux-extra: - name: ${{ matrix.config.name }} - runs-on: ubuntu-latest - timeout-minutes: 90 - strategy: - fail-fast: false - matrix: - config: - - { - name: 'Build on Linux (clang_tidy)', - script: './scripts/run-analyzer.sh', - image: 'jammy-qt6', - options: 'profile:qt-clang_64 modules.cpp.compilerWrapper:ccache', - cacheid: 'clang', - } - - { - name: 'Build on Linux (CMake)', - script: './scripts/build-qbs-with-cmake.sh', - image: 'jammy-qt6', - cacheid: 'cmake', - } - - { - name: 'Build on Linux (gcc, ASAN)', - image: 'jammy-qt6', - script: './scripts/build-qbs-with-qbs.sh', - options: 'modules.cpp.compilerWrapper:ccache - modules.qbsbuildconfig.enableAddressSanitizer:true - modules.qbs.debugInformation:true - modules.qbsbuildconfig.enableBundledQt:true', - cacheid: 'gcc-asan', - } - - { - name: 'Build on Linux (gcc, UBSAN)', - image: 'jammy-qt6', - script: './scripts/build-qbs-with-qbs.sh', - options: 'modules.cpp.compilerWrapper:ccache - modules.qbsbuildconfig.enableUbSanitizer:true - modules.qbs.debugInformation:true - modules.qbsbuildconfig.enableBundledQt:true', - cacheid: 'gcc-ubsan', - } - - { - name: 'Build on Linux (gcc, Qt 5.15)', - image: 'jammy-qt5', - script: './scripts/build-qbs-with-qbs.sh', - options: 'modules.cpp.compilerWrapper:ccache - modules.qbs.debugInformation:true - modules.qbsbuildconfig.enableBundledQt:true', - cacheid: 'gcc-qt5', - } - env: - BUILD_OPTIONS: ${{ matrix.config.options }} - QTEST_FUNCTION_TIMEOUT: 9000000 - steps: - - uses: actions/checkout@v1 - - name: Create .ccache dir - run: mkdir -p ~/.ccache - - name: ccache cache files - uses: actions/cache@v4 - with: - path: ~/.ccache - key: ${{ runner.os }}-${{ matrix.config.cacheid }}-ccache - - name: Pull the Docker Image - run: docker-compose pull ${{ matrix.config.image }} - - name: Print ccache stats - run: docker-compose run ${{ matrix.config.image }} ccache -s - - name: Build Qbs - run: docker-compose run ${{ matrix.config.image }} ${{ matrix.config.script }} - - name: Print ccache stats - run: docker-compose run ${{ matrix.config.image }} ccache -s +# build-linux-extra: +# name: ${{ matrix.config.name }} +# runs-on: ubuntu-latest +# timeout-minutes: 90 +# strategy: +# fail-fast: false +# matrix: +# config: +# - { +# name: 'Build on Linux (clang_tidy)', +# script: './scripts/run-analyzer.sh', +# image: 'jammy-qt6', +# options: 'profile:qt-clang_64 modules.cpp.compilerWrapper:ccache', +# cacheid: 'clang', +# } +# - { +# name: 'Build on Linux (CMake)', +# script: './scripts/build-qbs-with-cmake.sh', +# image: 'jammy-qt6', +# cacheid: 'cmake', +# } +# - { +# name: 'Build on Linux (gcc, ASAN)', +# image: 'jammy-qt6', +# script: './scripts/build-qbs-with-qbs.sh', +# options: 'modules.cpp.compilerWrapper:ccache +# modules.qbsbuildconfig.enableAddressSanitizer:true +# modules.qbs.debugInformation:true +# modules.qbsbuildconfig.enableBundledQt:true', +# cacheid: 'gcc-asan', +# } +# - { +# name: 'Build on Linux (gcc, UBSAN)', +# image: 'jammy-qt6', +# script: './scripts/build-qbs-with-qbs.sh', +# options: 'modules.cpp.compilerWrapper:ccache +# modules.qbsbuildconfig.enableUbSanitizer:true +# modules.qbs.debugInformation:true +# modules.qbsbuildconfig.enableBundledQt:true', +# cacheid: 'gcc-ubsan', +# } +# - { +# name: 'Build on Linux (gcc, Qt 5.15)', +# image: 'jammy-qt5', +# script: './scripts/build-qbs-with-qbs.sh', +# options: 'modules.cpp.compilerWrapper:ccache +# modules.qbs.debugInformation:true +# modules.qbsbuildconfig.enableBundledQt:true', +# cacheid: 'gcc-qt5', +# } +# env: +# BUILD_OPTIONS: ${{ matrix.config.options }} +# QTEST_FUNCTION_TIMEOUT: 9000000 +# steps: +# - uses: actions/checkout@v1 +# - name: Create .ccache dir +# run: mkdir -p ~/.ccache +# - name: ccache cache files +# uses: actions/cache@v4 +# with: +# path: ~/.ccache +# key: ${{ runner.os }}-${{ matrix.config.cacheid }}-ccache +# - name: Pull the Docker Image +# run: docker-compose pull ${{ matrix.config.image }} +# - name: Print ccache stats +# run: docker-compose run ${{ matrix.config.image }} ccache -s +# - name: Build Qbs +# run: docker-compose run ${{ matrix.config.image }} ${{ matrix.config.script }} +# - name: Print ccache stats +# run: docker-compose run ${{ matrix.config.image }} ccache -s - clang-format: - name: Check Style - runs-on: macos-13 - timeout-minutes: 60 - strategy: - fail-fast: false - steps: - - uses: actions/checkout@v1 - - name: Update PATH - run: echo "$(brew --prefix llvm@15)/bin" >> ${GITHUB_PATH} - - name: Run clang-format - run: | - git diff -U0 --no-color --relative HEAD^ | $(brew --prefix llvm@15)/share/clang/clang-format-diff.py -i -p1 -regex ".*\.(cxx|cpp|hpp|h)" -v - - name: Check diff - run: git diff --exit-code +# clang-format: +# name: Check Style +# runs-on: macos-13 +# timeout-minutes: 60 +# strategy: +# fail-fast: false +# steps: +# - uses: actions/checkout@v1 +# - name: Update PATH +# run: echo "$(brew --prefix llvm@15)/bin" >> ${GITHUB_PATH} +# - name: Run clang-format +# run: | +# git diff -U0 --no-color --relative HEAD^ | $(brew --prefix llvm@15)/share/clang/clang-format-diff.py -i -p1 -regex ".*\.(cxx|cpp|hpp|h)" -v +# - name: Check diff +# run: git diff --exit-code - build-macos: - name: Build on macOS - runs-on: macos-12 - timeout-minutes: 60 - env: - BUILD_OPTIONS: | - modules.cpp.compilerWrapper:ccache - modules.qbs.debugInformation:true - modules.qbsbuildconfig.enableAddressSanitizer:false - modules.qbsbuildconfig.enableBundledQt:true - products.qbs_archive.targetName:qbs-macos-${{ github.run_id }} - products.qbs_archive.includeTests:true - WITH_TESTS: 0 - steps: - - uses: actions/checkout@v1 - - name: Create .ccache dir - run: mkdir -p ~/.ccache - - name: ccache cache files - uses: actions/cache@v4 - with: - path: ~/.ccache - key: ${{ runner.os }}-ccache - - name: Install required packages - run: | - brew install ccache p7zip - python3 -m pip install --user beautifulsoup4 lxml - - name: Install Qt - uses: ./.github/actions/download-qt - with: - toolchain: clang_64 - - name: Install Qt Creator - uses: ./.github/actions/download-qtc - - name: Setup Qbs - run: | - qbs setup-toolchains --detect - qbs setup-qt --detect - qbs config profiles.qt.baseProfile xcode_13_2_1-macosx-x86_64 - qbs config defaultProfile qt - qbs config --list - - name: Print ccache stats - run: ccache -s - - name: Build Qbs - run: scripts/build-qbs-with-qbs.sh - - name: Print ccache stats - run: ccache -s - - name: Upload artifacts - uses: 'actions/upload-artifact@v4' - with: - name: qbs-macos-${{ github.run_id }}.tar.gz - path: release/qbs-macos-${{ github.run_id }}.tar.gz +# build-macos: +# name: Build on macOS +# runs-on: macos-12 +# timeout-minutes: 60 +# env: +# BUILD_OPTIONS: | +# modules.cpp.compilerWrapper:ccache +# modules.qbs.debugInformation:true +# modules.qbsbuildconfig.enableAddressSanitizer:false +# modules.qbsbuildconfig.enableBundledQt:true +# products.qbs_archive.targetName:qbs-macos-${{ github.run_id }} +# products.qbs_archive.includeTests:true +# WITH_TESTS: 0 +# steps: +# - uses: actions/checkout@v1 +# - name: Create .ccache dir +# run: mkdir -p ~/.ccache +# - name: ccache cache files +# uses: actions/cache@v4 +# with: +# path: ~/.ccache +# key: ${{ runner.os }}-ccache +# - name: Install required packages +# run: | +# brew install ccache p7zip +# python3 -m pip install --user beautifulsoup4 lxml +# - name: Install Qt +# uses: ./.github/actions/download-qt +# with: +# toolchain: clang_64 +# - name: Install Qt Creator +# uses: ./.github/actions/download-qtc +# - name: Setup Qbs +# run: | +# qbs setup-toolchains --detect +# qbs setup-qt --detect +# qbs config profiles.qt.baseProfile xcode_13_2_1-macosx-x86_64 +# qbs config defaultProfile qt +# qbs config --list +# - name: Print ccache stats +# run: ccache -s +# - name: Build Qbs +# run: scripts/build-qbs-with-qbs.sh +# - name: Print ccache stats +# run: ccache -s +# - name: Upload artifacts +# uses: 'actions/upload-artifact@v4' +# with: +# name: qbs-macos-${{ github.run_id }}.tar.gz +# path: release/qbs-macos-${{ github.run_id }}.tar.gz build-windows: name: Build on Windows @@ -212,6 +212,18 @@ jobs: with: path: ~/clcache key: ${{ runner.os }}-msvc-clcache + - name: Install Conan + run: | + choco install conan + choco install ninja + echo "C:\\Program Files\\conan\\conan" >> $GITHUB_PATH + echo "C:\\ProgramData\\chocolatey\\lib\\ninja\\tools" >> $GITHUB_PATH + shell: bash + - name: Configure Conan + run: | + conan config install src/conan/ + ./scripts/setup-conan-profiles.sh + shell: bash - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: @@ -307,145 +319,145 @@ jobs: name: qbs-windows-mingw-${{ github.run_id }}.zip path: release/qbs-windows-mingw-${{ github.run_id }}.zip - test-linux: - name: ${{ matrix.config.name }} - runs-on: ubuntu-latest - timeout-minutes: 90 - needs: build-linux - strategy: - fail-fast: false - matrix: - config: - - { - name: 'Run Linux tests (gcc, Qt 6)', - image: 'jammy-qt6', - suffix: 'linux-jammy', - profile: 'qt-gcc_64', - script: './scripts/test-qbs.sh', - } - - { - name: 'Run Linux tests (clang, Qt 6)', - image: 'jammy-qt6', - suffix: 'linux-jammy', - profile: 'qt-clang_64', - script: './scripts/test-qbs.sh', - } - - { - name: 'Run Linux tests (gcc, Qt 5)', - image: 'jammy-qt5', - suffix: 'linux-jammy', - profile: 'qt-gcc_64', - script: './scripts/test-qt.sh', - } - - { - name: 'Run Linux tests (gcc, Qt 6.5 static)', - image: 'jammy-qt6-static', - suffix: 'linux-jammy', - profile: 'qt-gcc_64', - script: './scripts/test-qt.sh', - } - - { - name: 'Run Android tests (Qt 5.15)', - image: 'jammy-android-515', - suffix: 'linux-jammy', - profile: '', - script: './scripts/test-qt-for-android.sh', - } - - { - name: 'Run Android tests (Qt 6.2)', - image: 'jammy-android-62', - suffix: 'linux-jammy', - profile: '', - script: './scripts/test-qt-for-android.sh', - } - - { - name: 'Run Android tests (Qt 6.5)', - image: 'jammy-android-65', - suffix: 'linux-jammy', - profile: '', - script: './scripts/test-qt-for-android.sh', - } - - { - name: 'Run Android tests (ndk r19c)', - image: 'jammy-android-ndk-r19c', - suffix: 'linux-jammy', - profile: '', - script: './scripts/test-for-android.sh', - } - - { - name: 'Run Android tests (ndk r21e)', - image: 'jammy-android-ndk-r21e', - suffix: 'linux-jammy', - profile: '', - script: './scripts/test-for-android.sh', - } - - { - name: 'Run Android tests (ndk r23)', - image: 'jammy-android-ndk-r23', - suffix: 'linux-jammy', - profile: '', - script: './scripts/test-for-android.sh', - } - - { - name: 'Run Linux tests (Qt 4.8.7)', - image: 'jammy-qt4', - suffix: 'linux-jammy', - profile: '', - script: './scripts/test-qt4.sh', - } +# test-linux: +# name: ${{ matrix.config.name }} +# runs-on: ubuntu-latest +# timeout-minutes: 90 +# needs: build-linux +# strategy: +# fail-fast: false +# matrix: +# config: +# - { +# name: 'Run Linux tests (gcc, Qt 6)', +# image: 'jammy-qt6', +# suffix: 'linux-jammy', +# profile: 'qt-gcc_64', +# script: './scripts/test-qbs.sh', +# } +# - { +# name: 'Run Linux tests (clang, Qt 6)', +# image: 'jammy-qt6', +# suffix: 'linux-jammy', +# profile: 'qt-clang_64', +# script: './scripts/test-qbs.sh', +# } +# - { +# name: 'Run Linux tests (gcc, Qt 5)', +# image: 'jammy-qt5', +# suffix: 'linux-jammy', +# profile: 'qt-gcc_64', +# script: './scripts/test-qt.sh', +# } +# - { +# name: 'Run Linux tests (gcc, Qt 6.5 static)', +# image: 'jammy-qt6-static', +# suffix: 'linux-jammy', +# profile: 'qt-gcc_64', +# script: './scripts/test-qt.sh', +# } +# - { +# name: 'Run Android tests (Qt 5.15)', +# image: 'jammy-android-515', +# suffix: 'linux-jammy', +# profile: '', +# script: './scripts/test-qt-for-android.sh', +# } +# - { +# name: 'Run Android tests (Qt 6.2)', +# image: 'jammy-android-62', +# suffix: 'linux-jammy', +# profile: '', +# script: './scripts/test-qt-for-android.sh', +# } +# - { +# name: 'Run Android tests (Qt 6.5)', +# image: 'jammy-android-65', +# suffix: 'linux-jammy', +# profile: '', +# script: './scripts/test-qt-for-android.sh', +# } +# - { +# name: 'Run Android tests (ndk r19c)', +# image: 'jammy-android-ndk-r19c', +# suffix: 'linux-jammy', +# profile: '', +# script: './scripts/test-for-android.sh', +# } +# - { +# name: 'Run Android tests (ndk r21e)', +# image: 'jammy-android-ndk-r21e', +# suffix: 'linux-jammy', +# profile: '', +# script: './scripts/test-for-android.sh', +# } +# - { +# name: 'Run Android tests (ndk r23)', +# image: 'jammy-android-ndk-r23', +# suffix: 'linux-jammy', +# profile: '', +# script: './scripts/test-for-android.sh', +# } +# - { +# name: 'Run Linux tests (Qt 4.8.7)', +# image: 'jammy-qt4', +# suffix: 'linux-jammy', +# profile: '', +# script: './scripts/test-qt4.sh', +# } - env: - QBS_TEST_SOURCE_ROOT: 'tests' - QBS_AUTOTEST_PROFILE: ${{ matrix.config.profile }} - QTEST_FUNCTION_TIMEOUT: 9000000 - steps: - - uses: actions/checkout@v1 - - name: Download artifact - uses: actions/download-artifact@v4 - with: - name: qbs-${{ matrix.config.suffix }}-${{ github.run_id }}.tar.gz - path: ./ - - name: Unpack artifact - run: mkdir -p release/install-root/ && tar xzf qbs-${{ matrix.config.suffix }}-${{ github.run_id }}.tar.gz -C release/install-root/ - - name: Pull the Docker Image - run: docker-compose pull ${{ matrix.config.image }} - - name: Run tests - run: docker-compose run ${{ matrix.config.image }} ${{ matrix.config.script }} release/install-root/usr/local/bin +# env: +# QBS_TEST_SOURCE_ROOT: 'tests' +# QBS_AUTOTEST_PROFILE: ${{ matrix.config.profile }} +# QTEST_FUNCTION_TIMEOUT: 9000000 +# steps: +# - uses: actions/checkout@v1 +# - name: Download artifact +# uses: actions/download-artifact@v4 +# with: +# name: qbs-${{ matrix.config.suffix }}-${{ github.run_id }}.tar.gz +# path: ./ +# - name: Unpack artifact +# run: mkdir -p release/install-root/ && tar xzf qbs-${{ matrix.config.suffix }}-${{ github.run_id }}.tar.gz -C release/install-root/ +# - name: Pull the Docker Image +# run: docker-compose pull ${{ matrix.config.image }} +# - name: Run tests +# run: docker-compose run ${{ matrix.config.image }} ${{ matrix.config.script }} release/install-root/usr/local/bin - test-baremetal: - name: Run Baremetal tests (Linux) - runs-on: ubuntu-latest - timeout-minutes: 60 - needs: build-linux - env: - QBS_TEST_SOURCE_ROOT: 'tests' - steps: - - uses: actions/checkout@v1 - - name: Download artifact - uses: actions/download-artifact@v4 - with: - name: qbs-linux-jammy-${{ github.run_id }}.tar.gz - path: ./ - - name: Unpack artifact - run: mkdir -p release/install-root/ && tar xzf qbs-linux-jammy-${{ github.run_id }}.tar.gz -C release/install-root/ - - name: Pull the Docker Image - run: docker-compose pull jammy-baremetal - - name: arm-none-eabi-gcc-10_3 - run: QBS_AUTOTEST_PROFILE=arm-none-eabi-gcc-10_3 docker-compose run jammy-baremetal scripts/test-baremetal.sh release/install-root/usr/local/bin - - name: avr-gcc-5_4 - run: QBS_AUTOTEST_PROFILE=avr-gcc-5_4 docker-compose run jammy-baremetal scripts/test-baremetal.sh release/install-root/usr/local/bin - - name: msp430-gcc-4_6 - run: QBS_AUTOTEST_PROFILE=msp430-gcc-4_6 docker-compose run jammy-baremetal scripts/test-baremetal.sh release/install-root/usr/local/bin - - name: riscv64-unknown-elf-gcc-10_2 - run: QBS_AUTOTEST_PROFILE=riscv64-unknown-elf-gcc-10_2 docker-compose run jammy-baremetal scripts/test-baremetal.sh release/install-root/usr/local/bin - - name: sdcc-4_0_0-hcs8 - run: QBS_AUTOTEST_PROFILE=sdcc-4_0_0-hcs8 docker-compose run jammy-baremetal scripts/test-baremetal.sh release/install-root/usr/local/bin - - name: sdcc-4_0_0-mcs51 - run: QBS_AUTOTEST_PROFILE=sdcc-4_0_0-mcs51 docker-compose run jammy-baremetal scripts/test-baremetal.sh release/install-root/usr/local/bin - - name: sdcc-4_0_0-stm8 - run: QBS_AUTOTEST_PROFILE=sdcc-4_0_0-stm8 docker-compose run jammy-baremetal scripts/test-baremetal.sh release/install-root/usr/local/bin - - name: xtensa-lx106-elf-gcc-10_3 - run: QBS_AUTOTEST_PROFILE=xtensa-lx106-elf-gcc-10_3 docker-compose run jammy-baremetal scripts/test-baremetal.sh release/install-root/usr/local/bin +# test-baremetal: +# name: Run Baremetal tests (Linux) +# runs-on: ubuntu-latest +# timeout-minutes: 60 +# needs: build-linux +# env: +# QBS_TEST_SOURCE_ROOT: 'tests' +# steps: +# - uses: actions/checkout@v1 +# - name: Download artifact +# uses: actions/download-artifact@v4 +# with: +# name: qbs-linux-jammy-${{ github.run_id }}.tar.gz +# path: ./ +# - name: Unpack artifact +# run: mkdir -p release/install-root/ && tar xzf qbs-linux-jammy-${{ github.run_id }}.tar.gz -C release/install-root/ +# - name: Pull the Docker Image +# run: docker-compose pull jammy-baremetal +# - name: arm-none-eabi-gcc-10_3 +# run: QBS_AUTOTEST_PROFILE=arm-none-eabi-gcc-10_3 docker-compose run jammy-baremetal scripts/test-baremetal.sh release/install-root/usr/local/bin +# - name: avr-gcc-5_4 +# run: QBS_AUTOTEST_PROFILE=avr-gcc-5_4 docker-compose run jammy-baremetal scripts/test-baremetal.sh release/install-root/usr/local/bin +# - name: msp430-gcc-4_6 +# run: QBS_AUTOTEST_PROFILE=msp430-gcc-4_6 docker-compose run jammy-baremetal scripts/test-baremetal.sh release/install-root/usr/local/bin +# - name: riscv64-unknown-elf-gcc-10_2 +# run: QBS_AUTOTEST_PROFILE=riscv64-unknown-elf-gcc-10_2 docker-compose run jammy-baremetal scripts/test-baremetal.sh release/install-root/usr/local/bin +# - name: sdcc-4_0_0-hcs8 +# run: QBS_AUTOTEST_PROFILE=sdcc-4_0_0-hcs8 docker-compose run jammy-baremetal scripts/test-baremetal.sh release/install-root/usr/local/bin +# - name: sdcc-4_0_0-mcs51 +# run: QBS_AUTOTEST_PROFILE=sdcc-4_0_0-mcs51 docker-compose run jammy-baremetal scripts/test-baremetal.sh release/install-root/usr/local/bin +# - name: sdcc-4_0_0-stm8 +# run: QBS_AUTOTEST_PROFILE=sdcc-4_0_0-stm8 docker-compose run jammy-baremetal scripts/test-baremetal.sh release/install-root/usr/local/bin +# - name: xtensa-lx106-elf-gcc-10_3 +# run: QBS_AUTOTEST_PROFILE=xtensa-lx106-elf-gcc-10_3 docker-compose run jammy-baremetal scripts/test-baremetal.sh release/install-root/usr/local/bin test-baremetal-windows: name: Run Baremetal tests (Windows) @@ -598,146 +610,153 @@ jobs: run: QBS_AUTOTEST_PROFILE=cosmic-4_1_0-m68k scripts/test-baremetal.sh release/install-root/bin shell: bash - test-macos: - name: ${{ matrix.config.name }} - runs-on: ${{ matrix.config.runner }} - timeout-minutes: 60 - needs: build-macos - env: - QTEST_FUNCTION_TIMEOUT: 9000000 - QBS_AUTOTEST_PROFILE: 'qt' - QBS_TEST_SOURCE_ROOT: 'tests' - QBS_EXTRA_GRPC_LIBS: 'absl_cord,absl_cordz_handle,absl_cordz_info,absl_synchronization,grpc,gpr' - strategy: - fail-fast: false - matrix: - config: - - { - name: 'Run macOS tests (Xcode 15.1)', - runner: 'macos-13', - target: 'desktop', - toolchain: 'clang_64', - xcodeVersion: '15.1', - testProfile: 'xcode_15_1-macosx-x86_64', - qtVersion: '6.5.0', - script: './scripts/test-qbs.sh', - } - - { - name: 'Run macOS tests (Xcode 15.1, Qt 5.15)', - runner: 'macos-13', - target: 'desktop', - toolchain: 'clang_64', - xcodeVersion: '15.1', - testProfile: 'xcode_15_1-macosx-x86_64', - qtVersion: '5.15.2', - script: './scripts/test-qt.sh', - } - - { - name: 'Run iOS tests (Xcode 15.1)', - runner: 'macos-13', - target: 'ios', - toolchain: 'ios', - xcodeVersion: '15.1', - testProfile: 'xcode_15_1-iphoneos-arm64', - qtVersion: '6.5.0', - script: './scripts/test-qbs.sh', - } - - { - name: 'Run iOS-sim tests (Xcode 15.1)', - runner: 'macos-13', - target: 'ios', - toolchain: 'ios', - xcodeVersion: '15.1', - testProfile: 'xcode_15_1-iphonesimulator-x86_64', - qtVersion: '6.5.0', - script: './scripts/test-qbs.sh', - } - - { - name: 'Run macOS tests (Xcode 14.3.1)', - runner: 'macos-13', - target: 'desktop', - toolchain: 'clang_64', - xcodeVersion: '14.3.1', - testProfile: 'xcode_14_3_1-macosx-x86_64', - qtVersion: '6.5.0', - script: './scripts/test-qbs.sh', - } - - { - name: 'Run macOS tests (Xcode 14.2)', - runner: 'macos-13', - target: 'desktop', - toolchain: 'clang_64', - xcodeVersion: '14.2', - testProfile: 'xcode_14_2-macosx-x86_64', - qtVersion: '6.5.0', - script: './scripts/test-qbs.sh', - } - - { - name: 'Run macOS tests (Xcode-less)', - runner: 'macos-13', - target: 'desktop', - toolchain: 'clang_64', - xcodeVersion: '', - testProfile: 'xcode_13_4_1-macosx-x86_64', - qtVersion: '6.5.0', - script: './scripts/test-qbs.sh', - } - steps: - - uses: actions/checkout@v1 - - name: Download artifact - uses: actions/download-artifact@v4 - with: - name: qbs-macos-${{ github.run_id }}.tar.gz - path: ./ - - name: Unpack artifact - run: mkdir -p release/install-root/ && tar xzf qbs-macos-${{ github.run_id }}.tar.gz -C release/install-root/ - - name: Update PATH - run: echo "./release/install-root/usr/local/bin" >> $GITHUB_PATH - - name: Install required packages - run: brew install capnp ccache grpc icoutils makensis protobuf p7zip - - name: Install Host Qt - if: matrix.config.toolchain == 'ios' - uses: ./.github/actions/download-qt - with: - target: 'desktop' - toolchain: 'clang_64' - version: ${{ matrix.config.qtVersion }} - - name: Install Qt - uses: ./.github/actions/download-qt - with: - target: ${{ matrix.config.target }} - toolchain: ${{ matrix.config.toolchain }} - version: ${{ matrix.config.qtVersion }} - - name: Select Xcode - run: sudo xcode-select --switch /Applications/Xcode_${{ matrix.config.xcodeVersion }}.app - if: matrix.config.xcodeVersion != '' - - name: Setup Qbs - run: | - qbs setup-toolchains --detect - qbs setup-qt $(which qmake) qt - qbs config profiles.qt.baseProfile ${{ matrix.config.testProfile }} - qbs config defaultProfile qt - qbs config --list - if: matrix.config.xcodeVersion != '' - - name: Setup Qbs (Xcode-less) - run: | - qbs setup-toolchains /usr/bin/clang++ ${{ matrix.config.testProfile }} - qbs setup-qt $(which qmake) qt - qbs config profiles.qt.baseProfile ${{ matrix.config.testProfile }} - qbs config defaultProfile qt - qbs config --list - if: matrix.config.xcodeVersion == '' - - name: Run Tests - run: | - sudo chmod g+w /cores - ulimit -c unlimited - ${{ matrix.config.script }} ./release/install-root/usr/local/bin - - name: Coredump on failure - if: ${{ failure() }} - run: | - for f in $(find /cores -maxdepth 1 -name 'core.*' -print); do - lldb --core $f --batch --one-line "bt all" - done; +# test-macos: +# name: ${{ matrix.config.name }} +# runs-on: ${{ matrix.config.runner }} +# timeout-minutes: 60 +# needs: build-macos +# env: +# QTEST_FUNCTION_TIMEOUT: 9000000 +# QBS_AUTOTEST_PROFILE: 'qt' +# QBS_TEST_SOURCE_ROOT: 'tests' +# QBS_EXTRA_GRPC_LIBS: 'absl_cord,absl_cordz_handle,absl_cordz_info,absl_synchronization,grpc,gpr' +# strategy: +# fail-fast: false +# matrix: +# config: +# - { +# name: 'Run macOS tests (Xcode 15.1)', +# runner: 'macos-13', +# target: 'desktop', +# toolchain: 'clang_64', +# xcodeVersion: '15.1', +# testProfile: 'xcode_15_1-macosx-x86_64', +# qtVersion: '6.5.0', +# script: './scripts/test-qbs.sh', +# } +# - { +# name: 'Run macOS tests (Xcode 15.1, Qt 5.15)', +# runner: 'macos-13', +# target: 'desktop', +# toolchain: 'clang_64', +# xcodeVersion: '15.1', +# testProfile: 'xcode_15_1-macosx-x86_64', +# qtVersion: '5.15.2', +# script: './scripts/test-qt.sh', +# } +# - { +# name: 'Run iOS tests (Xcode 15.1)', +# runner: 'macos-13', +# target: 'ios', +# toolchain: 'ios', +# xcodeVersion: '15.1', +# testProfile: 'xcode_15_1-iphoneos-arm64', +# qtVersion: '6.5.0', +# script: './scripts/test-qbs.sh', +# } +# - { +# name: 'Run iOS-sim tests (Xcode 15.1)', +# runner: 'macos-13', +# target: 'ios', +# toolchain: 'ios', +# xcodeVersion: '15.1', +# testProfile: 'xcode_15_1-iphonesimulator-x86_64', +# qtVersion: '6.5.0', +# script: './scripts/test-qbs.sh', +# } +# - { +# name: 'Run macOS tests (Xcode 14.3.1)', +# runner: 'macos-13', +# target: 'desktop', +# toolchain: 'clang_64', +# xcodeVersion: '14.3.1', +# testProfile: 'xcode_14_3_1-macosx-x86_64', +# qtVersion: '6.5.0', +# script: './scripts/test-qbs.sh', +# } +# - { +# name: 'Run macOS tests (Xcode 14.2)', +# runner: 'macos-13', +# target: 'desktop', +# toolchain: 'clang_64', +# xcodeVersion: '14.2', +# testProfile: 'xcode_14_2-macosx-x86_64', +# qtVersion: '6.5.0', +# script: './scripts/test-qbs.sh', +# } +# - { +# name: 'Run macOS tests (Xcode-less)', +# runner: 'macos-13', +# target: 'desktop', +# toolchain: 'clang_64', +# xcodeVersion: '', +# testProfile: 'xcode_13_4_1-macosx-x86_64', +# qtVersion: '6.5.0', +# script: './scripts/test-qbs.sh', +# } +# steps: +# - uses: actions/checkout@v1 +# - name: Download artifact +# uses: actions/download-artifact@v4 +# with: +# name: qbs-macos-${{ github.run_id }}.tar.gz +# path: ./ +# - name: Unpack artifact +# run: mkdir -p release/install-root/ && tar xzf qbs-macos-${{ github.run_id }}.tar.gz -C release/install-root/ +# - name: Update PATH +# run: echo "./release/install-root/usr/local/bin" >> $GITHUB_PATH +# - name: Install required packages +# run: brew install capnp ccache grpc icoutils makensis protobuf p7zip +# - name: Install Conan +# if: matrix.config.toolchain == 'clang_64' +# run: | +# brew install ninja +# brew install conan +# conan config install src/conan/ +# ./scripts/setup-conan-profiles.sh +# - name: Install Host Qt +# if: matrix.config.toolchain == 'ios' +# uses: ./.github/actions/download-qt +# with: +# target: 'desktop' +# toolchain: 'clang_64' +# version: ${{ matrix.config.qtVersion }} +# - name: Install Qt +# uses: ./.github/actions/download-qt +# with: +# target: ${{ matrix.config.target }} +# toolchain: ${{ matrix.config.toolchain }} +# version: ${{ matrix.config.qtVersion }} +# - name: Select Xcode +# run: sudo xcode-select --switch /Applications/Xcode_${{ matrix.config.xcodeVersion }}.app +# if: matrix.config.xcodeVersion != '' +# - name: Setup Qbs +# run: | +# qbs setup-toolchains --detect +# qbs setup-qt $(which qmake) qt +# qbs config profiles.qt.baseProfile ${{ matrix.config.testProfile }} +# qbs config defaultProfile qt +# qbs config --list +# if: matrix.config.xcodeVersion != '' +# - name: Setup Qbs (Xcode-less) +# run: | +# qbs setup-toolchains /usr/bin/clang++ ${{ matrix.config.testProfile }} +# qbs setup-qt $(which qmake) qt +# qbs config profiles.qt.baseProfile ${{ matrix.config.testProfile }} +# qbs config defaultProfile qt +# qbs config --list +# if: matrix.config.xcodeVersion == '' +# - name: Run Tests +# run: | +# sudo chmod g+w /cores +# ulimit -c unlimited +# ${{ matrix.config.script }} ./release/install-root/usr/local/bin +# - name: Coredump on failure +# if: ${{ failure() }} +# run: | +# for f in $(find /cores -maxdepth 1 -name 'core.*' -print); do +# lldb --core $f --batch --one-line "bt all" +# done; test-windows: name: ${{ matrix.config.name }} @@ -756,30 +775,30 @@ jobs: qtVersion: '6.5.0', script: './scripts/test-qbs.sh', } - - { - name: 'Run Windows tests (MSVC 2022, Qt 5.15)', - target: 'desktop', - toolchain: 'win64_msvc2019_64', - testProfile: 'MSVC2022-x64', - qtVersion: '5.15.2', - script: './scripts/test-qt.sh', - } - - { - name: 'Run Windows tests (clang-cl)', - target: 'desktop', - toolchain: 'win64_msvc2019_64', - testProfile: 'clang-cl-x86_64', - qtVersion: '6.5.0', - script: './scripts/test-qbs.sh', - } - - { - name: 'Run Windows tests (MinGW)', - target: 'desktop', - toolchain: 'win64_mingw', - testProfile: 'mingw-qt', - qtVersion: '6.5.0', - script: './scripts/test-qbs.sh', - } + # - { + # name: 'Run Windows tests (MSVC 2022, Qt 5.15)', + # target: 'desktop', + # toolchain: 'win64_msvc2019_64', + # testProfile: 'MSVC2022-x64', + # qtVersion: '5.15.2', + # script: './scripts/test-qt.sh', + # } + # - { + # name: 'Run Windows tests (clang-cl)', + # target: 'desktop', + # toolchain: 'win64_msvc2019_64', + # testProfile: 'clang-cl-x86_64', + # qtVersion: '6.5.0', + # script: './scripts/test-qbs.sh', + # } + # - { + # name: 'Run Windows tests (MinGW)', + # target: 'desktop', + # toolchain: 'win64_mingw', + # testProfile: 'mingw-qt', + # qtVersion: '6.5.0', + # script: './scripts/test-qbs.sh', + # } env: QTEST_FUNCTION_TIMEOUT: 9000000 QBS_AUTOTEST_PROFILE: 'qt' @@ -810,6 +829,26 @@ jobs: version: ${{ matrix.config.qtVersion }} - name: Install MinGW uses: ./.github/actions/download-mingw + - name: Install Ninja + if: matrix.config.toolchain == 'win64_msvc2019_64' + run: | + choco install ninja + echo "C:\\ProgramData\\chocolatey\\lib\\ninja\\tools" >> $GITHUB_PATH + shell: bash + - name: Install Conan + if: matrix.config.toolchain == 'win64_msvc2019_64' + run: | + choco install conan + choco install ninja + echo "C:\\Program Files\\conan\\conan" >> $GITHUB_PATH + echo "C:\\ProgramData\\chocolatey\\lib\\ninja\\tools" >> $GITHUB_PATH + shell: bash + - name: Configure Conan + if: matrix.config.toolchain == 'win64_msvc2019_64' + run: | + conan config install src/conan/ + ./scripts/setup-conan-profiles.sh + shell: bash - name: Setup Qbs run: | qbs setup-toolchains --detect @@ -829,91 +868,91 @@ jobs: run: ${{ matrix.config.script }} ./release/install-root/bin shell: bash - test-windows-extra: - name: ${{ matrix.config.name }} - runs-on: windows-latest - timeout-minutes: 60 - needs: build-windows - strategy: - fail-fast: false - matrix: - config: - - { - name: 'Run Windows tests (OpenWatcom DOS 32 bit)', - testProfile: 'watcom-2_0_0-dos-x86', - script: './scripts/test-baremetal.sh', - } - - { - name: 'Run Windows tests (OpenWatcom DOS 16 bit)', - testProfile: 'watcom-2_0_0-dos-x86_16', - script: './scripts/test-baremetal.sh', - } - - { - name: 'Run Windows tests (OpenWatcom OS/2 32 bit)', - testProfile: 'watcom-2_0_0-os2-x86', - script: './scripts/test-baremetal.sh', - } - - { - name: 'Run Windows tests (OpenWatcom OS/2 16 bit)', - testProfile: 'watcom-2_0_0-os2-x86_16', - script: './scripts/test-baremetal.sh', - } - - { - name: 'Run Windows tests (OpenWatcom Windows 32 bit)', - testProfile: 'watcom-2_0_0-windows-x86', - script: './scripts/test-baremetal.sh', - } - - { - name: 'Run Windows tests (OpenWatcom Windows 16 bit)', - testProfile: 'watcom-2_0_0-windows-x86_16', - script: './scripts/test-baremetal.sh', - } - - { - name: 'Run Windows tests (DigitalMars DOS 16 bit)', - testProfile: 'dmc-8_57_0-dos-x86_16', - script: './scripts/test-baremetal.sh', - } - - { - name: 'Run Windows tests (DigitalMars Windows 32 bit)', - testProfile: 'dmc-8_57_0-windows-x86', - script: './scripts/test-baremetal.sh', - } - - { - name: 'Run Windows tests (DigitalMars Windows 16 bit)', - testProfile: 'dmc-8_57_0-windows-x86_16', - script: './scripts/test-baremetal.sh', - } - env: - QTEST_FUNCTION_TIMEOUT: 9000000 - QBS_AUTOTEST_PROFILE: 'extra' - QBS_TEST_SOURCE_ROOT: 'tests' - QT_ASSUME_STDERR_HAS_CONSOLE: 1 - steps: - - uses: actions/checkout@v1 - - name: Download artifact - uses: actions/download-artifact@v4 - with: - name: qbs-windows-${{ github.run_id }}.zip - path: ./ - - name: Unpack artifact - run: | - mkdir -p release/install-root - cd release/install-root - 7z x ../../qbs-windows-${{ github.run_id }}.zip - shell: bash - - name: Update PATH - run: echo "./release/install-root/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - - name: Install OpenWatcom - uses: ./.github/actions/download-ow - - name: Install DigitalMars - uses: ./.github/actions/download-dm - - name: Setup Qbs - run: | - qbs setup-toolchains --detect - qbs config profiles.extra.baseProfile ${{ matrix.config.testProfile }} - qbs config defaultProfile extra - qbs config --list - shell: bash - - name: Run Tests - run: ${{ matrix.config.script }} ./release/install-root/bin - shell: bash +# test-windows-extra: +# name: ${{ matrix.config.name }} +# runs-on: windows-latest +# timeout-minutes: 60 +# needs: build-windows +# strategy: +# fail-fast: false +# matrix: +# config: +# - { +# name: 'Run Windows tests (OpenWatcom DOS 32 bit)', +# testProfile: 'watcom-2_0_0-dos-x86', +# script: './scripts/test-baremetal.sh', +# } +# - { +# name: 'Run Windows tests (OpenWatcom DOS 16 bit)', +# testProfile: 'watcom-2_0_0-dos-x86_16', +# script: './scripts/test-baremetal.sh', +# } +# - { +# name: 'Run Windows tests (OpenWatcom OS/2 32 bit)', +# testProfile: 'watcom-2_0_0-os2-x86', +# script: './scripts/test-baremetal.sh', +# } +# - { +# name: 'Run Windows tests (OpenWatcom OS/2 16 bit)', +# testProfile: 'watcom-2_0_0-os2-x86_16', +# script: './scripts/test-baremetal.sh', +# } +# - { +# name: 'Run Windows tests (OpenWatcom Windows 32 bit)', +# testProfile: 'watcom-2_0_0-windows-x86', +# script: './scripts/test-baremetal.sh', +# } +# - { +# name: 'Run Windows tests (OpenWatcom Windows 16 bit)', +# testProfile: 'watcom-2_0_0-windows-x86_16', +# script: './scripts/test-baremetal.sh', +# } +# - { +# name: 'Run Windows tests (DigitalMars DOS 16 bit)', +# testProfile: 'dmc-8_57_0-dos-x86_16', +# script: './scripts/test-baremetal.sh', +# } +# - { +# name: 'Run Windows tests (DigitalMars Windows 32 bit)', +# testProfile: 'dmc-8_57_0-windows-x86', +# script: './scripts/test-baremetal.sh', +# } +# - { +# name: 'Run Windows tests (DigitalMars Windows 16 bit)', +# testProfile: 'dmc-8_57_0-windows-x86_16', +# script: './scripts/test-baremetal.sh', +# } +# env: +# QTEST_FUNCTION_TIMEOUT: 9000000 +# QBS_AUTOTEST_PROFILE: 'extra' +# QBS_TEST_SOURCE_ROOT: 'tests' +# QT_ASSUME_STDERR_HAS_CONSOLE: 1 +# steps: +# - uses: actions/checkout@v1 +# - name: Download artifact +# uses: actions/download-artifact@v4 +# with: +# name: qbs-windows-${{ github.run_id }}.zip +# path: ./ +# - name: Unpack artifact +# run: | +# mkdir -p release/install-root +# cd release/install-root +# 7z x ../../qbs-windows-${{ github.run_id }}.zip +# shell: bash +# - name: Update PATH +# run: echo "./release/install-root/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append +# - name: Install OpenWatcom +# uses: ./.github/actions/download-ow +# - name: Install DigitalMars +# uses: ./.github/actions/download-dm +# - name: Setup Qbs +# run: | +# qbs setup-toolchains --detect +# qbs config profiles.extra.baseProfile ${{ matrix.config.testProfile }} +# qbs config defaultProfile extra +# qbs config --list +# shell: bash +# - name: Run Tests +# run: ${{ matrix.config.script }} ./release/install-root/bin +# shell: bash diff --git a/scripts/conan-profiles/mac_x64/qbs-test b/scripts/conan-profiles/mac_x64/qbs-test new file mode 100644 index 0000000000..6a3d0572ff --- /dev/null +++ b/scripts/conan-profiles/mac_x64/qbs-test @@ -0,0 +1,8 @@ +[settings] +arch=x86_64 +build_type=Release +compiler=apple-clang +compiler.cppstd=17 +compiler.libcxx=libc++ +compiler.version=13 +os=Macos diff --git a/scripts/conan-profiles/win_x64/qbs-test b/scripts/conan-profiles/win_x64/qbs-test new file mode 100644 index 0000000000..71b8e706f0 --- /dev/null +++ b/scripts/conan-profiles/win_x64/qbs-test @@ -0,0 +1,9 @@ +[settings] +arch=x86_64 +build_type=Release +compiler=msvc +compiler.cppstd=14 +compiler.runtime=dynamic +compiler.runtime_type=Release +compiler.version=193 +os=Windows diff --git a/scripts/setup-conan-profiles.sh b/scripts/setup-conan-profiles.sh new file mode 100755 index 0000000000..f2dce39858 --- /dev/null +++ b/scripts/setup-conan-profiles.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env bash +############################################################################# +## +## Copyright (C) 2024 Ivan Komissarov (abbapoh@gmail.com). +## Contact: https://www.qt.io/licensing/ +## +## This file is part of Qbs. +## +## $QT_BEGIN_LICENSE:LGPL$ +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see https://www.qt.io/terms-conditions. For further +## information use the contact form at https://www.qt.io/contact-us. +## +## GNU Lesser General Public License Usage +## Alternatively, this file may be used under the terms of the GNU Lesser +## General Public License version 3 as published by the Free Software +## Foundation and appearing in the file LICENSE.LGPL3 included in the +## packaging of this file. Please review the following information to +## ensure the GNU Lesser General Public License version 3 requirements +## will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +## +## GNU General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 2.0 or (at your option) the GNU General +## Public license version 3 or any later version approved by the KDE Free +## Qt Foundation. The licenses are as published by the Free Software +## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +## included in the packaging of this file. Please review the following +## information to ensure the GNU General Public License requirements will +## be met: https://www.gnu.org/licenses/gpl-2.0.html and +## https://www.gnu.org/licenses/gpl-3.0.html. +## +## $QT_END_LICENSE$ +## +############################################################################# +set -eu + +case "$OSTYPE" in + *darwin*) + HOST_OS=mac_x64 + ;; + msys) + HOST_OS=win_x64 + ;; + *) + HOST_OS= + ;; +esac + +if [ -z "${HOST_OS}" ]; then + exit 0 +fi + +mkdir -p "${HOME}/.conan2/profiles" +SCRIPT_DIR=$( cd "$(dirname "$0")" ; pwd -P ) +cp ${SCRIPT_DIR}/conan-profiles/mac_x64/* "${HOME}/.conan2/profiles" \ No newline at end of file diff --git a/share/qbs/imports/qbs/Probes/JsonFileProbe.qbs b/share/qbs/imports/qbs/Probes/JsonFileProbe.qbs new file mode 100644 index 0000000000..b8d25f68e8 --- /dev/null +++ b/share/qbs/imports/qbs/Probes/JsonFileProbe.qbs @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2024 Ivan Komissarov (abbapoh@gmail.com). +** Contact: http://www.qt.io/licensing +** +** This file is part of Qbs. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +import qbs.File +import qbs.TextFile + +Probe { + // Inputs + property path filePath + // Outputs + property var json + configure: { + if (!filePath || !File.exists(filePath)) + return; + + var jsonFile = new TextFile(filePath, TextFile.ReadOnly); + const result = JSON.parse(jsonFile.readAll()); + jsonFile.close(); + json = result; + found = true; + } +} \ No newline at end of file diff --git a/share/qbs/module-providers/conan.js b/share/qbs/module-providers/conan.js new file mode 100644 index 0000000000..524366429b --- /dev/null +++ b/share/qbs/module-providers/conan.js @@ -0,0 +1,170 @@ +/**************************************************************************** +** +** Copyright (C) 2024 Kai Dohmen +** Copyright (C) 2024 Ivan Komissarov (abbapoh@gmail.com). +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qbs. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or (at your option) the GNU General +** Public license version 3 or any later version approved by the KDE Free +** Qt Foundation. The licenses are as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-2.0.html and +** https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +var File = require("qbs.File"); +var FileInfo = require("qbs.FileInfo"); +var ModUtils = require("qbs.ModUtils"); +var TextFile = require("qbs.TextFile"); + +const architectureMap = { + 'x86': 'x86', + 'x86_64': 'x86_64', + 'ppc32be': 'ppc', + 'ppc32': 'ppc', + 'ppc64le': 'ppc64', + 'ppc64': 'ppc64', + 'armv4': 'arm', + 'armv4i': 'arm', + 'armv5el': 'arm', + 'armv5hf': 'arm', + 'armv6': 'arm', + 'armv7': 'arm', + 'armv7hf': 'arm', + 'armv7s': 'arm', + 'armv7k': 'arm', + 'armv8': 'arm64', + 'armv8_32': 'arm64', + 'armv8.3': 'arm64', + 'sparc': 'sparc', + 'sparcv9': 'sparc64', + 'mips': 'mips', + 'mips64': 'mips64', + 'avr': 'avr', + 's390': 's390x', + 's390x': 's390x', + 'sh4le': 'sh' +} + +// TODO: ios-simulator? see core.qbs for inspiration? +const platformMap = { + 'Windows': 'windows', + 'WindowsStore': 'windows', + 'WindowsCE': 'windows', + 'Linux': 'linux', + 'Macos': 'macos', + 'Android': 'android', + 'iOS': 'ios', + 'watchOS': 'watchos', + 'tvOS': 'tvos', + 'FreeBSD': 'freebsd', + 'SunOS': 'solaris', + 'AIX': 'aix', + 'Emscripten': undefined, + 'Arduino': 'none', + 'Neutrino': 'qnx', + 'baremetal': 'none', + 'VxWorks': 'vxworks', +} + +function configure(moduleName, outputBaseDir, jsonProbe) { + const json = jsonProbe.json; + + const moduleMapping = { + "protobuf": "protobuflib" + } + var reverseMapping = {} + for (var key in moduleMapping) + reverseMapping[moduleMapping[key]] = key + const realModuleName = reverseMapping[moduleName] || moduleName; + + console.info("Setting up Conan module '" + moduleName + "'"); + + if (json.modules[realModuleName] === undefined) + return []; + + // TODO: could it be that there are multiple deps with the same name? different build variants? + const dep = json.modules[realModuleName]; + + const outputDir = FileInfo.joinPaths(outputBaseDir, "modules", moduleName.replace(".", "/")); + File.makePath(outputDir); + const outputFilePath = FileInfo.joinPaths(outputDir, "module.qbs"); + + const cppInfo = dep.cpp_info; + + function writeCppProperty(propertyName, propertyValue) { + // skip empty props for simplicity of the module file + if (propertyValue === undefined || propertyValue.length !== 0) { + module.writeLine( + " cpp." + propertyName + ":" + ModUtils.toJSLiteral(propertyValue)); + } + } + + var module = new TextFile(outputFilePath, TextFile.WriteOnly); + module.writeLine("Module {"); + + const architecture = architectureMap[dep.settings.arch]; + const platform = platformMap[dep.settings.os]; + + module.writeLine(" readonly property string architecture: " + ModUtils.toJSLiteral(architecture)); + module.writeLine(" readonly property string platform: " + ModUtils.toJSLiteral(platform)); + // TODO: do we need to check buildVariant? + module.writeLine(" condition: qbs.targetPlatform === platform"); + module.writeLine(" && (!qbs.architecture || architecture && qbs.architecture === architecture)"); + + module.writeLine(" Depends { name: 'cpp' }"); + + dep.dependencies.forEach(function(dep) { + module.write(" Depends { name: '" + dep + "'"); + module.writeLine(" }"); + }) + + console.info(JSON.stringify(cppInfo)); + // NOTE: we can introduce a module, say "binPaths" and inject the value like we do for cpp + // the BinaryProbe will read the merged value from that module + if (cppInfo.bindirs !== undefined && cppInfo.bindirs.length >= 0) { + module.writeLine(" readonly property stringList binPaths: " + ModUtils.toJSLiteral(cppInfo.bindirs)); + } + + // TODO: we need to use actual artifacts from conan instead of raw props for + // installation/signing purposes + writeCppProperty("systemIncludePaths", cppInfo.includedirs); + writeCppProperty("libraryPaths", cppInfo.libdirs); + writeCppProperty("dynamicLibraries", (cppInfo.libs || []).concat(cppInfo.system_libs || [])); + writeCppProperty("frameworkPaths", cppInfo.frameworkdirs); + writeCppProperty("frameworks", cppInfo.frameworks); + writeCppProperty("defines", cppInfo.defines); + writeCppProperty("cFlags", cppInfo.cflags); + writeCppProperty("cxxFlags", cppInfo.cxxflags); + writeCppProperty("linkerFlags", (cppInfo.sharedlinkflags || []).concat(cppInfo.exelinkflags || [])); + module.writeLine("}"); + module.close(); + + return ""; +} \ No newline at end of file diff --git a/share/qbs/module-providers/conan.qbs b/share/qbs/module-providers/conan.qbs new file mode 100644 index 0000000000..18e8cf65f8 --- /dev/null +++ b/share/qbs/module-providers/conan.qbs @@ -0,0 +1,18 @@ +import qbs.Probes +import "conan.js" as ConanHelper + +ModuleProvider { + /* input */ + property path conanDepsFile + + isEager: false + + Probes.JsonFileProbe { + id: jsonProbe + filePath: conanDepsFile + } + + relativeSearchPaths: { + return ConanHelper.configure(moduleName, outputBaseDir, jsonProbe); + } +} diff --git a/share/qbs/modules/protobuf/cpp/protobufcpp.qbs b/share/qbs/modules/protobuf/cpp/protobufcpp.qbs index b5dab2372f..3a950def95 100644 --- a/share/qbs/modules/protobuf/cpp/protobufcpp.qbs +++ b/share/qbs/modules/protobuf/cpp/protobufcpp.qbs @@ -13,6 +13,7 @@ ProtobufBase { property string _cxxLanguageVersion: "c++17" + _binPaths: protobuflib.present ? protobuflib.binPaths : undefined cpp.includePaths: outputDir Depends { name: "cpp" } diff --git a/share/qbs/modules/protobuf/protobufbase.qbs b/share/qbs/modules/protobuf/protobufbase.qbs index e302d37587..da2349d080 100644 --- a/share/qbs/modules/protobuf/protobufbase.qbs +++ b/share/qbs/modules/protobuf/protobufbase.qbs @@ -6,6 +6,7 @@ import "protobuf.js" as HelperFunctions Module { property string compilerName: "protoc" property string compilerPath: compilerProbe.filePath + property stringList _binPaths property pathList importPaths: [] @@ -19,5 +20,6 @@ Module { Probes.BinaryProbe { id: compilerProbe names: [compilerName] + searchPaths: _binPaths } } diff --git a/src/conan/extensions/generators/qbsdeps.py b/src/conan/extensions/generators/qbsdeps.py new file mode 100644 index 0000000000..4500d88d30 --- /dev/null +++ b/src/conan/extensions/generators/qbsdeps.py @@ -0,0 +1,108 @@ +from conan.tools.files import save +from conan.errors import ConanException +from conans.model.dependencies import get_transitive_requires +import json + +class QbsDeps: + def __init__(self, conanfile): + self._conanfile = conanfile + + def generate(self): + deps_info = {} + + for _, dep in self._conanfile.dependencies.items(): + + transitive_reqs = get_transitive_requires(self._conanfile, dep) + + # TODO: what about build deps? + # TODO: this is not correct in the components world + direct_host = [] + for deprequire, depdep in dep.dependencies.direct_host.items(): + direct_host.append({ + 'name': deprequire.ref.name, + # todo: is direct version enough? + 'version': str(deprequire.ref.version), + }) + + def _get_package_name(dep): + # TODO: pkgconfig uses suffix, do we need it? + # see https://github.com/conan-io/conan/blob/develop2/conan/tools/gnu/pkgconfigdeps.py#L319 + return dep.cpp_info.get_property("pkg_config_name") or dep.ref.name + + def _get_component_name(dep, comp_name): + if comp_name not in dep.cpp_info.components: + if dep.ref.name == comp_name: + return _get_package_name(dep) + raise ConanException("Component '{name}::{cname}' not found in '{name}' " + "package requirement".format(name=dep.ref.name, + cname=comp_name)) + + # TODO: pkgconfig uses suffix, do we need it? + return dep.cpp_info.components[comp_name].get_property("pkg_config_name") or comp_name + + def _get_name_with_namespace(namespace, name): + """ + Build a name with a namespace, e.g., openssl-crypto + """ + return f"{namespace}-{name}" + + def get_components(dep): + ret = {} + for comp_ref_name, info in dep.cpp_info.get_sorted_components().items(): + comp_name = _get_component_name(dep, comp_ref_name) + ret[comp_name] = info + return ret + + # copy & paste from pkgconfig + # TODO: versions + def get_cpp_info_requires_names(dep, cpp_info): + ret = [] + dep_ref_name = dep.ref.name + for req in cpp_info.requires: + pkg_ref_name, comp_ref_name = req.split("::") if "::" in req else (dep_ref_name, req) + + if dep_ref_name != pkg_ref_name: + try: + req_conanfile = transitive_reqs[pkg_ref_name] + except KeyError: + continue # If the dependency is not in the transitive, might be skipped + else: # For instance, dep == "hello/1.0" and req == "hello::cmp1" -> hello == hello + req_conanfile = dep + + comp_name = _get_component_name(req_conanfile, comp_ref_name) + if not comp_name: + pkg_name = _get_package_name(req_conanfile) + # Creating a component name with namespace, e.g., dep-comp1 + comp_name = _get_name_with_namespace(pkg_name, comp_ref_name) + ret.append(comp_name) + return ret + + def get_module_info(dep, component, deps): + return { + 'packageName': dep.ref.name, + 'version': str(dep.ref.version), + 'cpp_info': component.serialize(), + 'dependencies': deps, + 'settings': {k: v for k, v in dep.settings.items()}, + 'options': {k: v for k, v in dep.options.items()} + } + if not dep.cpp_info.has_components: + moduleName = _get_package_name(dep) + requires = get_cpp_info_requires_names(dep, dep.cpp_info._package) + if not requires: + # If no requires were found, let's try to get all the direct visible dependencies, + # e.g., requires = "other_pkg/1.0" + for deprequire, depdep in dep.dependencies.direct_host.items(): + requires.append(deprequire.ref.name) + deps_info[moduleName] = get_module_info(dep, dep.cpp_info._package, requires) + else: + full_requires = [] + for moduleName, component in get_components(dep).items(): + requires = get_cpp_info_requires_names(dep, component) + deps_info[moduleName] = get_module_info(dep, component, requires) + full_requires.append(moduleName) + moduleName = _get_package_name(dep) + deps_info[moduleName] = get_module_info(dep, dep.cpp_info._package, full_requires) + + result = {'modules': deps_info} + save(self._conanfile, "deps.json", json.dumps(result, indent=4)) diff --git a/tests/auto/blackbox/testdata-providers/conan-provider/conan-module-provider.qbs b/tests/auto/blackbox/testdata-providers/conan-provider/conan-module-provider.qbs new file mode 100644 index 0000000000..e5672c7d12 --- /dev/null +++ b/tests/auto/blackbox/testdata-providers/conan-provider/conan-module-provider.qbs @@ -0,0 +1,6 @@ +CppApplication { + name: "p" + files: "main.cpp" + qbsModuleProviders: "conan" + Depends { name: "conanmoduleprovider.testlib" } +} diff --git a/tests/auto/blackbox/testdata-providers/conan-provider/conanfile.txt b/tests/auto/blackbox/testdata-providers/conan-provider/conanfile.txt new file mode 100644 index 0000000000..17bb2b0252 --- /dev/null +++ b/tests/auto/blackbox/testdata-providers/conan-provider/conanfile.txt @@ -0,0 +1,2 @@ +[requires] +conanmoduleprovider.testlib/1.2.3 diff --git a/tests/auto/blackbox/testdata-providers/conan-provider/main.cpp b/tests/auto/blackbox/testdata-providers/conan-provider/main.cpp new file mode 100644 index 0000000000..f1f5790713 --- /dev/null +++ b/tests/auto/blackbox/testdata-providers/conan-provider/main.cpp @@ -0,0 +1,6 @@ +#include + +int main() +{ + HelloWorld h(42); +} diff --git a/tests/auto/blackbox/testdata-providers/conan-provider/testlib/CMakeLists.txt b/tests/auto/blackbox/testdata-providers/conan-provider/testlib/CMakeLists.txt new file mode 100644 index 0000000000..d186d1906d --- /dev/null +++ b/tests/auto/blackbox/testdata-providers/conan-provider/testlib/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.15) +project(conanmoduleprovider.testlib) + +find_package(conanmoduleprovider.testlibdep REQUIRED) + +add_library(${PROJECT_NAME} STATIC testlib.cpp) +set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "testlib.h") +target_link_libraries(${PROJECT_NAME} conanmoduleprovider.testlibdep::conanmoduleprovider.testlibdep) +install(TARGETS ${PROJECT_NAME}) diff --git a/tests/auto/blackbox/testdata-providers/conan-provider/testlib/conanfile.py b/tests/auto/blackbox/testdata-providers/conan-provider/testlib/conanfile.py new file mode 100644 index 0000000000..3eb248d6fa --- /dev/null +++ b/tests/auto/blackbox/testdata-providers/conan-provider/testlib/conanfile.py @@ -0,0 +1,39 @@ +from conan import ConanFile +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps +from conan.tools.files import collect_libs +import os + +class ConanModuleProviderTestlib(ConanFile): + name = "conanmoduleprovider.testlib" + license = "none" + version = "1.2.3" + + exports_sources = "*.cpp", "*.h", "CMakeLists.txt" + settings = "os", "compiler", "build_type", "arch" + + def build_requirements(self): + self.tool_requires("cmake/3.22.6") + + def requirements(self): + self.requires("conanmoduleprovider.testlibdep/1.2.3") + + def layout(self): + cmake_layout(self) + + def generate(self): + deps = CMakeDeps(self) + deps.generate() + tc = CMakeToolchain(self, generator="Ninja") + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = collect_libs(self) diff --git a/tests/auto/blackbox/testdata-providers/conan-provider/testlib/testlib.cpp b/tests/auto/blackbox/testdata-providers/conan-provider/testlib/testlib.cpp new file mode 100644 index 0000000000..7118dfda98 --- /dev/null +++ b/tests/auto/blackbox/testdata-providers/conan-provider/testlib/testlib.cpp @@ -0,0 +1,7 @@ +#include "testlib.h" + +#include + +HelloWorld::HelloWorld(int x) + : m_x(foo(x)) +{} diff --git a/tests/auto/blackbox/testdata-providers/conan-provider/testlib/testlib.h b/tests/auto/blackbox/testdata-providers/conan-provider/testlib/testlib.h new file mode 100644 index 0000000000..11a354b709 --- /dev/null +++ b/tests/auto/blackbox/testdata-providers/conan-provider/testlib/testlib.h @@ -0,0 +1,10 @@ +#pragma once + +class HelloWorld +{ +public: + explicit HelloWorld(int x); + +private: + int m_x; +}; diff --git a/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/CMakeLists.txt b/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/CMakeLists.txt new file mode 100644 index 0000000000..54f9c56d6b --- /dev/null +++ b/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.15) +project(conanmoduleprovider.testlibdep) + +add_library(${PROJECT_NAME} STATIC testlibdep.cpp) +set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "testlibdep.h") +install(TARGETS ${PROJECT_NAME}) diff --git a/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/conanfile.py b/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/conanfile.py new file mode 100644 index 0000000000..b56651f802 --- /dev/null +++ b/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/conanfile.py @@ -0,0 +1,36 @@ +from conan import ConanFile +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps +from conan.tools.files import collect_libs +import os + +class ConanModuleProviderTestlib(ConanFile): + name = "conanmoduleprovider.testlibdep" + license = "none" + version = "1.2.3" + + exports_sources = "*.cpp", "*.h", "CMakeLists.txt" + settings = "os", "compiler", "build_type", "arch" + + def build_requirements(self): + self.tool_requires("cmake/3.22.6") + + def layout(self): + cmake_layout(self) + + def generate(self): + deps = CMakeDeps(self) + deps.generate() + tc = CMakeToolchain(self, generator="Ninja") + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = collect_libs(self) diff --git a/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/testlibdep.cpp b/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/testlibdep.cpp new file mode 100644 index 0000000000..893478c82c --- /dev/null +++ b/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/testlibdep.cpp @@ -0,0 +1,6 @@ +#include "testlibdep.h" + +int foo(int i) +{ + return i * i; +} \ No newline at end of file diff --git a/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/testlibdep.h b/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/testlibdep.h new file mode 100644 index 0000000000..ca7bd3cbc0 --- /dev/null +++ b/tests/auto/blackbox/testdata-providers/conan-provider/testlibdep/testlibdep.h @@ -0,0 +1,3 @@ +#pragma once + +int foo(int i); \ No newline at end of file diff --git a/tests/auto/blackbox/testdata/protobuf/conanfile.txt b/tests/auto/blackbox/testdata/protobuf/conanfile.txt new file mode 100644 index 0000000000..677d50a9fd --- /dev/null +++ b/tests/auto/blackbox/testdata/protobuf/conanfile.txt @@ -0,0 +1,4 @@ +[requires] +protobuf/3.21.12 +[generators] +QbsDeps diff --git a/tests/auto/blackbox/tst_blackbox.cpp b/tests/auto/blackbox/tst_blackbox.cpp index c62fdbca02..3d68a5de59 100644 --- a/tests/auto/blackbox/tst_blackbox.cpp +++ b/tests/auto/blackbox/tst_blackbox.cpp @@ -1386,19 +1386,6 @@ void TestBlackbox::variantSuffix_data() std::make_pair(QString("unix"), QStringList())}); } -static bool waitForProcessSuccess(QProcess &p, int msecs = 30000) -{ - if (!p.waitForStarted(msecs) || !p.waitForFinished(msecs)) { - qDebug() << p.errorString(); - return false; - } - if (p.exitCode() != 0) { - qDebug() << p.readAllStandardError(); - return false; - } - return true; -} - void TestBlackbox::vcsGit() { const QString gitFilePath = findExecutable(QStringList("git")); @@ -1925,6 +1912,9 @@ void TestBlackbox::conanfileProbe() { QFETCH(bool, forceFailure); + if (qEnvironmentVariableIsSet("GITHUB_ACTIONS")) + QSKIP("Skip this test when running on GitHub"); + QString executable = findExecutable({"conan"}); if (executable.isEmpty()) QSKIP("conan is not installed or not available in PATH."); @@ -6061,6 +6051,11 @@ void TestBlackbox::protobuf_data() QTest::newRow("cpp-pkgconfig") << QString("addressbook_cpp.qbs") << QStringList({"project.qbsModuleProviders:qbspkgconfig"}) << true << true; + QTest::newRow("cpp-conan") << QString("addressbook_cpp.qbs") + << QStringList( + {"project.qbsModuleProviders:conan", + "moduleProviders.conan.conanDepsFile:build/deps.json"}) + << true << true; QTest::newRow("objc") << QString("addressbook_objc.qbs") << QStringList() << false << true; QTest::newRow("nanopb") << QString("addressbook_nanopb.qbs") << QStringList() << false << true; QTest::newRow("import") << QString("import.qbs") << QStringList() << true << true; @@ -6081,6 +6076,26 @@ void TestBlackbox::protobuf() QFETCH(bool, hasModules); QFETCH(bool, successExpected); rmDirR(relativeBuildDir()); + + if (QTest::currentDataTag() == QLatin1String("cpp-conan")) { + QString executable = findExecutable({"conan"}); + if (executable.isEmpty()) + QSKIP("conan is not installed or not available in PATH."); + const auto profilePath = QDir::homePath() + "/.conan2/profiles/qbs-test"; + if (!QFileInfo(profilePath).exists()) + QSKIP("conan profile is not installed, run './scripts/setup-conan-profiles.sh'."); + QProcess conan; + QDir::setCurrent(testDataDir + "/conan-provider/testlibdep"); + QStringList arguments{ + "install", + ".", + "--generator=QbsDeps", + "--profile:all=qbs-test", + "--output-folder=build"}; + conan.start(executable, arguments); + QVERIFY(waitForProcessSuccess(conan)); + } + QbsRunParameters resolveParams("resolve", QStringList{"-f", projectFile} << properties); QCOMPARE(runQbs(resolveParams), 0); if (m_qbsStdout.contains("targetPlatform differs from hostPlatform")) diff --git a/tests/auto/blackbox/tst_blackboxbase.cpp b/tests/auto/blackbox/tst_blackboxbase.cpp index 17652e7792..317a6b6632 100644 --- a/tests/auto/blackbox/tst_blackboxbase.cpp +++ b/tests/auto/blackbox/tst_blackboxbase.cpp @@ -274,3 +274,16 @@ qbs::Version TestBlackboxBase::qmakeVersion(const QString &qmakeFilePath) qDebug() << "qmake '" << qmakeFilePath << "' version is not valid."; return version; } + +bool waitForProcessSuccess(QProcess &p, int msecs) +{ + if (!p.waitForStarted(msecs) || !p.waitForFinished(msecs)) { + qDebug() << p.errorString(); + return false; + } + if (p.exitCode() != 0) { + qDebug() << p.readAllStandardError(); + return false; + } + return true; +} diff --git a/tests/auto/blackbox/tst_blackboxbase.h b/tests/auto/blackbox/tst_blackboxbase.h index d020b7cd96..e1281b59cf 100644 --- a/tests/auto/blackbox/tst_blackboxbase.h +++ b/tests/auto/blackbox/tst_blackboxbase.h @@ -113,4 +113,6 @@ public slots: int m_needsQt = false; }; +bool waitForProcessSuccess(QProcess &p, int msecs = 30000); + #endif // TST_BLACKBOXBASE_H diff --git a/tests/auto/blackbox/tst_blackboxproviders.cpp b/tests/auto/blackbox/tst_blackboxproviders.cpp index 3d64d32d52..e98531c9b8 100644 --- a/tests/auto/blackbox/tst_blackboxproviders.cpp +++ b/tests/auto/blackbox/tst_blackboxproviders.cpp @@ -87,6 +87,67 @@ void TestBlackboxProviders::brokenProvider() QCOMPARE(m_qbsStderr.count("This provider is broken"), 2); } +void TestBlackboxProviders::conanProvider() +{ + QFETCH(bool, generateConanFiles); + QFETCH(bool, successExpected); + + const auto executable = findExecutable({"conan"}); + if (executable.isEmpty()) + QSKIP("conan is not installed or not available in PATH."); + + const auto generator = QDir::homePath() + "/.conan2/extensions/generators/qbsdeps.py"; + if (!QFileInfo(generator).exists()) { + QSKIP( + "qbsdeps.py is not installed, call 'conan config install src/conan/ from qbs source'."); + } + + const auto profilePath = QDir::homePath() + "/.conan2/profiles/qbs-test"; + if (!QFileInfo(profilePath).exists()) + QSKIP("conan profile is not installed, run './scripts/setup-conan-profiles.sh'."); + + // install testlibdep first + QProcess conan; + QDir::setCurrent(testDataDir + "/conan-provider/testlibdep"); + conan.start(executable, {"create", ".", "--profile:all=qbs-test"}); + QVERIFY(waitForProcessSuccess(conan)); + + // install testlib second + QDir::setCurrent(testDataDir + "/conan-provider/testlib"); + conan.start(executable, {"create", ".", "--profile:all=qbs-test"}); + QVERIFY(waitForProcessSuccess(conan)); + + // now build an app using those libs + QDir::setCurrent(testDataDir + "/conan-provider"); + + rmDirR(relativeBuildDir()); + rmDirR("build"); + + if (generateConanFiles) { + QStringList arguments{ + "install", ".", "-g=QbsDeps", "--profile:all=qbs-test", "--output-folder=build"}; + QProcess conan; + conan.start(executable, arguments); + QVERIFY(waitForProcessSuccess(conan)); + } + + QbsRunParameters buildParams( + "build", + {"--force-probe-execution", + "moduleProviders.conan.conanDepsFile:" + QDir::currentPath() + "/build/deps.json"}); + buildParams.expectFailure = !successExpected; + QCOMPARE(runQbs(buildParams) == 0, successExpected); +} + +void TestBlackboxProviders::conanProvider_data() +{ + QTest::addColumn("generateConanFiles"); + QTest::addColumn("successExpected"); + + QTest::addRow("no conan files generated") << false << false; + QTest::addRow("conan files generated") << true << true; +} + void TestBlackboxProviders::moduleProviders() { QDir::setCurrent(testDataDir + "/module-providers"); diff --git a/tests/auto/blackbox/tst_blackboxproviders.h b/tests/auto/blackbox/tst_blackboxproviders.h index dd00390134..088cea6a3a 100644 --- a/tests/auto/blackbox/tst_blackboxproviders.h +++ b/tests/auto/blackbox/tst_blackboxproviders.h @@ -44,6 +44,8 @@ private slots: void allowedValues(); void allowedValues_data(); void brokenProvider(); + void conanProvider(); + void conanProvider_data(); void moduleProviders(); void moduleProvidersCache(); void nonEagerModuleProvider();