diff options
author | Christian Kandeler <christian.kandeler@theqtcompany.com> | 2015-11-24 09:59:28 +0100 |
---|---|---|
committer | Christian Kandeler <christian.kandeler@theqtcompany.com> | 2016-01-12 13:13:10 +0000 |
commit | 12b411a67261eeeb18d67105ed4982b26357b2dd (patch) | |
tree | 7eda8c8b44ca1f74d89dfa681e31272667bd77d6 /share | |
parent | 56f1d95716f1af57d63f51df6fcc3a1bd8ca3ee4 (diff) |
Do module validation and Probe resolving after module merging.
Probes were running for every non-merged instance of a module. This had
several drawbacks:
a) Performance. Consider this product:
Product {
Depends { name: "cpp" }
Depends {
name: "Qt"; submodules: ["core", "gui", "network"]
};
// ...
}
Now let's assume that the cpp module contains a Probe. Due to
inter-module dependencies, that Probe would run four times when
resolving the product. (Admittedly, the user could get rid of
the explicit dependencies on cpp and Qt.core, but even then, the
Probe would run twice). Obviously this does not scale,
particularly if we consider that Probes usually access the file
system.
b) Correctness. Probes running in the non-merged instance only have
a "local" view of the state, so they will not see properties
attached by a "higher-level" module, as the linked bug report
demonstrates.
This patch attempts to solve these problems by merging the modules
before running Probes.
Note 1: In order to achieve the desired result, the process of module
merging had to be extended so that all non-merged instances are now
replaced by their merged counterparts. One consequence of this is that
access to non-merged module instances via JavaScript is no longer
possible (i.e. "moduleA.moduleB.property" and "moduleC.moduleB.property"
can no longer yield different results). This feature does not seem to be
used in any of our projects and there also is no autotest for it. Can
anyone come up with a sensible use case?
Note 2: I superficially thought about a different approach: Evaluate the
Probes in the module prototype. This would be a much less intrusive
change and it would further increase performance, because Probes would
run only once per module instead of once per product. However, they
would need to become "output-only" in the sense that they could only be
parameterized via command-line parameters. This would break existing
usages e.g. in the android module, indicating that such a design might
be too limiting.
Task-number: QBS-833
Change-Id: I0c14ade3dcf73ad419208cbd570942f778f2e871
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
Diffstat (limited to 'share')
-rw-r--r-- | share/qbs/modules/Android/sdk/sdk.qbs | 5 | ||||
-rw-r--r-- | share/qbs/modules/archiver/archiver.qbs | 5 | ||||
-rw-r--r-- | share/qbs/modules/typescript/TypeScriptModule.qbs | 13 |
3 files changed, 0 insertions, 23 deletions
diff --git a/share/qbs/modules/Android/sdk/sdk.qbs b/share/qbs/modules/Android/sdk/sdk.qbs index 451981f0f..088bd2669 100644 --- a/share/qbs/modules/Android/sdk/sdk.qbs +++ b/share/qbs/modules/Android/sdk/sdk.qbs @@ -90,11 +90,6 @@ Module { java.runtimeVersion: platformJavaVersion java.bootClassPaths: androidJarFilePath - // QBS-833 workaround - Probes.JdkProbe { id: jdk; environmentPaths: [java.jdkPath].concat(base) } - java.jdkPath: jdk.path - java.compilerVersion: jdk.version ? jdk.version[1] : undefined - FileTagger { patterns: ["AndroidManifest.xml"] fileTags: ["android.manifest"] diff --git a/share/qbs/modules/archiver/archiver.qbs b/share/qbs/modules/archiver/archiver.qbs index cdcf1d9b5..aa6a32e62 100644 --- a/share/qbs/modules/archiver/archiver.qbs +++ b/share/qbs/modules/archiver/archiver.qbs @@ -38,11 +38,6 @@ Module { // This will most likely end up being used on Windows Depends { name: "java"; required: false } - // QBS-833 workaround - Probes.JdkProbe { id: jdk; environmentPaths: [java.jdkPath].concat(base) } - java.jdkPath: jdk.path - java.compilerVersion: jdk.version ? jdk.version[1] : undefined - Probes.BinaryProbe { id: zipProbe names: ["zip"] diff --git a/share/qbs/modules/typescript/TypeScriptModule.qbs b/share/qbs/modules/typescript/TypeScriptModule.qbs index e632aab72..5173fb916 100644 --- a/share/qbs/modules/typescript/TypeScriptModule.qbs +++ b/share/qbs/modules/typescript/TypeScriptModule.qbs @@ -45,21 +45,8 @@ Module { additionalProductTypes: ["compiled_typescript"] - // QBS-833 workaround - Probes.NodeJsProbe { id: nodejsProbe; pathPrefixes: [nodejs.toolchainInstallPath] } - nodejs.toolchainInstallPath: nodejsProbe.path - nodejs.interpreterFileName: nodejsProbe.fileName - nodejs.interpreterFilePath: nodejsProbe.filePath - Probes.NpmProbe { id: npmProbe; pathPrefixes: [nodejs.toolchainInstallPath] } - nodejs.packageManagerFileName: npmProbe.fileName - nodejs.packageManagerFilePath: npmProbe.filePath - nodejs.packageManagerBinPath: npmProbe.packageManagerBinPath - nodejs.packageManagerRootPath: npmProbe.packageManagerRootPath - nodejs.packageManagerPrefixPath: npmProbe.packageManagerPrefixPath - Probes.TypeScriptProbe { id: tsc - condition: nodejsProbe.found && npmProbe.found packageManagerBinPath: nodejs.packageManagerBinPath packageManagerRootPath: nodejs.packageManagerRootPath } |