From adce1f28e60f3a1d06030f099dabe7d196a04c00 Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 10 Jan 2023 09:22:46 +0200 Subject: [PATCH] Installing label templates and multisize measurements table. --- qbs/modules/buildconfig/buildconfig.qbs | 2 + src/app/tape/tape.qbs | 66 +++++++++++++ src/app/valentina/valentina.qbs | 120 ++++++++++++++++++++++++ 3 files changed, 188 insertions(+) diff --git a/qbs/modules/buildconfig/buildconfig.qbs b/qbs/modules/buildconfig/buildconfig.qbs index 20cb715d2..36f650771 100644 --- a/qbs/modules/buildconfig/buildconfig.qbs +++ b/qbs/modules/buildconfig/buildconfig.qbs @@ -69,6 +69,8 @@ Module { readonly property string installDataPath: { if (qbs.targetOS.contains("macos")) return installAppPath + "/" + appTarget + ".app/Contents/Resources" + else if (qbs.targetOS.contains("windows")) + return installAppPath else return "share/" + appTarget } diff --git a/src/app/tape/tape.qbs b/src/app/tape/tape.qbs index 10fadf0ef..f64691de6 100644 --- a/src/app/tape/tape.qbs +++ b/src/app/tape/tape.qbs @@ -1,4 +1,5 @@ import qbs.FileInfo +import qbs.File VApp { Depends { name: "buildconfig" } @@ -105,4 +106,69 @@ VApp { return defines; } } + + Group { + name: "Multisize tables" + prefix: FileInfo.joinPaths(project.sourceDirectory, "src", "app", "share", "tables", "multisize", FileInfo.pathSeparator()) + files: [ + "GOST_man_ru.vst" + ] + fileTags: ["multisize_tables"] + qbs.install: true + qbs.installDir: buildconfig.installDataPath + FileInfo.pathSeparator() + "tables" + FileInfo.pathSeparator() + "multisize" + } + + Rule { + multiplex: true + alwaysRun: true + inputs: ["multisize_tables"] + outputFileTags: ["testSuit"] + outputArtifacts: { + var artifactNames = inputs["multisize_tables"].map(function(file){ + return FileInfo.joinPaths(product.buildDirectory, "tables", "multisize", file.fileName); + }); + var artifacts = artifactNames.map(function(art){ + var a = { + filePath: art, + fileTags: ["testSuit"] + } + return a; + }); + return artifacts; + } + prepare: { + var cmd = new JavaScriptCommand(); + cmd.description = "Preparing multisize tables"; + + var sources = inputs["multisize_tables"].map(function(artifact) { + return artifact.filePath; + }); + + cmd.sources = sources; + + var destination = inputs["multisize_tables"].map(function(file) { + return FileInfo.joinPaths(product.buildDirectory, "tables", "multisize", file.fileName); + }); + + cmd.destination = destination; + cmd.sourceCode = function() { + for (var i in sources) { + File.copy(sources[i], destination[i]); + } + }; + return [cmd]; + } + } + + Group { + name: "Measurements templates" + prefix: FileInfo.joinPaths(project.sourceDirectory, "src", "app", "share", "tables", "templates", FileInfo.pathSeparator()) + files: [ + "template_all_measurements.vit", + "t_Aldrich_Women.vit" + ] + fileTags: ["measurements_templates"] + qbs.install: true + qbs.installDir: buildconfig.installDataPath + FileInfo.pathSeparator() + "tables" + FileInfo.pathSeparator() + "templates" + } } diff --git a/src/app/valentina/valentina.qbs b/src/app/valentina/valentina.qbs index b709b7a99..67de82e34 100644 --- a/src/app/valentina/valentina.qbs +++ b/src/app/valentina/valentina.qbs @@ -1,4 +1,5 @@ import qbs.FileInfo +import qbs.File VApp { Depends { name: "buildconfig" } @@ -186,4 +187,123 @@ VApp { return defines; } } + + Group { + name: "Label templates" + prefix: FileInfo.joinPaths(project.sourceDirectory, "src", "app", "share", "labels", FileInfo.pathSeparator()) + files: [ + "def_pattern_label.xml", + "def_piece_label.xml" + ] + fileTags: ["label_templates"] + qbs.install: true + qbs.installDir: buildconfig.installDataPath + FileInfo.pathSeparator() + "labels" + } + + Rule { + multiplex: true + alwaysRun: true + inputs: ["label_templates"] + outputFileTags: ["testSuit"] + outputArtifacts: { + var artifactNames = inputs["label_templates"].map(function(file){ + return FileInfo.joinPaths(product.buildDirectory, "labels", file.fileName); + }); + var artifacts = artifactNames.map(function(art){ + var a = { + filePath: art, + fileTags: ["testSuit"] + } + return a; + }); + return artifacts; + } + prepare: { + var cmd = new JavaScriptCommand(); + cmd.description = "Preparing default labels"; + + var sources = inputs["label_templates"].map(function(artifact) { + return artifact.filePath; + }); + + cmd.sources = sources; + + var destination = inputs["label_templates"].map(function(file) { + return FileInfo.joinPaths(product.buildDirectory, "labels", file.fileName); + }); + + cmd.destination = destination; + cmd.sourceCode = function() { + for (var i in sources) { + File.copy(sources[i], destination[i]); + } + }; + return [cmd]; + } + } + + Group { + name: "Multisize tables" + prefix: FileInfo.joinPaths(project.sourceDirectory, "src", "app", "share", "tables", "multisize", FileInfo.pathSeparator()) + files: [ + "GOST_man_ru.vst" + ] + fileTags: ["multisize_tables"] + qbs.install: true + qbs.installDir: buildconfig.installDataPath + FileInfo.pathSeparator() + "tables" + FileInfo.pathSeparator() + "multisize" + } + + Rule { + multiplex: true + alwaysRun: true + inputs: ["multisize_tables"] + outputFileTags: ["testSuit"] + outputArtifacts: { + var artifactNames = inputs["multisize_tables"].map(function(file){ + return FileInfo.joinPaths(product.buildDirectory, "tables", "multisize", file.fileName); + }); + var artifacts = artifactNames.map(function(art){ + var a = { + filePath: art, + fileTags: ["testSuit"] + } + return a; + }); + return artifacts; + } + prepare: { + var cmd = new JavaScriptCommand(); + cmd.description = "Preparing multisize tables"; + + var sources = inputs["multisize_tables"].map(function(artifact) { + return artifact.filePath; + }); + + cmd.sources = sources; + + var destination = inputs["multisize_tables"].map(function(file) { + return FileInfo.joinPaths(product.buildDirectory, "tables", "multisize", file.fileName); + }); + + cmd.destination = destination; + cmd.sourceCode = function() { + for (var i in sources) { + File.copy(sources[i], destination[i]); + } + }; + return [cmd]; + } + } + + Group { + name: "Measurements templates" + prefix: FileInfo.joinPaths(project.sourceDirectory, "src", "app", "share", "tables", "templates", FileInfo.pathSeparator()) + files: [ + "template_all_measurements.vit", + "t_Aldrich_Women.vit" + ] + fileTags: ["measurements_templates"] + qbs.install: true + qbs.installDir: buildconfig.installDataPath + FileInfo.pathSeparator() + "tables" + FileInfo.pathSeparator() + "templates" + } }