aboutsummaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@petroules.com>2014-07-11 17:49:19 -0400
committerJoerg Bornemann <joerg.bornemann@digia.com>2014-07-22 14:51:40 +0200
commita2dece0a1d0d9abbddf275b356cbf83e6689578e (patch)
tree4830c4b8258aa74b8cc58f792358647d1df2a99b /share
parent496707ce5ae88e124617553e8e24d887a750777c (diff)
Add support for compiling Interface Builder storyboards.
As a side effect, some capabilities introduced here also apply to XIBs. Task-number: QBS-466 Change-Id: I27eaf1a9a73ef25475b4f6b2bc971dcd941b6371 Reviewed-by: Joerg Bornemann <joerg.bornemann@digia.com>
Diffstat (limited to 'share')
-rw-r--r--share/qbs/modules/cpp/DarwinGCC.qbs4
-rw-r--r--share/qbs/modules/ib/IBModule.qbs60
-rw-r--r--share/qbs/modules/ib/ib.js10
3 files changed, 63 insertions, 11 deletions
diff --git a/share/qbs/modules/cpp/DarwinGCC.qbs b/share/qbs/modules/cpp/DarwinGCC.qbs
index 0de1041ce..104d4f007 100644
--- a/share/qbs/modules/cpp/DarwinGCC.qbs
+++ b/share/qbs/modules/cpp/DarwinGCC.qbs
@@ -343,7 +343,7 @@ UnixGCC {
Rule {
multiplex: true
inputs: ["application", "infoplist", "pkginfo", "icns", "application_dsym",
- "compiled_nib", "compiled_assetcatalog",
+ "compiled_nib", "compiled_storyboard", "compiled_assetcatalog",
"resourcerules", "ipa"]
Artifact {
@@ -363,7 +363,7 @@ UnixGCC {
Rule {
multiplex: true
inputs: ["dynamiclibrary", "infoplist", "pkginfo", "icns", "dynamiclibrary_dsym",
- "compiled_nib", "compiled_assetcatalog"]
+ "compiled_nib", "compiled_storyboard", "compiled_assetcatalog"]
Artifact {
filePath: product.destinationDirectory + "/" + BundleTools.wrapperName(product)
diff --git a/share/qbs/modules/ib/IBModule.qbs b/share/qbs/modules/ib/IBModule.qbs
index ebcf8fc2e..7776b1d68 100644
--- a/share/qbs/modules/ib/IBModule.qbs
+++ b/share/qbs/modules/ib/IBModule.qbs
@@ -24,6 +24,8 @@ Module {
property string ibtoolName: "ibtool"
property string ibtoolPath: ibtoolName
property bool flatten: true
+ property string module
+ property bool autoActivateCustomFonts: true
// Asset catalog specific
property string actoolName: "actool"
@@ -37,6 +39,7 @@ Module {
property string appleIconSuffix: ".icns"
property string compiledAssetCatalogSuffix: ".car"
property string compiledNibSuffix: ".nib"
+ property string compiledStoryboardSuffix: ".storyboardc"
property string ibtoolVersion: { return Ib.ibtoolVersion(ibtoolPath); }
property var ibtoolVersionParts: ibtoolVersion ? ibtoolVersion.split('.').map(function(item) { return parseInt(item, 10); }) : []
@@ -68,6 +71,11 @@ Module {
}
FileTagger {
+ patterns: ["*.storyboard"]
+ fileTags: ["storyboard"]
+ }
+
+ FileTagger {
patterns: ["*.xcassets"] // bundle
fileTags: ["assetcatalog"]
}
@@ -94,18 +102,18 @@ Module {
}
Rule {
- inputs: ["nib"]
- explicitlyDependsOn: ["infoplist"]
+ inputs: ["nib", "storyboard"]
+ // When the flatten property is true, this artifact will be a FILE, otherwise it will be a DIRECTORY
Artifact {
filePath: {
var path = product.destinationDirectory;
- var xibFilePath = input.baseDir + '/' + input.fileName;
- var key = DarwinTools.localizationKey(xibFilePath);
+ var inputFilePath = input.baseDir + '/' + input.fileName;
+ var key = DarwinTools.localizationKey(inputFilePath);
if (key) {
path += '/' + BundleTools.localizedResourcesFolderPath(product, key);
- var subPath = DarwinTools.relativeResourcePath(xibFilePath);
+ var subPath = DarwinTools.relativeResourcePath(inputFilePath);
if (subPath && subPath !== '.')
path += '/' + subPath;
} else {
@@ -113,10 +121,34 @@ Module {
path += '/' + input.baseDir;
}
- return path + '/' + input.completeBaseName + ModUtils.moduleProperty(product, "compiledNibSuffix");
+ var suffix = "";
+ if (input.fileTags.contains("nib"))
+ suffix = ModUtils.moduleProperty(product, "compiledNibSuffix");
+ else if (input.fileTags.contains("storyboard"))
+ suffix = ModUtils.moduleProperty(product, "compiledStoryboardSuffix");
+
+ return path + '/' + input.completeBaseName + suffix;
}
- fileTags: ["compiled_nib"]
+ fileTags: {
+ var tags = ["compiled_ibdoc"];
+ if (inputs.contains("nib"))
+ tags.push("compiled_nib");
+ if (inputs.contains("storyboard"))
+ tags.push("compiled_storyboard");
+ return tags;
+ }
+ }
+
+ Artifact {
+ condition: product.moduleProperty("ib", "ibtoolVersionMajor") >= 6
+
+ filePath: {
+ var prefix = input.fileTags.contains("storyboard") ? "SB" : "";
+ return FileInfo.joinPaths(product.destinationDirectory, input.completeBaseName + "-" + prefix + "PartialInfo.plist");
+ }
+
+ fileTags: ["partial_infoplist"]
}
prepare: {
@@ -126,18 +158,28 @@ Module {
if (flags)
args = args.concat(flags);
- args.push("--compile", output.filePath);
+ args.push("--compile", outputs.compiled_ibdoc[0].filePath);
args.push(input.filePath);
var cmd = new Command(ModUtils.moduleProperty(input, "ibtoolPath"), args);
cmd.description = ModUtils.moduleProperty(input, "ibtoolName") + ' ' + input.fileName;
- // Also display the language name of the nib being compiled if it has one
+ // Also display the language name of the nib/storyboard being compiled if it has one
var localizationKey = DarwinTools.localizationKey(input.filePath);
if (localizationKey)
cmd.description += ' (' + localizationKey + ')';
cmd.highlight = 'compiler';
+
+ // May not be strictly needed, but is set by some versions of Xcode
+ if (input.fileTags.contains("storyboard")) {
+ var targetOS = product.moduleProperty("qbs", "targetOS");
+ if (targetOS.contains("ios"))
+ cmd.environment.push("IBSC_MINIMUM_COMPATIBILITY_VERSION=" + product.moduleProperty("cpp", "minimumIosVersion"));
+ if (targetOS.contains("osx"))
+ cmd.environment.push("IBSC_MINIMUM_COMPATIBILITY_VERSION=" + product.moduleProperty("cpp", "minimumOsxVersion"));
+ }
+
return cmd;
}
}
diff --git a/share/qbs/modules/ib/ib.js b/share/qbs/modules/ib/ib.js
index 3254cdb06..86f13ff8c 100644
--- a/share/qbs/modules/ib/ib.js
+++ b/share/qbs/modules/ib/ib.js
@@ -42,6 +42,16 @@ function prepareIbtoold(product, input, outputs) {
args.push("--sdk", sysroot);
args.push("--flatten", ModUtils.moduleProperty(input, "flatten") ? 'YES' : 'NO');
+
+ // --module and --auto-activate-custom-fonts were introduced in Xcode 6.0
+ if (ModUtils.moduleProperty(input, "ibtoolVersionMajor") >= 6) {
+ var module = ModUtils.moduleProperty(input, "module");
+ if (module)
+ args.push("--module", module);
+
+ if (ModUtils.moduleProperty(input, "autoActivateCustomFonts"))
+ args.push("--auto-activate-custom-fonts");
+ }
}
// --minimum-deployment-target was introduced in Xcode 5.0