Skip to content

Commit

Permalink
Merge pull request #5709 from cb1kenobi/timob-16987
Browse files Browse the repository at this point in the history
[TIMOB-16987] Fixed version number formatting for iTunes sync builds.
  • Loading branch information
cb1kenobi committed May 20, 2014
2 parents ea9ffe4 + 9c676a3 commit 85b3c33
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions iphone/cli/commands/_build.js
Original file line number Diff line number Diff line change
Expand Up @@ -1820,12 +1820,24 @@ iOSBuilder.prototype.createInfoPlist = function createInfoPlist(next) {
plist.CFBundleIdentifier = this.tiapp.id;

if (this.target == 'device' && this.deviceId == 'itunes') {
// device builds require an additional token to ensure uniqueness so that iTunes will detect an updated app to sync
plist.CFBundleVersion = this.tiapp.version + '.' + (new Date).getTime();
// device builds require an additional token to ensure uniqueness so that iTunes will detect an updated app to sync.
// we drop the milliseconds from the current time so that we still have a unique identifier, but is less than 10
// characters so iTunes 11.2 doesn't get upset.
plist.CFBundleVersion = String(+new Date);
this.logger.debug(__('Building for iTunes sync which requires us to set the CFBundleVersion to a unique number to trigger iTunes to update your app'));
this.logger.debug(__('Setting Info.plist CFBundleVersion to current epoch time %s', plist.CFBundleVersion.cyan));
} else {
plist.CFBundleVersion = this.tiapp.version;
plist.CFBundleVersion = String(this.tiapp.version);
this.logger.debug(__('Setting Info.plist CFBundleVersion to %s', plist.CFBundleVersion.cyan));
}

try {
plist.CFBundleShortVersionString = appc.version.format(this.tiapp.version, 0, 3);
this.logger.debug(__('Setting Info.plist CFBundleShortVersionString to %s', plist.CFBundleShortVersionString.cyan));
} catch (ex) {
plist.CFBundleShortVersionString = this.tiapp.version;
this.logger.debug(__('Setting Info.plist CFBundleShortVersionString to %s', plist.CFBundleShortVersionString.cyan));
}
plist.CFBundleShortVersionString = appc.version.format(plist.CFBundleVersion, 0, 3);

Array.isArray(plist.CFBundleIconFiles) || (plist.CFBundleIconFiles = []);
['.png', '@2x.png', '-72.png', '-60.png', '-60@2x.png', '-76.png', '-76@2x.png', '-Small-50.png', '-72@2x.png', '-Small-50@2x.png', '-Small.png', '-Small@2x.png', '-Small-40.png', '-Small-40@2x.png'].forEach(function (name) {
Expand Down

0 comments on commit 85b3c33

Please sign in to comment.