Skip to content

Commit

Permalink
Add Conan module provider
Browse files Browse the repository at this point in the history
The Conan module provider will extract information from generated
conanbuildinfo.json files and create a module for every dependency. It
also extract some useful information like the rootpath to the installed
package and environment variables defined by required packages.

Fixes: QBS-1665
Change-Id: I46f34667564c73f74feb2de2609d12d22a703f85
  • Loading branch information
Kai Dohmen authored and ABBAPOH committed May 11, 2024
1 parent c5f7f5d commit a55777c
Show file tree
Hide file tree
Showing 27 changed files with 797 additions and 103 deletions.
224 changes: 134 additions & 90 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -207,11 +207,28 @@ jobs:
QT_ASSUME_STDERR_HAS_CONSOLE: 1
steps:
- uses: actions/checkout@v1
- name: prepare timestamp
id: get-timestamp
run: echo "timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ")" >> $GITHUB_OUTPUT
shell: bash
- name: clcache cache files
uses: actions/cache@v4
with:
path: ~/clcache
key: ${{ runner.os }}-msvc-clcache
path: C:\Users\runneradmin\clcache
key: ${{ runner.os }}-msvc-clcache-${{ steps.get-timestamp.outputs.timestamp }}
restore-keys: ${{ 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:
Expand Down Expand Up @@ -695,6 +712,13 @@ jobs:
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
Expand Down Expand Up @@ -810,6 +834,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
Expand All @@ -829,91 +873,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
8 changes: 8 additions & 0 deletions scripts/conan-profiles/mac_x64/qbs-test
Original file line number Diff line number Diff line change
@@ -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
9 changes: 9 additions & 0 deletions scripts/conan-profiles/win_x64/qbs-test
Original file line number Diff line number Diff line change
@@ -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
62 changes: 62 additions & 0 deletions scripts/setup-conan-profiles.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
#!/usr/bin/env bash
#############################################################################
##
## Copyright (C) 2024 Ivan Komissarov ([email protected]).
## 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

echo $HOST_OS

mkdir -p "${HOME}/.conan2/profiles"
SCRIPT_DIR=$( cd "$(dirname "$0")" ; pwd -P )
cp ${SCRIPT_DIR}/conan-profiles/${HOST_OS}/* "${HOME}/.conan2/profiles"
49 changes: 49 additions & 0 deletions share/qbs/imports/qbs/Probes/JsonFileProbe.qbs
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/****************************************************************************
**
** Copyright (C) 2024 Ivan Komissarov ([email protected]).
** 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;
}
}
Loading

0 comments on commit a55777c

Please sign in to comment.