def _run_ios_app(self, ios_app_path):
        if not cocos.os_is_mac():
            raise cocos.CCPluginError(
                'Now only support run iOS simulator on Mac OS')

        # get bundle id
        bundle_id = self._get_bundle_id(ios_app_path)

        # find simulator
        simulator_id = self._get_simulator_id()

        try:
            # run the simulator
            xcode_version = cocos.get_xcode_version()
            xcode9_and_upper = cocos.version_compare(xcode_version, ">=", 9)
            if xcode9_and_upper:
                self._run_cmd('xcrun simctl boot "%s"' % simulator_id)
                self._run_cmd(
                    'open `xcode-select -p`/Applications/Simulator.app')
            else:
                self._run_cmd('xcrun instruments -w "%s"' % simulator_id)
        except Exception as e:
            pass

        # install app
        self._run_cmd('xcrun simctl install "%s" "%s"' %
                      (simulator_id, ios_app_path))

        # run app
        self._run_cmd('xcrun simctl launch "%s" "%s"' %
                      (simulator_id, bundle_id))
예제 #2
0
    def get_ios_sim_name(self):
        # get the version of xcodebuild
        ver = cocos.get_xcode_version()

        if ver.startswith("5"):
            ret = "ios-sim-xcode5"
        else:
            ret = "ios-sim-xcode6"

        return ret
    def get_ios_sim_name(self):
        # get the version of xcodebuild
        ver = cocos.get_xcode_version()

        if ver.startswith("5"):
            ret = "ios-sim-xcode5"
        else:
            ret = "ios-sim-xcode6"

        return ret
    def get_ios_sim_name(self):
        # get the version of xcodebuild
        ver = cocos.get_xcode_version()
        match = re.match(r'(\d+).*', ver)
        ret = None
        if match:
            ver_num = int(match.group(1))
            if ver_num <= 5:
                ret = "ios-sim-xcode5"
            elif ver_num < 8:
                ret = "ios-sim-xcode6"

        return ret
예제 #5
0
    def get_ios_sim_name(self):
        # get the version of xcodebuild
        ver = cocos.get_xcode_version()
        match = re.match(r'(\d+).*', ver)
        ret = None
        if match:
            ver_num = int(match.group(1))
            if ver_num <= 5:
                ret = "ios-sim-xcode5"
            elif ver_num < 8:
                ret = "ios-sim-xcode6"

        return ret
예제 #6
0
    def check_ios_mac_build_depends(self):
        version = cocos.get_xcode_version()

        if version <= '5':
            message = "Update xcode please"
            raise cocos.CCPluginError(message)

        cfg_obj = self._platforms.get_current_config()
        if cfg_obj.proj_file is not None:
            xcodeproj_name = cfg_obj.proj_file
            name = os.path.basename(xcodeproj_name)
        else:
            name, xcodeproj_name = self.checkFileByExtention(".xcodeproj", self._platforms.project_path())
        if not xcodeproj_name:
            message = "Can't find the \".xcodeproj\" file"
            raise cocos.CCPluginError(message)

        self.project_name = name
        self.xcodeproj_name = xcodeproj_name
예제 #7
0
    def check_ios_mac_build_depends(self):
        version = cocos.get_xcode_version()

        if version <= '5':
            message = "Update xcode please"
            raise cocos.CCPluginError(message)

        cfg_obj = self._platforms.get_current_config()
        if cfg_obj.proj_file is not None:
            xcodeproj_name = cfg_obj.proj_file
            name = os.path.basename(xcodeproj_name)
        else:
            name, xcodeproj_name = self.checkFileByExtention(
                ".xcodeproj", self._platforms.project_path())
        if not xcodeproj_name:
            message = "Can't find the \".xcodeproj\" file"
            raise cocos.CCPluginError(message)

        self.project_name = name
        self.xcodeproj_name = xcodeproj_name