diff options
author | Christian Kandeler <christian.kandeler@qt.io> | 2017-07-24 10:33:45 +0200 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@qt.io> | 2017-07-24 11:24:20 +0000 |
commit | 4f7df3758ca7601b7f8977e2256eb1f0191f7c5f (patch) | |
tree | 98bc8d482f3c0962aab496c62242186403185fda /tests/auto/blackbox/testdata/dynamic-project | |
parent | f489dde33403e432286bddced04d2077aced02e0 (diff) | |
download | qbs-4f7df3758ca7601b7f8977e2256eb1f0191f7c5f.tar.gz |
Add test case for a "dynamic project"
While we did not consciously implement that feature, we should strive to
keep it working, as people are using it.
Change-Id: I15f43a45b02e7c241bf9d37bed507b0c2037822d
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Diffstat (limited to 'tests/auto/blackbox/testdata/dynamic-project')
3 files changed, 44 insertions, 0 deletions
diff --git a/tests/auto/blackbox/testdata/dynamic-project/dynamic-project.qbs b/tests/auto/blackbox/testdata/dynamic-project/dynamic-project.qbs new file mode 100644 index 000000000..52a6857d2 --- /dev/null +++ b/tests/auto/blackbox/testdata/dynamic-project/dynamic-project.qbs @@ -0,0 +1,42 @@ +import qbs +import qbs.File +import qbs.FileInfo +import qbs.TextFile + +Project +{ + Probe + { + id: projectBuilder + property stringList refs: [] + + configure: + { + var tempDir = FileInfo.joinPaths(sourceDirectory, "temp"); + File.makePath(tempDir); + var srcDir = FileInfo.joinPaths(sourceDirectory, "src"); + var projectDirs = File.directoryEntries(srcDir, File.Dirs | File.NoDotAndDotDot); + var list = []; + for (it in projectDirs) { + var name = projectDirs[it]; + var productSrcDir = FileInfo.joinPaths(srcDir, name); + var productFilePath = FileInfo.joinPaths(tempDir, name + ".qbs"); + var file = new TextFile(productFilePath, TextFile.WriteOnly); + try { + file.writeLine("import qbs"); + file.writeLine("CppApplication"); + file.writeLine("{"); + file.writeLine("\tfiles: [ \"" + productSrcDir + "/*.cpp\" ]"); + file.writeLine("}"); + } finally { + file.close(); + } + list.push(productFilePath); + } + found = true; + refs = list; + } + } + + references: projectBuilder.refs +} diff --git a/tests/auto/blackbox/testdata/dynamic-project/src/app/main.cpp b/tests/auto/blackbox/testdata/dynamic-project/src/app/main.cpp new file mode 100644 index 000000000..76e819701 --- /dev/null +++ b/tests/auto/blackbox/testdata/dynamic-project/src/app/main.cpp @@ -0,0 +1 @@ +int main() { return 0; } diff --git a/tests/auto/blackbox/testdata/dynamic-project/src/app2/main.cpp b/tests/auto/blackbox/testdata/dynamic-project/src/app2/main.cpp new file mode 100644 index 000000000..76e819701 --- /dev/null +++ b/tests/auto/blackbox/testdata/dynamic-project/src/app2/main.cpp @@ -0,0 +1 @@ +int main() { return 0; } |