diff options
author | Eike Ziller <eike.ziller@digia.com> | 2014-08-26 17:29:38 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@digia.com> | 2014-09-02 15:11:24 +0200 |
commit | b5b6a46b4e17dde56ac4409bd6551eaaf297b375 (patch) | |
tree | 216df467b3df092bad019656329d299b44e51ee1 /qbs | |
parent | 8dc9d67e898ecb9afa239fcba914ed178931901b (diff) |
ExtensionSystem: Use Qt 5 plugin metadata instead of .pluginspec files
Change-Id: I2b2c704260c613985a4bda179658ec1f8879e70f
Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
Reviewed-by: Christian Stenger <christian.stenger@digia.com>
Reviewed-by: Daniel Teske <daniel.teske@digia.com>
Reviewed-by: hjk <hjk121@nokiamail.com>
Diffstat (limited to 'qbs')
-rw-r--r-- | qbs/imports/QtcPlugin.qbs | 10 | ||||
-rw-r--r-- | qbs/modules/pluginjson/pluginjson.qbs (renamed from qbs/modules/pluginspec/pluginspec.qbs) | 57 |
2 files changed, 21 insertions, 46 deletions
diff --git a/qbs/imports/QtcPlugin.qbs b/qbs/imports/QtcPlugin.qbs index 152d43e5b0f..d896411c90a 100644 --- a/qbs/imports/QtcPlugin.qbs +++ b/qbs/imports/QtcPlugin.qbs @@ -7,7 +7,7 @@ QtcProduct { type: ["dynamiclibrary", "pluginSpec"] installDir: project.ide_plugin_path - property var pluginspecreplacements + property var pluginJsonReplacements property var pluginRecommends: [] property string minimumQtVersion: "5.3.1" @@ -17,7 +17,7 @@ QtcProduct { destinationDirectory: project.ide_plugin_path Depends { name: "ExtensionSystem" } - Depends { name: "pluginspec" } + Depends { name: "pluginjson" } Depends { condition: project.testsEnabled name: "Qt.test" @@ -39,9 +39,9 @@ QtcProduct { cpp.includePaths: [pluginIncludeBase] Group { - name: "PluginSpec" - files: [ product.name + ".pluginspec.in" ] - fileTags: ["pluginSpecIn"] + name: "PluginMetaData" + files: [ product.name + ".json.in" ] + fileTags: ["pluginJsonIn"] } Group { diff --git a/qbs/modules/pluginspec/pluginspec.qbs b/qbs/modules/pluginjson/pluginjson.qbs index a5856d92426..3a2515ae139 100644 --- a/qbs/modules/pluginspec/pluginspec.qbs +++ b/qbs/modules/pluginjson/pluginjson.qbs @@ -5,27 +5,31 @@ import qbs.FileInfo Module { Depends { id: qtcore; name: "Qt.core" } - additionalProductTypes: qtcore.versionMajor < 5 ? ["pluginSpec"] : ["qt_plugin_metadata"] + additionalProductTypes: ["qt_plugin_metadata"] Rule { - inputs: ["pluginSpecIn"] + inputs: ["pluginJsonIn"] Artifact { - fileTags: ["pluginSpec"] - filePath: input.fileName.replace(/\.[^\.]*$/,'') + fileTags: ["qt_plugin_metadata"] + filePath: { + var destdir = FileInfo.joinPaths(product.moduleProperty("Qt.core", + "generatedFilesDir"), input.fileName); + return destdir.replace(/\.[^\.]*$/,'') + } } prepare: { var cmd = new JavaScriptCommand(); cmd.description = "prepare " + FileInfo.fileName(output.filePath); cmd.highlight = "codegen"; - cmd.pluginspecreplacements = product.pluginspecreplacements; + cmd.pluginJsonReplacements = product.pluginJsonReplacements; cmd.plugin_depends = []; var deps = product.dependencies; for (var d in deps) { var depdeps = deps[d].dependencies; for (var dd in depdeps) { - if (depdeps[dd].name == 'pluginspec') { + if (depdeps[dd].name == 'pluginjson') { cmd.plugin_depends.push(deps[d].name); break; } @@ -35,7 +39,7 @@ Module { cmd.sourceCode = function() { var i; - var vars = pluginspecreplacements || {}; + var vars = pluginJsonReplacements || {}; var inf = new TextFile(input.filePath); var all = inf.readAll(); // replace quoted quotes @@ -46,15 +50,15 @@ Module { vars['IDE_VERSION_MAJOR'] = project.ide_version_major; vars['IDE_VERSION_MINOR'] = project.ide_version_minor; vars['IDE_VERSION_RELEASE'] = project.ide_version_release; - var deplist = ["<dependencyList>"]; + var deplist = []; for (i in plugin_depends) { - deplist.push(" <dependency name=\"" + plugin_depends[i] + "\" version=\"" + project.qtcreator_version + "\"/>"); + deplist.push(" { \"Name\" : \"" + plugin_depends[i] + "\", \"Version\" : \"" + project.qtcreator_version + "\" }"); } for (i in plugin_recommends) { - deplist.push(" <dependency name=\"" + plugin_recommends[i] + "\" version=\"" + project.qtcreator_version + "\" type=\"optional\"/>"); + deplist.push(" { \"Name\" : \"" + plugin_recommends[i] + "\", \"Version\" : \"" + project.qtcreator_version + "\", \"Type\" : \"optional\" }"); } - deplist.push(" </dependencyList>"); - vars['dependencyList'] = deplist.join("\n"); + deplist = deplist.join(",\n") + vars['dependencyList'] = "\"Dependencies\" : [\n" + deplist + "\n ]"; for (i in vars) { all = all.replace(new RegExp('\\\$\\\$' + i + '(?!\w)', 'g'), vars[i]); } @@ -66,34 +70,5 @@ Module { return cmd; } } - - Rule { - inputs: ["pluginSpec"] - - Artifact { - fileTags: ["qt_plugin_metadata"] - filePath: { - var destdir = FileInfo.joinPaths(product.moduleProperty("Qt.core", "generatedFilesDir"), - input.fileName); - return destdir.replace(/\.[^\.]*$/, '.json'); - } - } - - prepare: { - var xslFile = project.path + "/../qtcreatorplugin2json.xsl"; // project is "Plugins" - var xmlPatternsPath = product.moduleProperty("Qt.core", "binPath") + "/xmlpatterns"; - var args = [ - "-no-format", - "-output", - output.filePath, - xslFile, - input.filePath - ]; - var cmd = new Command(xmlPatternsPath, args); - cmd.description = "generating " + FileInfo.fileName(output.filePath); - cmd.highlight = "codegen"; - return cmd; - } - } } |