diff options
author | Richard Weickelt <richard@weickelt.de> | 2020-02-02 23:42:59 +0100 |
---|---|---|
committer | Richard Weickelt <richard@weickelt.de> | 2020-02-15 10:22:00 +0000 |
commit | 4b07b8cd47016f75f9ffe0188cecadb10b6ae4eb (patch) | |
tree | db0a5ed28097908b178e449e6ded01beb36ce1da /tests/auto/blackbox/testdata | |
parent | 5adf0d5e8928c1d195d0725195fda86c21e88598 (diff) |
Add ConanfileProbe item for querying conan recipe files
Conan is a popular C/C++ package manager. Conan packages including their
configuration and dependencies are usually described as conanfile.txt/.py.
ConanfileProbe runs 'conan install -g json' and parses the resulting
conanbuildinfo.json. The resulting JS object tree contains relevant information
about the dependencies and can be used to set module properties in Product,
Profile or even Module items.
Change-Id: Ied6b917f061dac67fb2260eab099bcce4037750d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Diffstat (limited to 'tests/auto/blackbox/testdata')
3 files changed, 72 insertions, 0 deletions
diff --git a/tests/auto/blackbox/testdata/conanfile-probe/testapp/conanfile-probe-project.qbs b/tests/auto/blackbox/testdata/conanfile-probe/testapp/conanfile-probe-project.qbs new file mode 100644 index 000000000..ab1c68385 --- /dev/null +++ b/tests/auto/blackbox/testdata/conanfile-probe/testapp/conanfile-probe-project.qbs @@ -0,0 +1,22 @@ +import qbs.Probes +import qbs.TextFile + +Project { + + Probes.ConanfileProbe { + id: conan + conanfilePath: path + "/conanfile.py" + options: ({opt: "True"}) + settings: ({os: "AIX"}) + } + + property var check: { + tf = new TextFile(buildDirectory + "/results.json", TextFile.WriteOnly); + var o = { + json: conan.json.deps_env_info["ENV_VAR"], + dependencies: conan.dependencies["testlib"].libs, + generatedFilesPath: conan.generatedFilesPath + }; + tf.write(JSON.stringify(o)); + } +} diff --git a/tests/auto/blackbox/testdata/conanfile-probe/testapp/conanfile.py b/tests/auto/blackbox/testdata/conanfile-probe/testapp/conanfile.py new file mode 100644 index 000000000..630cf0283 --- /dev/null +++ b/tests/auto/blackbox/testdata/conanfile-probe/testapp/conanfile.py @@ -0,0 +1,25 @@ +from conans import ConanFile + +class TestApp(ConanFile): + name = "testapp" + description = "Our project package, to be inspected by the Qbs ConanfileProbe" + license = "none" + version = "6.6.6" + + settings = "os" + options = {"opt": [True, False]} + default_options = {"opt": False} + + requires = "testlib/1.2.3@qbs/testing" + + def configure(self): + self.options["testlib"].opt = self.options.opt + + def source(self): + pass + + def build(self): + pass + + def package(self): + pass diff --git a/tests/auto/blackbox/testdata/conanfile-probe/testlib/conanfile.py b/tests/auto/blackbox/testdata/conanfile-probe/testlib/conanfile.py new file mode 100644 index 000000000..983c22599 --- /dev/null +++ b/tests/auto/blackbox/testdata/conanfile-probe/testlib/conanfile.py @@ -0,0 +1,25 @@ +from conans import ConanFile + +class Testlib(ConanFile): + name = "testlib" + description = "Represents an arbitrary package, for instance on bintray" + license = "none" + version = "1.2.3" + + settings = "os" + options = {"opt": [True, False]} + default_options = {"opt": False} + + def source(self): + pass + + def build(self): + pass + + def package(self): + pass + + def package_info(self): + self.cpp_info.libs = ["testlib1","testlib2"] + self.env_info.ENV_VAR = "TESTLIB_ENV_VAL" + self.user_info.user_var = "testlib_user_val" |