@@ -82,6 +82,9 @@ def init(self, args):
82
82
83
83
self .simulator_abs_path = os .path .join (self .engine_root , SimulatorCompiler .SIMULATOR_PROJ_PATH )
84
84
self .cocos_bin = os .path .join (self .engine_root , SimulatorCompiler .COCOS_CMD_PATH )
85
+ engine_version = utils .get_engine_version (self .engine_root )
86
+ # get the short version after "cocos2d-x-"
87
+ self .engine_version = engine_version [10 :]
85
88
86
89
# get the full path of output dir.
87
90
if args .out_dir is None :
@@ -344,15 +347,20 @@ def update_bundle_version(self):
344
347
keyword_map = { build_date_tag : "<string>%s</string>" % build_date }
345
348
self .replace_keyword_with_file (info_plist_path , keyword_map )
346
349
350
+ match = re .compile ('<key>CFBundleShortVersionString</key>(\s)*<string>(.*?)</string>' ).findall (info_plist_content )
351
+ if len (match ):
352
+ build_date_tag = "<string>%s</string>" % match [0 ][1 ]
353
+ keyword_map = { build_date_tag : "<string>%s</string>" % self .engine_version }
354
+ self .replace_keyword_with_file (info_plist_path , keyword_map )
355
+
347
356
if cocos .os_is_win32 () and self .build_win :
348
357
# win32
349
358
game_rc_path = os .path .join (self .simulator_abs_path ,"frameworks/runtime-src/proj.win32/game.rc" )
350
359
game_rc_content = self .get_content_from_file (game_rc_path )
351
360
match = re .compile ('"Version[^\(]*\(.*\)"' ).findall (game_rc_content )
352
361
if len (match ):
353
362
build_info_str = match [0 ]
354
- m = re .match (r'"(Version[^\(]*)\(.*\)' , build_info_str )
355
- target_str = '"%s(%s)"' % (m .group (1 ), build_date )
363
+ target_str = '"Version %s (%s)"' % (self .engine_version , build_date )
356
364
keyword_map = { build_info_str : target_str }
357
365
self .replace_keyword_with_file (game_rc_path ,keyword_map )
358
366
0 commit comments