@@ -37,6 +37,8 @@ def brief_description():
37
37
def _add_custom_options (self , parser ):
38
38
parser .add_argument ("-m" , "--mode" , dest = "mode" , default = 'debug' ,
39
39
help = MultiLanguage .get_string ('DEPLOY_ARG_MODE' ))
40
+ parser .add_argument ("--no-uninstall" , dest = "no_uninstall" , action = "store_true" ,
41
+ help = MultiLanguage .get_string ('DEPLOY_ARG_NO_UNINSTALL' ))
40
42
41
43
def _check_custom_options (self , args ):
42
44
@@ -47,6 +49,8 @@ def _check_custom_options(self, args):
47
49
if 'release' == args .mode :
48
50
self ._mode = args .mode
49
51
52
+ self ._no_uninstall = args .no_uninstall
53
+
50
54
def _is_debug_mode (self ):
51
55
return self ._mode == 'debug'
52
56
@@ -151,12 +155,13 @@ def deploy_wp8(self, dependencies):
151
155
raise cocos .CCPluginError (MultiLanguage .get_string ('DEPLOY_ERROR_XAPCMD_NOT_FOUND' ),
152
156
cocos .CCPluginError .ERROR_TOOLS_NOT_FOUND )
153
157
154
- # uninstall the app on wp8 by product ID
155
- try :
156
- uninstall_cmd = '"%s" /uninstall %s /targetdevice:xd' % (self .deploy_tool , product_id )
157
- self ._run_cmd (uninstall_cmd )
158
- except :
159
- pass
158
+ if not self ._no_uninstall :
159
+ # uninstall the app on wp8 by product ID
160
+ try :
161
+ uninstall_cmd = '"%s" /uninstall %s /targetdevice:xd' % (self .deploy_tool , product_id )
162
+ self ._run_cmd (uninstall_cmd )
163
+ except :
164
+ pass
160
165
161
166
def deploy_linux (self , dependencies ):
162
167
if not self ._platforms .is_linux_active ():
@@ -179,10 +184,12 @@ def deploy_android(self, dependencies):
179
184
sdk_root = cocos .check_environment_variable ('ANDROID_SDK_ROOT' )
180
185
adb_path = cocos .CMDRunner .convert_path_to_cmd (os .path .join (sdk_root , 'platform-tools' , 'adb' ))
181
186
182
- #TODO detect if the application is installed before running this
183
- adb_uninstall = "%s uninstall %s" % (adb_path , self .package )
184
- self ._run_cmd (adb_uninstall )
185
- adb_install = "%s install \" %s\" " % (adb_path , apk_path )
187
+ if not self ._no_uninstall :
188
+ #TODO detect if the application is installed before running this
189
+ adb_uninstall = "%s uninstall %s" % (adb_path , self .package )
190
+ self ._run_cmd (adb_uninstall )
191
+
192
+ adb_install = "%s install -r \" %s\" " % (adb_path , apk_path )
186
193
self ._run_cmd (adb_install )
187
194
188
195
def deploy_tizen (self , dependencies ):
@@ -197,11 +204,13 @@ def deploy_tizen(self, dependencies):
197
204
# uninstall old app
198
205
tizen_studio_path = cocos .check_environment_variable ("TIZEN_STUDIO_HOME" )
199
206
tizen_cmd_path = cocos .CMDRunner .convert_path_to_cmd (os .path .join (tizen_studio_path , "tools" , "ide" , "bin" , "tizen" ))
200
- try :
201
- uninstall_cmd = "%s uninstall -p %s" % (tizen_cmd_path , self .tizen_packageid )
202
- self ._run_cmd (uninstall_cmd )
203
- except Exception :
204
- pass
207
+
208
+ if not self ._no_uninstall :
209
+ try :
210
+ uninstall_cmd = "%s uninstall -p %s" % (tizen_cmd_path , self .tizen_packageid )
211
+ self ._run_cmd (uninstall_cmd )
212
+ except Exception :
213
+ pass
205
214
206
215
# install app
207
216
compile_dep = dependencies ["compile" ]
0 commit comments