def check_android_platform(self, sdk_root, android_platform, proj_path, auto_select): ret = android_platform min_platform = self.get_target_config(proj_path) if android_platform is None: # not specified platform, found one cocos.Logging.info('Android platform not specified, searching a default one...') ret = cocos.select_default_android_platform(min_platform) else: # check whether it's larger than min_platform if android_platform < min_platform: if auto_select: # select one for project ret = cocos.select_default_android_platform(min_platform) else: # raise error raise cocos.CCPluginError("The android-platform of project \"%s\" should be equal/larger than %d, but %d is specified." % (proj_path, min_platform, android_platform)) if ret is None: raise cocos.CCPluginError("Can't find right android-platform for project : \"%s\". The android-platform should be equal/larger than %d" % (proj_path, min_platform)) platform_path = "android-%d" % ret ret_path = os.path.join(self._convert_path_to_python(sdk_root), "platforms", platform_path) if not os.path.isdir(ret_path): raise cocos.CCPluginError("The directory \"%s\" can't be found in android SDK" % platform_path) return ret
def check_android_platform(self, sdk_root, android_platform, proj_path, auto_select): ret = android_platform min_platform = self.get_target_config(proj_path) if android_platform is None: # not specified platform, found one cocos.Logging.info( 'Android platform not specified, searching a default one...') ret = cocos.select_default_android_platform(min_platform) else: # check whether it's larger than min_platform if android_platform < min_platform: if auto_select: # select one for project ret = cocos.select_default_android_platform(min_platform) else: # raise error raise cocos.CCPluginError( "The android-platform of project \"%s\" should be equal/larger than %d, but %d is specified." % (proj_path, min_platform, android_platform)) if ret is None: raise cocos.CCPluginError( "Can't find right android-platform for project : \"%s\". The android-platform should be equal/larger than %d" % (proj_path, min_platform)) platform_path = "android-%d" % ret ret_path = os.path.join(self._convert_path_to_python(sdk_root), "platforms", platform_path) if not os.path.isdir(ret_path): raise cocos.CCPluginError( "The directory \"%s\" can't be found in android SDK" % platform_path) return ret
def build_android(self): if not self._platforms.is_android_active(): return if not self._ap: cocos.Logging.info( 'Android platform not specified, searching a default one...') self._ap = cocos.select_default_android_platform() if self._ap is None: cocos.Logging.warning( 'No valid android platform found, will not generate apk.') project_dir = self._platforms.project_path() # for debug reason, depart 2 step here: # 1. build native 2. build apk # only build native code if -p not specified, otherwise build apk also. cocos.Logging.info("building native") with cocos.pushd(project_dir): self._run_cmd("python build_native.py -b %s -n \"-j %s\"" % (self._mode, self._jobs)) cocos.Logging.info("building apk") with cocos.pushd(project_dir): self._run_cmd("python build_native.py -b %s -p %s -n \"-j %s\"" % (self._mode, self._ap, self._jobs))
def build_android(self): if not self._platforms.is_android_active(): return if not self._ap: cocos.Logging.info('Android platform not specified, searching a default one...') self._ap = cocos.select_default_android_platform() if self._ap is None: cocos.Logging.warning('No valid android platform found, will not generate apk.') project_dir = self._platforms.project_path() # for debug reason, depart 2 step here: # 1. build native 2. build apk # only build native code if -p not specified, otherwise build apk also. cocos.Logging.info("building native") with cocos.pushd(project_dir): self._run_cmd("python build_native.py -b %s -n \"-j %s\"" % (self._mode, self._jobs)) cocos.Logging.info("building apk") with cocos.pushd(project_dir): self._run_cmd("python build_native.py -b %s -p %s -n \"-j %s\"" % (self._mode, self._ap, self._jobs))
def _check_custom_options(self, options): self._mode = "debug" if options.mode: if options.mode == "debug": self._mode = "debug" elif options.mode == "release": self._mode = "release" cocos.Logging.info("Building mode: %s" % self._mode) android_platform = options.android_platform if not android_platform: cocos.Logging.info("Android platform not specified, searching a default one...") android_platform = cocos.select_default_android_platform() if android_platform is None: cocos.Logging.warning("No valid android platform found, will not generate apk.") self._ap = android_platform self._jobs = 1 if options.jobs: self._jobs = options.jobs