Skip to content

Commit

Permalink
feat(buildnumbering): Setting CFBundleShortVersionString to app versi…
Browse files Browse the repository at this point in the history
…on in Info.plist
  • Loading branch information
ONiebsch committed Nov 8, 2017
1 parent 482ca5a commit ae0df83
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/buildnumbering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ let xmlParser = new xml2js.Parser(),
manifestPath = 'app/App_Resources/Android/AndroidManifest.xml',
plistPath = 'app/App_Resources/iOS/Info.plist',
buildNo = ARGS[0] || process.env['BUILD_NUMBER'] || 1,
packageJSON = require(path.resolve('.', 'package.json'));
packageJSON = require(path.resolve('.', 'package.json')),
version = packageJSON.version;

console.log('Updating with build number: ' + buildNo);

Expand All @@ -27,8 +28,7 @@ fs.stat(manifestPath, (error) => {
let manifestXML = fs.readFileSync(manifestPath);
debugLog('Using following manifest: ', manifestXML);
xmlParser.parseString(manifestXML, (err, manifestData) => {
let appId = packageJSON.nativescript.id,
version = packageJSON.version;
let appId = packageJSON.nativescript.id;
manifestData.manifest.$['android:versionCode'] = buildNo;
manifestData.manifest.$['android:versionName'] = version;
let updatedManifest = builder.buildObject(manifestData);
Expand All @@ -49,6 +49,12 @@ fs.stat(plistPath, (error) => {
throw err;
}
});

exec('/usr/libexec/PlistBuddy -c "Set :CFBundleShortVersionString ' + version + '" ' + path.resolve('.', plistPath), (err) => {
if (err) {
throw err;
}
});
} else {
console.log('Skipping platform iOS');
}
Expand Down

0 comments on commit ae0df83

Please sign in to comment.