From 39b2c940ae4ba4db3d6a4459cd786d5091e9d647 Mon Sep 17 00:00:00 2001 From: minggo Date: Thu, 14 Jan 2021 14:36:37 +0800 Subject: [PATCH] Remove unneeded files (#3221) * remove unneeded files * remove submodule cocos2d-console --- native/.gitmodules | 3 - native/tools/cocos-console/.gitignore | 4 - native/tools/cocos-console/bin/afs.js | 17 - native/tools/cocos-console/bin/afs.ts | 15 - native/tools/cocos-console/bin/cocos | 8 - native/tools/cocos-console/bin/cocos.bat | 2 - native/tools/cocos-console/bin/cocos_cli.js | 789 ------------- native/tools/cocos-console/bin/cocos_cli.ts | 859 -------------- .../tools/cocos-console/bin/cocos_config.json | 59 - .../cocos-console/bin/cocos_project_config.js | 4 - .../cocos-console/bin/cocos_project_types.js | 4 - .../cocos-console/bin/cocos_project_types.ts | 63 - .../tools/cocos-console/bin/multi_language.js | 120 -- .../tools/cocos-console/bin/multi_language.ts | 127 -- .../tools/cocos-console/bin/plugin_compile.js | 140 --- .../tools/cocos-console/bin/plugin_compile.ts | 133 --- .../cocos-console/bin/plugin_generate.js | 276 ----- .../cocos-console/bin/plugin_generate.ts | 288 ----- native/tools/cocos-console/bin/plugin_new.js | 556 --------- native/tools/cocos-console/bin/plugin_new.ts | 610 ---------- native/tools/cocos-console/bin/plugin_run.js | 252 ---- native/tools/cocos-console/bin/plugin_run.ts | 267 ----- native/tools/cocos-console/bin/strings.json | 1038 ----------------- native/tools/cocos-console/tsconfig.json | 66 -- native/tools/cocos2d-console | 1 - 25 files changed, 5701 deletions(-) delete mode 100644 native/tools/cocos-console/.gitignore delete mode 100644 native/tools/cocos-console/bin/afs.js delete mode 100644 native/tools/cocos-console/bin/afs.ts delete mode 100644 native/tools/cocos-console/bin/cocos delete mode 100644 native/tools/cocos-console/bin/cocos.bat delete mode 100644 native/tools/cocos-console/bin/cocos_cli.js delete mode 100644 native/tools/cocos-console/bin/cocos_cli.ts delete mode 100644 native/tools/cocos-console/bin/cocos_config.json delete mode 100644 native/tools/cocos-console/bin/cocos_project_config.js delete mode 100644 native/tools/cocos-console/bin/cocos_project_types.js delete mode 100644 native/tools/cocos-console/bin/cocos_project_types.ts delete mode 100644 native/tools/cocos-console/bin/multi_language.js delete mode 100644 native/tools/cocos-console/bin/multi_language.ts delete mode 100644 native/tools/cocos-console/bin/plugin_compile.js delete mode 100644 native/tools/cocos-console/bin/plugin_compile.ts delete mode 100644 native/tools/cocos-console/bin/plugin_generate.js delete mode 100644 native/tools/cocos-console/bin/plugin_generate.ts delete mode 100644 native/tools/cocos-console/bin/plugin_new.js delete mode 100644 native/tools/cocos-console/bin/plugin_new.ts delete mode 100644 native/tools/cocos-console/bin/plugin_run.js delete mode 100644 native/tools/cocos-console/bin/plugin_run.ts delete mode 100644 native/tools/cocos-console/bin/strings.json delete mode 100644 native/tools/cocos-console/tsconfig.json delete mode 160000 native/tools/cocos2d-console diff --git a/native/.gitmodules b/native/.gitmodules index 10ed2600a5..e69de29bb2 100644 --- a/native/.gitmodules +++ b/native/.gitmodules @@ -1,3 +0,0 @@ -[submodule "tools/cocos2d-console"] - path = tools/cocos2d-console - url = https://github.com/cocos-creator/cocos2d-console.git diff --git a/native/tools/cocos-console/.gitignore b/native/tools/cocos-console/.gitignore deleted file mode 100644 index 446a575a2d..0000000000 --- a/native/tools/cocos-console/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules/ -package.json -package-lock.json -**/*.map.js \ No newline at end of file diff --git a/native/tools/cocos-console/bin/afs.js b/native/tools/cocos-console/bin/afs.js deleted file mode 100644 index 0b83287cbe..0000000000 --- a/native/tools/cocos-console/bin/afs.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const fs = require("fs"); -const util_1 = require("util"); -exports.afs = { - readFile: util_1.promisify(fs.readFile), - readdir: util_1.promisify(fs.readdir), - stat: util_1.promisify(fs.stat), - exists: util_1.promisify(fs.exists), - copyFile: util_1.promisify(fs.copyFile), - writeFile: util_1.promisify(fs.writeFile), - mkdir: util_1.promisify(fs.mkdir), - mkdtemp: util_1.promisify(fs.mkdtemp), - unlink: util_1.promisify(fs.unlink), - rmdir: util_1.promisify(fs.rmdir) -}; -//# sourceMappingURL=afs.js.map \ No newline at end of file diff --git a/native/tools/cocos-console/bin/afs.ts b/native/tools/cocos-console/bin/afs.ts deleted file mode 100644 index 637f8bb9ed..0000000000 --- a/native/tools/cocos-console/bin/afs.ts +++ /dev/null @@ -1,15 +0,0 @@ -import * as fs from "fs"; -import {promisify} from "util"; - -export const afs = { - readFile: promisify(fs.readFile), - readdir: promisify(fs.readdir), - stat: promisify(fs.stat), - exists: promisify(fs.exists), - copyFile: promisify(fs.copyFile), - writeFile: promisify(fs.writeFile), - mkdir: promisify(fs.mkdir), - mkdtemp: promisify(fs.mkdtemp), - unlink: promisify(fs.unlink), - rmdir: promisify(fs.rmdir) -}; diff --git a/native/tools/cocos-console/bin/cocos b/native/tools/cocos-console/bin/cocos deleted file mode 100644 index d0c16661c2..0000000000 --- a/native/tools/cocos-console/bin/cocos +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -l - -COCOS_CONSOLE_BIN_DIRECTORY=$(dirname "$0") -COCOS_CONSOLE_BIN_DIRECTORY=$(cd "$COCOS_CONSOLE_BIN_DIRECTORY" && pwd -P) - -#python "$COCOS_CONSOLE_BIN_DIRECTORY/cocos.py" "$@" -node $COCOS_CONSOLE_BIN_DIRECTORY/cocos_cli.js "$@" - diff --git a/native/tools/cocos-console/bin/cocos.bat b/native/tools/cocos-console/bin/cocos.bat deleted file mode 100644 index 7dfe7cb0e0..0000000000 --- a/native/tools/cocos-console/bin/cocos.bat +++ /dev/null @@ -1,2 +0,0 @@ -@echo off -@node "%~dp0/cocos_cli.js" %* \ No newline at end of file diff --git a/native/tools/cocos-console/bin/cocos_cli.js b/native/tools/cocos-console/bin/cocos_cli.js deleted file mode 100644 index 57f25b8aff..0000000000 --- a/native/tools/cocos-console/bin/cocos_cli.js +++ /dev/null @@ -1,789 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const fs = require("fs"); -const path = require("path"); -const ml = require("./multi_language"); -const cocos_cfg = require("./cocos_config.json"); -const os = require("os"); -const afs_1 = require("./afs"); -const child_process = require("child_process"); -var ArgumentItemType; -(function (ArgumentItemType) { - ArgumentItemType[ArgumentItemType["BOOL_FLAG"] = 0] = "BOOL_FLAG"; - ArgumentItemType[ArgumentItemType["STRING_VALUE"] = 1] = "STRING_VALUE"; - ArgumentItemType[ArgumentItemType["ACTION"] = 2] = "ACTION"; - ArgumentItemType[ArgumentItemType["ENUM"] = 3] = "ENUM"; -})(ArgumentItemType || (ArgumentItemType = {})); -/** pre-defined arguments */ -exports.pa = { - help: { short: "-h", long: "--help", help: "show this message", arg_type: ArgumentItemType.ACTION }, - src_dir: { short: "-s", long: "--src", help: ml.get_string("COCOS_HELP_ARG_SRC"), arg_type: ArgumentItemType.STRING_VALUE }, - quiet: { short: '-q', long: "--quiet", help: ml.get_string("COCOS_HELP_ARG_PLATFORM"), arg_type: ArgumentItemType.BOOL_FLAG }, - platform: { short: "-p", long: "--platform", help: ml.get_string("COCOS_HELP_ARG_PLATFORM"), arg_type: ArgumentItemType.ENUM, enum_values: cocos_cfg.platforms }, - do_list_platforms: { short: "", long: "--list-platforms", help: "list available platforms", arg_type: ArgumentItemType.ACTION }, - proj_dir: { short: "", long: "--proj-dir", help: ml.get_string("COCOS_HELP_ARG_PROJ_DIR"), arg_type: ArgumentItemType.STRING_VALUE }, - build_dir: { short: "", long: "--build-dir", help: "specify directory where to build project", arg_type: ArgumentItemType.STRING_VALUE }, - package_name: { short: "-p", long: "--package", help: ml.get_string("NEW_ARG_PACKAGE"), arg_type: ArgumentItemType.STRING_VALUE }, - directory: { short: "-d", long: "--directory", help: ml.get_string("NEW_ARG_DIR"), arg_type: ArgumentItemType.STRING_VALUE }, - ios_bundleid: { short: "", long: "--ios-bundleid", help: ml.get_string("NEW_ARG_IOS_BUNDLEID"), arg_type: ArgumentItemType.STRING_VALUE }, - mac_bundleid: { short: "", long: "--mac-bundleid", help: ml.get_string("NEW_ARG_MAC_BUNDLEID"), arg_type: ArgumentItemType.STRING_VALUE }, - engine_path: { short: "-e", long: "--engine-path", help: ml.get_string("NEW_ARG_ENGINE_PATH"), arg_type: ArgumentItemType.STRING_VALUE }, - portrait: { short: "", long: "--portrait", help: ml.get_string("NEW_ARG_PORTRAIT"), arg_type: ArgumentItemType.BOOL_FLAG }, - no_native: { short: "", long: "--no-native", help: ml.get_string("NEW_ARG_NO_NATIVE"), arg_type: ArgumentItemType.BOOL_FLAG }, - language: { short: "-l", long: "--language", help: ml.get_string("NEW_ARG_LANG"), arg_type: ArgumentItemType.ENUM, enum_values: cocos_cfg.languages }, - do_list_templates: { short: "", long: "--list-templates", help: "List available templates. To be used with --template option.", arg_type: ArgumentItemType.ACTION }, - template_name: { short: "-k", long: "--template-name", help: 'Name of the template to be used to create the game. To list available names, use --list-templates.', arg_type: ArgumentItemType.STRING_VALUE }, - cmake_generator: { short: "-G", long: "--cmake-generator", help: "Set cmake generator", arg_type: ArgumentItemType.STRING_VALUE }, - cmake_path: { short: "", long: "--cmake-path", help: "path to cmake.exe or cmake", arg_type: ArgumentItemType.STRING_VALUE }, - ios_simulator: { short: "", long: "--ios-simulator", help: "enable iOS simulator support", arg_type: ArgumentItemType.BOOL_FLAG }, - teamid: { short: "", long: "--team-id", help: "Apple developer team id", arg_type: ArgumentItemType.STRING_VALUE }, - shared_dir: { short: "", long: "--shared-dir", help: "Shared source directory", arg_type: ArgumentItemType.STRING_VALUE }, -}; -class ArgumentParser { - constructor() { - this.definations = []; - this.values = {}; - this.other_values = []; - } - add_argument(short, long, field, arg_type, help, enum_values, required, action, default_value) { - if (short.length != 0 && (!short.startsWith("-") || short.length != 2)) { - console.error(`short argument ${short} format incorrect!`); - } - if (!long.startsWith("--")) { - console.error(`long argument ${long} format incorrect!`); - } - let item = { short, long, help, arg_type, field, enum_values, action, required, default_value }; - this.definations.push(item); - return item; - } - add_predefined_argument(field, action) { - let item = exports.pa[field]; - if (item) { - return this.add_argument(item.short, item.long, field, item.arg_type, item.help, item.enum_values, false, action); - } - else { - console.error(`Predefiend argument "${field}" is not found!`); - } - } - add_predefined_argument_with_default(field, default_value) { - let item = exports.pa[field]; - if (item) { - return this.add_argument(item.short, item.long, field, item.arg_type, item.help, item.enum_values, false, undefined, default_value); - } - else { - console.error(`Predefiend argument "${field}" is not found!`); - } - } - add_required_predefined_argument(field, action) { - let item = exports.pa[field]; - if (item) { - return this.add_argument(item.short, item.long, field, item.arg_type, item.help, item.enum_values, true, action); - } - else { - console.error(`Predefiend argument "${field}" is not found!`); - } - } - parse(list) { - let cfgs = []; - for (let i = 0; i < list.length; i++) { - let line = list[i]; - cfgs.length = 0; - let prefix; - if (line.startsWith("--")) { - let p1 = line; - if (line.match(/^--[-_a-z]+=/)) { // contains `=` --template-name= - p1 = line.split("=")[0]; - } - cfgs = this.definations.filter(x => x.long == p1).sort((a, b) => a.long.length - b.long.length); - if (cfgs.length > 0) - prefix = cfgs[0].long; - } - else if (line.startsWith("-")) { - cfgs = this.definations.filter(x => x.short.length > 0 && line == x.short); - if (cfgs.length > 0) - prefix = cfgs[0].short; - } - else { - this.other_values.push(line); - continue; - } - if (cfgs.length > 0) { - if (cfgs.length > 1) { - console.error(`multiple argument match ${line}`); - break; - } - const cfg = cfgs[0]; - if (cfg.arg_type == ArgumentItemType.BOOL_FLAG) { - this.values[cfg.field] = true; - if (line.length > prefix.length) { - console.warn(`argument ${line} too long?`); - } - } - else if (cfg.arg_type == ArgumentItemType.STRING_VALUE || cfg.arg_type == ArgumentItemType.ENUM) { - if (line.length == prefix.length) { - if (list[i + 1] == undefined || list[i + 1].startsWith("-")) { - console.warn(`argument "${prefix}" is not provided with value?`); - } - this.values[cfg.field] = list[i + 1]; - i++; - continue; - } - if (line.length > prefix.length) { - let value = line.substr(prefix.length); - this.values[cfg.field] = value[0] === "=" ? value.substr(1) : value; - continue; - } - } - else if (cfg.arg_type == ArgumentItemType.ACTION) { - this.values[cfg.field] = cfg.action; - } - } - else { - console.warn(`unknown argument: ${line}`); - } - } - } - defination_for(key) { - let list = this.definations.filter(x => x.field == key); - if (list.length > 1) { - console.warn(`multiply command line argument definations for "${key}"`); - } - else if (list.length == 0) { - console.error(`no command line argument defination for "${key}" found!`); - return null; - } - return list[0]; - } - get_bool(key) { - return this.values[key] === true; - } - set_bool(key, value) { - this.values[key] = value; - } - get_path(key) { - if (!(key in this.values)) { - console.log(`[warn] argument ${key} not set!`); - } - return (key in this.values) ? this.values[key] : this.defination_for(key).default_value; - } - get_string(key) { - if (!(key in this.values)) { - console.log(`[warn] argument ${key} not set!`); - } - return this.get_path(key); - } - set_string(key, v) { - this.values[key] = v; - } - exist_key(key) { - return key in this.values; - } - call(key) { - if (typeof this.values[key] === "function") { - this.values[key].apply(); - } - else { - console.log(`[warn] argument value of ${key} is not a function`); - } - } - call_all() { - for (let key in this.values) { - let f = this.values[key]; - if (typeof (f) === "function") { - f.call(); - return true; - } - } - return false; - } - get_otherargs() { - return this.other_values; - } - print() { - console.log("Usage:"); - for (let i of this.definations) { - console.log(` ${i.short.length == 0 ? "" : i.short + ", "}${i.long} \t: ${i.help}`); - } - } - validate() { - for (let key in this.values) { - // validate enums - let v = this.values[key]; - let defs = this.definations.filter(x => x.field == key); - if (defs.length > 0) { - if (defs[0].arg_type == ArgumentItemType.ENUM) { - if (!defs[0].enum_values.includes(v)) { - console.error(` incorrect argument "${defs[0].long} ${v}", expect "${defs[0].enum_values.join(",")}"`); - } - } - } - } - for (let d of this.definations) { - if (d.required && !(d.field in this.values)) { - console.error(` required argument ${d.long} is not provided!`); - } - } - } -} -class CCPlugin { - constructor() { - this._cocos2d_path = null; - this._template_path = null; - this._plugin_name = null; - this.ext_args = []; - this.parser = new ArgumentParser(); - } - extend_argv(args) { - this.ext_args = this.ext_args.concat(args); - } - get_cocos_root() { - let engine_path = this.get_engine_path(); - if (!!engine_path) { - return engine_path; - } - if (!this._cocos2d_path) { - this._cocos2d_path = path.join(__dirname, "../../.."); - if (!fs.existsSync(path.join(this._cocos2d_path, "cocos"))) { - console.warn(ml.get_string("COCOS_WARNING_ENGINE_NOT_FOUND")); - this._cocos2d_path = null; - } - } - return this._cocos2d_path; - } - get_consle_root() { - let engine_path = this.get_engine_path(); - if (!!engine_path) { - return path.join(engine_path, "tools/cocos-console"); - } - return path.join(__dirname, ".."); - } - get_templates_root_path() { - let engine_path = this.get_engine_path(); - if (!!engine_path) { - return path.join(engine_path, "templates"); - } - if (!this._template_path) { - let cocos2d_path = this.get_cocos_root(); - if (cocos2d_path) { - this._template_path = path.join(cocos2d_path, "templates"); - } - else { - this._template_path = null; - } - } - return this._template_path; - } - get project_dir() { - let dir = this.args.get_path("directory"); - return cchelper.replace_env_variables(dir); - } - get_cmake_generator() { - return this.args.get_string("cmake_generator"); - } - get_build_dir() { - let dir = this.args.get_string("build_dir"); - let ext = ""; - if (this.enable_ios_simulator()) { - ext = "-simulator"; - } - return cchelper.replace_env_variables(path.join(dir, `build-${this.get_platform()}${ext}`)); - } - get_cmake_path() { - let cp = this.args.get_string("cmake_path"); - return !!cp ? cp : "cmake"; - } - enable_ios_simulator() { - return this.args.get_bool("ios_simulator"); - } - get_app_team_id() { - return this.args.get_string("teamid"); - } - run_cmake(args) { - return __awaiter(this, void 0, void 0, function* () { - return new Promise((resolve, reject) => { - console.log(`run cmake with ${args.join(" ")}`); - let cp = child_process.spawn(this.get_cmake_path(), args, { - stdio: ["pipe", "pipe", "pipe"], - env: process.env, - shell: true - }); - cp.stdout.on("data", (data) => { - console.log(`[cmake] ${data}`); - }); - cp.stderr.on("data", (data) => { - console.error(`[cmake-err] ${data}`); - }); - cp.on("close", (code, sig) => { - if (code !== 0) { - reject(new Error(`run cmake failed "cmake ${args.join(" ")}", code: ${code}, signal: ${sig}`)); - return; - } - resolve(); - }); - }); - }); - } - do_list_platforms() { - console.log("support platforms:"); - for (let p of cocos_cfg.platforms) { - console.log(` - ${p}`); - } - } - do_show_help() { - let parser = this.parser; - parser.print(); - } - set_env(key, value) { - process.env[key] = value; - } - get_env(key) { - return process.env[key]; - } - get_current_platform() { - let p = os.platform(); - if (p === "darwin") { - return "mac"; - } - else if (p == "win32") { - return "win32"; - } - console.warn(`platform ${p} is not supported!`); - return p; - } - parse_args() { - let parser = this.parser; - parser.add_predefined_argument("src_dir"); - parser.add_predefined_argument("quiet"); - parser.add_predefined_argument("platform"); - parser.add_predefined_argument("do_list_platforms", this.do_list_platforms.bind(this)); - parser.add_predefined_argument("proj_dir"); - parser.add_predefined_argument("help", this.do_show_help.bind(this)); - this.define_args(); - let args = process.argv.slice(3); - this.parser.parse(args.concat(this.ext_args)); - //expose enviroment variables - this.set_env("COCOS_X_ROOT", this.get_cocos_root()); - } - get_engine_path() { - return null; - } - ///////////////// helper methods - get_templates_dir_names() { - let template_dir = this.get_templates_root_path(); - let dirs = []; - if (template_dir) { - dirs = fs.readdirSync(template_dir).filter(x => !x.startsWith(".")); - dirs = dirs.filter(d => { - let p = path.join(template_dir, d); - let stat = fs.statSync(p); - return stat.isDirectory(); - }); - } - return dirs; - } - get_template_dir_paths() { - let template_dir = this.get_templates_root_path(); - return this.get_templates_dir_names().map(x => path.join(template_dir, x)); - } - get_platform() { - let p = this.parser.get_string("platform"); - if (!p) { - p = this.get_current_platform(); - console.log(`platform not specified, use current platform ${p}`); - } - return p; - } - set_platform(p) { - this.parser.set_string("platform", p); - } - get_plugin_name() { return this._plugin_name; } - set_plugin_name(name) { this._plugin_name = name; } - exec() { - return __awaiter(this, void 0, void 0, function* () { - this.parse_args(); - if (this.parser.call_all()) - return; - this.parser.validate(); - console.log(`[plugin ${this.get_plugin_name()}]: running ...`); - this.init(); - yield this.run(); - console.log(` [plugin ${this.get_plugin_name()}]: done!`); - }); - } - get args() { - return this.parser; - } -} -exports.CCPlugin = CCPlugin; -class cchelper { - static replace_env_variables(str) { - return str.replace(/\$\{([^\}]*)\}/g, (_, n) => process.env[n] == undefined ? _ : process.env[n]). - replace(/(\~)/g, (_, n) => process.env["HOME"]); - } - static fix_path(p) { - p = this.replace_env_variables(p); - if (os.platform() == "win32") { - if (p.indexOf(" ") >= 0) { - console.error(`space found in path "${p}"`); - } - return p.replace(/\\/g, "/").replace(/\/+/, "/"); - } - return p; - } - static delay(ms) { - return __awaiter(this, void 0, void 0, function* () { - return new Promise((resolve, reject) => { - setTimeout(() => __awaiter(this, void 0, void 0, function* () { - resolve(); - }), ms); - }); - }); - } - static join(p1, ...p2) { - let l = p2.map(x => this.replace_env_variables(x)); - if (path.isAbsolute(l[l.length - 1])) - return l[l.length - 1]; - return path.join(this.replace_env_variables(p1), ...p2); - } - static copy_file_sync(src_root, src_file, dst_root, dst_file) { - // console.log(`copy_file_sync args: ${JSON.stringify(arguments)}`); - src_root = this.replace_env_variables(src_root); - src_file = this.replace_env_variables(src_file); - dst_root = this.replace_env_variables(dst_root); - dst_file = this.replace_env_variables(dst_file); - let src = path.isAbsolute(src_file) ? src_file : path.join(src_root, src_file); - let dst = path.isAbsolute(dst_file) ? dst_file : path.join(dst_root, dst_file); - // console.error(`copy_file_sync ${src} -> ${dst}`); - this.make_directory_recursive(path.dirname(dst)); - fs.copyFileSync(src, dst); - } - static copy_file_async(src, dst) { - return __awaiter(this, void 0, void 0, function* () { - // console.log(`[async] copy_file ${src} -> ${dst}`); - this.make_directory_recursive(path.parse(dst).dir); - yield afs_1.afs.copyFile(src, dst); - }); - } - static copy_recursive_async(src_dir, dst) { - return __awaiter(this, void 0, void 0, function* () { - src_dir = this.replace_env_variables(src_dir); - dst = this.replace_env_variables(dst); - let tasks = []; - let src_stat = yield afs_1.afs.stat(src_dir); - if (!src_stat) { - console.error(`failed to stat ${src_dir}`); - return; - } - if (src_stat.isDirectory()) { - this.make_directory_recursive(dst); - let files = yield afs_1.afs.readdir(src_dir); - for (let f of files) { - if (f == "." || f == "..") - continue; - let fp = path.join(src_dir, f); - let tsk = this.copy_recursive_async(fp, path.join(dst, f)); - tasks.push(tsk); - } - yield Promise.all(tasks); - } - else if (src_stat.isFile()) { - try { - yield this.copy_file_async(src_dir, dst); - } - catch (e) { - yield this.delay(10); - console.error(`error: retry copying ${src_dir} -> to ${dst} ... ${e}`); - yield this.copy_file_async(src_dir, dst); - } - } - }); - } - static prepare_dirs_for_files(src_root, files, dst_dir) { - let tree = {}; - for (let f of files) { - let parts = f.split("/"); - let p = tree; - for (let i of parts) { - if (i in p) { - p = p[i]; - } - else { - p = p[i] = {}; - } - } - } - let mkdirs = (src_dir, attrs, dst_dir) => { - let src_stat = fs.statSync(src_dir); - if (!src_stat.isDirectory()) - return; - if (!fs.existsSync(dst_dir)) { - // console.log(`prepere_dir ${dst_dir}`); - fs.mkdirSync(dst_dir); - } - for (let i in attrs) { - if (i !== "." && i !== "..") { - mkdirs(path.join(src_dir, i), attrs[i], path.join(dst_dir, i)); - } - } - }; - mkdirs(src_root, tree, dst_dir); - } - static parallel_copy_files(par, src_root, files, dst_dir) { - let running_tasks = 0; - dst_dir = this.replace_env_variables(dst_dir); - cchelper.prepare_dirs_for_files(src_root, files, dst_dir); - return new Promise((resolve, reject) => { - let copy_async = (src, dst) => __awaiter(this, void 0, void 0, function* () { - running_tasks += 1; - yield this.copy_recursive_async(src, dst); - running_tasks -= 1; - schedule_copy(); - }); - let schedule_copy = () => { - if (files.length > 0 && running_tasks < par) { - let f = files.shift(); - let src_file = path.join(src_root, f); - if (fs.existsSync(src_file)) { - copy_async(src_file, path.join(dst_dir, f)); - } - else { - console.warn(`warning: copy_file: ${src_file} not exists!`); - } - } - if (files.length == 0 && running_tasks == 0) { - resolve(); - } - }; - for (let i = 0; i < par; i++) - schedule_copy(); - }); - } - static make_directory_recursive(dir) { - if (dir.length == 0) - return; - let dirs = []; - let p = dir; - while (!fs.existsSync(p)) { - dirs.push(p); - p = path.join(p, ".."); - } - while (dirs.length > 0) { - fs.mkdirSync(dirs[dirs.length - 1]); - dirs.length = dirs.length - 1; - } - } - static remove_directory_recursive(dir) { - return __awaiter(this, void 0, void 0, function* () { - let stat = yield afs_1.afs.stat(dir); - if (stat.isFile()) { - yield afs_1.afs.unlink(dir); - } - else if (stat.isDirectory()) { - let list = yield afs_1.afs.readdir(dir); - let tasks = []; - for (let f of list) { - if (f == "." || f == "..") - continue; - let fp = path.join(dir, f); - tasks.push(this.remove_directory_recursive(fp)); - } - yield Promise.all(tasks); - yield afs_1.afs.rmdir(dir); - } - }); - } - static copy_files_with_config(cfg, src_root, dst_root) { - return __awaiter(this, void 0, void 0, function* () { - if (!fs.existsSync(src_root)) { - console.error(`copy file src_root ${src_root} is not exists!`); - return; - } - src_root = this.replace_env_variables(src_root); - dst_root = this.replace_env_variables(dst_root); - let from = this.replace_env_variables(cfg.from); - let to = this.replace_env_variables(cfg.to); - if (path.isAbsolute(from)) { - src_root = from; - from = "."; - } - if (path.isAbsolute(to)) { - dst_root = to; - to = "."; - } - // console.log(`copy ${JSON.stringify(cfg)}, ${from} -> ${to} from ${src_root} -> ${dst_root}`); - let build_prefix_tree = (list0) => { - let tree = {}; - let list = list0.map(x => Array.from(x)); - while (list.length > 0) { - let t = list.shift(); - let p = tree; - while (t.length > 0) { - let c = t.shift(); - if (!(c in p)) { - p[c] = {}; - } - p = p[c]; - } - } - return tree; - }; - let match_prefix_tree = (str, tree) => { - if (tree == null) { - return false; - } - let arr = Array.from(str); - let i = 0; - let p = tree; - while (arr[i] in p) { - p = p[arr[i]]; - i++; - } - return i == arr.length && Object.keys(p).length == 0; - }; - let include_prefix = cfg.include ? build_prefix_tree(cfg.include) : null; - let exclude_prefix = cfg.exclude ? build_prefix_tree(cfg.exclude) : null; - let cp_r_async = (src_root, src_dir, dst_root) => __awaiter(this, void 0, void 0, function* () { - let curr_full_dir = path.join(src_root, src_dir); - let stat = yield afs_1.afs.stat(curr_full_dir); - if (stat.isDirectory()) { - let files = yield afs_1.afs.readdir(curr_full_dir); - let subcopies = []; - for (let f of files) { - if (f == "." || f == "..") - continue; - let path_in_src_root = path.join(src_dir, f); - if (exclude_prefix && match_prefix_tree(path_in_src_root, exclude_prefix)) { - if (include_prefix && match_prefix_tree(path_in_src_root, include_prefix)) { - //include - } - else { - console.log(` - skip copy ${src_root} ${path_in_src_root} to ${dst_root}`); - continue; - } - } - subcopies.push(cp_r_async(src_root, path_in_src_root, dst_root)); - } - yield Promise.all(subcopies); - } - else if (stat.isFile()) { - // let dst_file_abs = path.isAbsolute(src_dir) ? src_dir : path.join(dst_root, src_dir); - yield this.copy_file_async(curr_full_dir, path.join(dst_root, src_dir)); - } - }); - let copy_from = this.replace_env_variables(path.normalize(path.join(src_root, from))); - let copy_to = this.replace_env_variables(path.normalize(path.join(dst_root, to))); - yield cp_r_async(src_root, from, copy_to); - }); - } - static replace_in_file(patterns, filepath) { - return __awaiter(this, void 0, void 0, function* () { - filepath = this.replace_env_variables(filepath); - if (!fs.existsSync(filepath)) { - console.log(`warning: file ${filepath} not exists while replacing content!`); - return; - } - // console.log(`replace ${filepath} with ${JSON.stringify(patterns)}`); - let lines = (yield afs_1.afs.readFile(filepath)).toString("utf8").split("\n"); - let new_content = lines.map(l => { - patterns.forEach(p => { - l = l.replace(new RegExp(p.reg), this.replace_env_variables(p.text)); - }); - return l; - }).join("\n"); - yield afs_1.afs.writeFile(filepath, new_content); - }); - } - static exact_value_from_file(regexp, filename, idx) { - if (!(fs.existsSync(filename))) { - console.error(`file ${filename} not exist!`); - return; - } - let lines = fs.readFileSync(filename).toString("utf-8").split("\n"); - for (let l of lines) { - let r = l.match(regexp); - if (r) { - return r[idx]; - } - } - } - static run_cmd(cmd, args, slient, cwd) { - return __awaiter(this, void 0, void 0, function* () { - return new Promise((resolve, reject) => { - console.log(`[run_cmd]: ${cmd} ${args.join(" ")}`); - let cp = child_process.spawn(cmd, args, { - shell: true, - env: process.env, - cwd: cwd || process.cwd() - }); - if (!slient) { - cp.stdout.on(`data`, (chunk) => { - console.log(`[run_cmd ${cmd}] ${chunk}`); - }); - cp.stderr.on(`data`, (chunk) => { - console.log(`[run_cmd ${cmd} - error] ${chunk}`); - }); - } - cp.on("close", (code, signal) => { - if (code != 0 && !slient) - return reject(`faile to exec ${cmd} ${args.join(" ")}`); - resolve(); - }); - }); - }); - } -} -exports.cchelper = cchelper; -class CCPluginRunner { - load_plugin(plugin_name) { - let p = null; - let script_path = path.join(__dirname, `plugin_${plugin_name}.js`); - if (!fs.existsSync(script_path)) { - console.error(`Plugin ${plugin_name} is not defined!`); - process.exit(1); - } - let exp = require(script_path); - let klsName = `CCPlugin${plugin_name.toUpperCase()}`; - if (klsName in exp) { - p = new exp[klsName]; - } - else { - console.error(`${klsName} not defined in plugin_${plugin_name}.js`); - process.exit(1); - } - p.set_plugin_name(plugin_name); - return p; - } - run() { - return __awaiter(this, void 0, void 0, function* () { - let plugin_name = process.argv[2]; - let task = []; - let p; - do { - p = this.load_plugin(plugin_name); - task.push(p); - } while ((plugin_name = p.depends()) !== null); - for (let i = task.length - 1; i >= 0; i--) { - yield task[i].exec(); - } - }); - } -} -process.on("unhandledRejection", (err, promise) => { - console.error(`----unhandledRejection---`); - console.error(err); -}); -let runner = new CCPluginRunner(); -runner.run().then(() => { - console.log(`[all done!]`); - process.exit(0); -}); -//# sourceMappingURL=cocos_cli.js.map \ No newline at end of file diff --git a/native/tools/cocos-console/bin/cocos_cli.ts b/native/tools/cocos-console/bin/cocos_cli.ts deleted file mode 100644 index f37eeed8c1..0000000000 --- a/native/tools/cocos-console/bin/cocos_cli.ts +++ /dev/null @@ -1,859 +0,0 @@ - - -import * as fs from "fs"; -import * as path from "path"; -import * as ml from "./multi_language"; -import * as cocos_cfg from "./cocos_config.json"; -import * as os from "os"; -import { afs } from "./afs"; -import * as child_process from "child_process"; - -enum ArgumentItemType { - BOOL_FLAG, - STRING_VALUE, - ACTION, - ENUM, -} - -interface ArgumentConfig { - short: string; - long: string; - field?: string; - help: string; - arg_type: ArgumentItemType; - action?: () => void; - enum_values?: string[]; - required: boolean; - default_value?: string; -} - -/** pre-defined arguments */ -export const pa = { - help: { short: "-h", long: "--help", help: "show this message", arg_type: ArgumentItemType.ACTION }, - src_dir: { short: "-s", long: "--src", help: ml.get_string("COCOS_HELP_ARG_SRC"), arg_type: ArgumentItemType.STRING_VALUE }, - quiet: { short: '-q', long: "--quiet", help: ml.get_string("COCOS_HELP_ARG_PLATFORM"), arg_type: ArgumentItemType.BOOL_FLAG }, - platform: { short: "-p", long: "--platform", help: ml.get_string("COCOS_HELP_ARG_PLATFORM"), arg_type: ArgumentItemType.ENUM, enum_values: cocos_cfg.platforms }, - do_list_platforms: { short: "", long: "--list-platforms", help: "list available platforms", arg_type: ArgumentItemType.ACTION }, - proj_dir: { short: "", long: "--proj-dir", help: ml.get_string("COCOS_HELP_ARG_PROJ_DIR"), arg_type: ArgumentItemType.STRING_VALUE }, - build_dir: { short: "", long: "--build-dir", help: "specify directory where to build project", arg_type: ArgumentItemType.STRING_VALUE }, - package_name: { short: "-p", long: "--package", help: ml.get_string("NEW_ARG_PACKAGE"), arg_type: ArgumentItemType.STRING_VALUE }, - directory: { short: "-d", long: "--directory", help: ml.get_string("NEW_ARG_DIR"), arg_type: ArgumentItemType.STRING_VALUE }, - ios_bundleid: { short: "", long: "--ios-bundleid", help: ml.get_string("NEW_ARG_IOS_BUNDLEID"), arg_type: ArgumentItemType.STRING_VALUE }, - mac_bundleid: { short: "", long: "--mac-bundleid", help: ml.get_string("NEW_ARG_MAC_BUNDLEID"), arg_type: ArgumentItemType.STRING_VALUE }, - engine_path: { short: "-e", long: "--engine-path", help: ml.get_string("NEW_ARG_ENGINE_PATH"), arg_type: ArgumentItemType.STRING_VALUE }, - portrait: { short: "", long: "--portrait", help: ml.get_string("NEW_ARG_PORTRAIT"), arg_type: ArgumentItemType.BOOL_FLAG }, - no_native: { short: "", long: "--no-native", help: ml.get_string("NEW_ARG_NO_NATIVE"), arg_type: ArgumentItemType.BOOL_FLAG }, - language: { short: "-l", long: "--language", help: ml.get_string("NEW_ARG_LANG"), arg_type: ArgumentItemType.ENUM, enum_values: cocos_cfg.languages }, - do_list_templates: { short: "", long: "--list-templates", help: "List available templates. To be used with --template option.", arg_type: ArgumentItemType.ACTION }, - template_name: { short: "-k", long: "--template-name", help: 'Name of the template to be used to create the game. To list available names, use --list-templates.', arg_type: ArgumentItemType.STRING_VALUE }, - cmake_generator: { short: "-G", long: "--cmake-generator", help: "Set cmake generator", arg_type: ArgumentItemType.STRING_VALUE }, - cmake_path: { short: "", long: "--cmake-path", help: "path to cmake.exe or cmake", arg_type: ArgumentItemType.STRING_VALUE }, - ios_simulator: { short: "", long: "--ios-simulator", help: "enable iOS simulator support", arg_type: ArgumentItemType.BOOL_FLAG }, - teamid: { short: "", long: "--team-id", help: "Apple developer team id", arg_type: ArgumentItemType.STRING_VALUE }, - shared_dir: { short: "", long: "--shared-dir", help: "Shared source directory", arg_type: ArgumentItemType.STRING_VALUE }, -}; - - - - -class ArgumentParser { - private definations: ArgumentConfig[] = []; - - private values: { [key: string]: (string | boolean | { (): void }) } = {}; - private other_values: string[] = []; - - add_argument(short: string, long: string, field: string, arg_type: ArgumentItemType, help: string, enum_values: string[], required: boolean, action?: () => void, default_value?: string): ArgumentConfig { - if (short.length != 0 && (!short.startsWith("-") || short.length != 2)) { - console.error(`short argument ${short} format incorrect!`); - } - if (!long.startsWith("--")) { - console.error(`long argument ${long} format incorrect!`); - } - let item = { short, long, help, arg_type, field, enum_values, action, required, default_value }; - this.definations.push(item); - return item; - } - - add_predefined_argument(field: string, action?: () => void): ArgumentConfig | undefined { - let item = (pa as any)[field]; - if (item) { - return this.add_argument(item.short, item.long, field, item.arg_type, item.help, item.enum_values, false, action); - } else { - console.error(`Predefiend argument "${field}" is not found!`) - } - } - - add_predefined_argument_with_default(field: string, default_value: string): ArgumentConfig | undefined { - let item = (pa as any)[field]; - if (item) { - return this.add_argument(item.short, item.long, field, item.arg_type, item.help, item.enum_values, false, undefined, default_value); - } else { - console.error(`Predefiend argument "${field}" is not found!`) - } - } - - add_required_predefined_argument(field: string, action?: () => void): ArgumentConfig | undefined { - let item = (pa as any)[field]; - if (item) { - return this.add_argument(item.short, item.long, field, item.arg_type, item.help, item.enum_values, true, action); - } else { - console.error(`Predefiend argument "${field}" is not found!`) - } - } - - parse(list: string[]) { - - let cfgs: ArgumentConfig[] = []; - for (let i = 0; i < list.length; i++) { - let line = list[i]; - cfgs.length = 0; - let prefix: string; - if (line.startsWith("--")) { - let p1: string = line; - if (line.match(/^--[-_a-z]+=/)) { // contains `=` --template-name= - p1 = line.split("=")[0]; - } - cfgs = this.definations.filter(x => x.long == p1).sort((a, b) => a.long.length - b.long.length); - if (cfgs.length > 0) prefix = cfgs[0].long; - } else if (line.startsWith("-")) { - cfgs = this.definations.filter(x => x.short.length > 0 && line == x.short); - if (cfgs.length > 0) prefix = cfgs[0].short; - } else { - this.other_values.push(line); - continue; - } - - - if (cfgs.length > 0) { - if (cfgs.length > 1) { - console.error(`multiple argument match ${line}`); - break; - } - const cfg = cfgs[0]; - if (cfg.arg_type == ArgumentItemType.BOOL_FLAG) { - this.values[cfg.field!] = true; - if (line.length > prefix!.length) { - console.warn(`argument ${line} too long?`) - } - } else if (cfg.arg_type == ArgumentItemType.STRING_VALUE || cfg.arg_type == ArgumentItemType.ENUM) { - - if (line.length == prefix!.length) { - if (list[i + 1] == undefined || list[i + 1].startsWith("-")) { - console.warn(`argument "${prefix!}" is not provided with value?`) - } - this.values[cfg.field!] = list[i + 1]; - i++; - continue; - } - if (line.length > prefix!.length) { - let value = line.substr(prefix!.length); - this.values[cfg.field!] = value[0] === "=" ? value.substr(1) : value; - continue; - } - } else if (cfg.arg_type == ArgumentItemType.ACTION) { - this.values[cfg.field!] = cfg.action!; - } - } else { - console.warn(`unknown argument: ${line}`) - } - } - } - - private defination_for(key: string): ArgumentConfig | null { - let list = this.definations.filter(x => x.field == key); - if (list.length > 1) { - console.warn(`multiply command line argument definations for "${key}"`); - } else if (list.length == 0) { - console.error(`no command line argument defination for "${key}" found!`); - return null; - } - return list[0]; - } - - public get_bool(key: string): boolean { - return (this.values[key] as boolean) === true; - } - - public set_bool(key:string, value:boolean) { - this.values[key] = value; - } - - public get_path(key: string): string { - if (!(key in this.values)) { - console.log(`[warn] argument ${key} not set!`); - } - return (key in this.values) ? this.values[key] as string : this.defination_for(key)!.default_value!; - } - - public get_string(key: string): string { - if (!(key in this.values)) { - console.log(`[warn] argument ${key} not set!`); - } - return this.get_path(key); - } - - public set_string(key:string, v:string) { - this.values[key] = v; - } - - public exist_key(key: string): boolean { - return key in this.values; - } - - public call(key: string): void { - if (typeof this.values[key] === "function") { - (this.values[key] as any).apply(); - } else { - console.log(`[warn] argument value of ${key} is not a function`) - } - } - - public call_all(): boolean { - for (let key in this.values) { - let f = this.values[key]; - if (typeof (f) === "function") { - (f as any).call(); - return true; - } - } - return false; - } - - public get_otherargs(): string[] { - return this.other_values; - } - - public print() { - console.log("Usage:") - for (let i of this.definations) { - console.log(` ${i.short.length == 0 ? "" : i.short + ", "}${i.long} \t: ${i.help}`); - } - } - - public validate() { - for (let key in this.values) { - // validate enums - let v = this.values[key]; - let defs = this.definations.filter(x => x.field == key); - if (defs.length > 0) { - if (defs[0].arg_type == ArgumentItemType.ENUM) { - if (!defs[0].enum_values!.includes(v as string)) { - console.error(` incorrect argument "${defs[0].long} ${v}", expect "${defs[0].enum_values!.join(",")}"`); - } - } - } - } - - for (let d of this.definations) { - if (d.required && !(d.field! in this.values)) { - console.error(` required argument ${d.long} is not provided!`); - } - } - } -} - - -export abstract class CCPlugin { - private _cocos2d_path: string | null = null; - private _template_path: string | null = null; - private _plugin_name: string | null = null; - private ext_args:string[] = []; - - parser: ArgumentParser = new ArgumentParser(); - - extend_argv(args:string[]) { - this.ext_args = this.ext_args.concat(args); - } - - get_cocos_root(): string | null { - - let engine_path = this.get_engine_path(); - if (!!engine_path) { - return engine_path; - } - - if (!this._cocos2d_path) { - this._cocos2d_path = path.join(__dirname, "../../.."); - if (!fs.existsSync(path.join(this._cocos2d_path, "cocos"))) { - console.warn(ml.get_string("COCOS_WARNING_ENGINE_NOT_FOUND")); - this._cocos2d_path = null; - } - } - return this._cocos2d_path; - } - - get_consle_root(): string { - let engine_path = this.get_engine_path(); - if (!!engine_path) { - return path.join(engine_path, "tools/cocos-console"); - } - - return path.join(__dirname, ".."); - } - - get_templates_root_path(): string | null { - - let engine_path = this.get_engine_path(); - if (!!engine_path) { - return path.join(engine_path, "templates"); - } - - - if (!this._template_path) { - let cocos2d_path = this.get_cocos_root(); - if (cocos2d_path) { - this._template_path = path.join(cocos2d_path, "templates"); - } else { - this._template_path = null; - } - } - return this._template_path; - } - - - get project_dir(): string | undefined { - let dir = this.args.get_path("directory"); - return cchelper.replace_env_variables(dir); - } - - get_cmake_generator(): string | undefined { - return this.args.get_string("cmake_generator"); - } - - get_build_dir(): string { - let dir = this.args.get_string("build_dir"); - let ext = ""; - if (this.enable_ios_simulator()) { - ext = "-simulator"; - } - return cchelper.replace_env_variables(path.join(dir, `build-${this.get_platform()}${ext}`)); - } - - get_cmake_path(): string { - let cp = this.args.get_string("cmake_path"); - return !!cp ? cp : "cmake"; - } - - enable_ios_simulator(): boolean { - return this.args.get_bool("ios_simulator"); - } - - get_app_team_id(): string | undefined { - return this.args.get_string("teamid"); - } - - - async run_cmake(args: string[]) { - return new Promise((resolve, reject) => { - console.log(`run cmake with ${args.join(" ")}`); - let cp = child_process.spawn(this.get_cmake_path(), args, { - stdio: ["pipe", "pipe", "pipe"], - env: process.env, - shell: true - }); - cp.stdout.on("data", (data) => { - console.log(`[cmake] ${data}`); - }); - cp.stderr.on("data", (data) => { - console.error(`[cmake-err] ${data}`); - }); - cp.on("close", (code, sig) => { - if (code !== 0) { - reject(new Error(`run cmake failed "cmake ${args.join(" ")}", code: ${code}, signal: ${sig}`)); - return; - } - resolve(); - }); - }); - } - - private do_list_platforms() { - console.log("support platforms:"); - for (let p of cocos_cfg.platforms) { - console.log(` - ${p}`); - } - } - - private do_show_help() { - let parser = this.parser; - parser.print(); - } - - protected set_env(key: string, value: string) { - process.env[key] = value; - } - - protected get_env(key: string): string { - return process.env[key]!; - } - - get_current_platform(): string { - let p = os.platform(); - if (p === "darwin") { - return "mac"; - } else if (p == "win32") { - return "win32"; - } - console.warn(`platform ${p} is not supported!`); - return p; - } - - parse_args() { - - let parser = this.parser; - - parser.add_predefined_argument("src_dir"); - parser.add_predefined_argument("quiet"); - parser.add_predefined_argument("platform"); - parser.add_predefined_argument("do_list_platforms", this.do_list_platforms.bind(this)); - parser.add_predefined_argument("proj_dir"); - parser.add_predefined_argument("help", this.do_show_help.bind(this)); - - this.define_args(); - let args = process.argv.slice(3); - this.parser.parse(args.concat(this.ext_args)); - - //expose enviroment variables - this.set_env("COCOS_X_ROOT", this.get_cocos_root()!); - } - - abstract define_args(): void; - - abstract init(): boolean; - - abstract async run(): Promise; - - abstract depends(): string | null; - - get_engine_path(): string | null { - return null; - } - - ///////////////// helper methods - - get_templates_dir_names(): string[] { - let template_dir = this.get_templates_root_path(); - let dirs: string[] = []; - if (template_dir) { - dirs = fs.readdirSync(template_dir).filter(x => !x.startsWith(".")); - dirs = dirs.filter(d => { - let p = path.join(template_dir!, d); - let stat = fs.statSync(p); - return stat.isDirectory(); - }); - } - return dirs; - } - - get_template_dir_paths(): string[] { - let template_dir = this.get_templates_root_path(); - return this.get_templates_dir_names().map(x => path.join(template_dir!, x)); - } - - get_platform(): string { - let p = this.parser.get_string("platform"); - if (!p) { - p = this.get_current_platform(); - console.log(`platform not specified, use current platform ${p}`); - } - return p; - } - - set_platform(p:string) { - this.parser.set_string("platform", p); - } - - get_plugin_name(): string { return this._plugin_name!; } - set_plugin_name(name: string) { this._plugin_name = name; } - - async exec() { - this.parse_args(); - if (this.parser.call_all()) return; - this.parser.validate(); - console.log(`[plugin ${this.get_plugin_name()}]: running ...`); - this.init(); - await this.run(); - console.log(` [plugin ${this.get_plugin_name()}]: done!`); - } - - - get args(): ArgumentParser { - return this.parser; - } -} - -export class cchelper { - - static replace_env_variables(str: string): string { - return str.replace(/\$\{([^\}]*)\}/g, (_, n) => process.env[n] == undefined ? _ : process.env[n]!). - replace(/(\~)/g, (_, n) => process.env["HOME"]!); - } - - - static fix_path(p: string): string { - p = this.replace_env_variables(p); - if (os.platform() == "win32") { - if(p.indexOf(" ") >= 0) { - console.error(`space found in path "${p}"`); - } - return p.replace(/\\/g, "/").replace(/\/+/, "/"); - } - return p; - } - - static async delay(ms: number): Promise { - return new Promise((resolve, reject) => { - setTimeout(async () => { - resolve(); - }, ms); - }); - } - - static join(p1:string, ...p2:string[]) :string { - - let l = p2.map(x=> this.replace_env_variables(x)); - if(path.isAbsolute(l[l.length - 1])) return l[l.length -1]; - return path.join(this.replace_env_variables(p1), ...p2); - } - - static copy_file_sync(src_root: string, src_file: string, dst_root: string, dst_file: string) { - - // console.log(`copy_file_sync args: ${JSON.stringify(arguments)}`); - src_root = this.replace_env_variables(src_root); - src_file = this.replace_env_variables(src_file); - dst_root = this.replace_env_variables(dst_root); - dst_file = this.replace_env_variables(dst_file); - let src = path.isAbsolute(src_file) ? src_file: path.join(src_root, src_file); - let dst = path.isAbsolute(dst_file)? dst_file: path.join(dst_root, dst_file); - // console.error(`copy_file_sync ${src} -> ${dst}`); - this.make_directory_recursive(path.dirname(dst)); - fs.copyFileSync(src, dst); - } - - static async copy_file_async(src: string, dst: string) { - // console.log(`[async] copy_file ${src} -> ${dst}`); - this.make_directory_recursive(path.parse(dst).dir); - await afs.copyFile(src, dst); - } - - static async copy_recursive_async(src_dir: string, dst: string) { - src_dir = this.replace_env_variables(src_dir); - dst = this.replace_env_variables(dst); - - let tasks: Promise[] = []; - let src_stat = await afs.stat(src_dir); - - if (!src_stat) { - console.error(`failed to stat ${src_dir}`); - return; - } - if (src_stat.isDirectory()) { - this.make_directory_recursive(dst); - let files = await afs.readdir(src_dir); - for (let f of files) { - if (f == "." || f == "..") continue; - let fp = path.join(src_dir, f); - let tsk = this.copy_recursive_async(fp, path.join(dst, f)); - tasks.push(tsk); - } - await Promise.all(tasks); - } else if (src_stat.isFile()) { - try { - await this.copy_file_async(src_dir, dst); - } catch (e) { - await this.delay(10); - console.error(`error: retry copying ${src_dir} -> to ${dst} ... ${e}`); - await this.copy_file_async(src_dir, dst); - } - } - } - - static prepare_dirs_for_files(src_root:string, files: string[], dst_dir:string) { - let tree: any = {}; - for(let f of files) { - let parts = f.split("/"); - let p = tree; - for(let i of parts) { - if(i in p) { - p = p[i]; - }else { - p = p[i] = {}; - } - } - } - - let mkdirs = ( src_dir:string, attrs:any, dst_dir:string) => { - let src_stat = fs.statSync(src_dir); - if(!src_stat.isDirectory()) return; - if(!fs.existsSync(dst_dir)) { - // console.log(`prepere_dir ${dst_dir}`); - fs.mkdirSync(dst_dir); - } - for(let i in attrs) { - if(i !== "." && i !== "..") { - mkdirs(path.join(src_dir, i), attrs[i], path.join(dst_dir, i)); - } - } - } - - mkdirs(src_root, tree, dst_dir); - - } - - static parallel_copy_files(par: number, src_root: string, files: string[], dst_dir: string) { - let running_tasks = 0; - dst_dir = this.replace_env_variables(dst_dir); - cchelper.prepare_dirs_for_files(src_root, files, dst_dir); - return new Promise((resolve, reject) => { - let copy_async = async (src: string, dst: string) => { - running_tasks += 1; - await this.copy_recursive_async(src, dst); - running_tasks -= 1; - schedule_copy(); - }; - let schedule_copy = () => { - if (files.length > 0 && running_tasks < par) { - let f = files.shift()!; - let src_file = path.join(src_root, f); - if(fs.existsSync(src_file)){ - copy_async(src_file, path.join(dst_dir, f)) - }else{ - console.warn(`warning: copy_file: ${src_file} not exists!`); - } - } - if (files.length == 0 && running_tasks == 0) { - resolve(); - } - } - for (let i = 0; i < par; i++) schedule_copy(); - }); - } - - static make_directory_recursive(dir: string) { - if (dir.length == 0) return; - let dirs: string[] = []; - let p = dir; - while (!fs.existsSync(p)) { - dirs.push(p); - p = path.join(p, ".."); - } - while (dirs.length > 0) { - fs.mkdirSync(dirs[dirs.length - 1]); - dirs.length = dirs.length - 1; - } - } - - static async remove_directory_recursive(dir: string) { - let stat = await afs.stat(dir); - if (stat.isFile()) { - await afs.unlink(dir); - } else if (stat.isDirectory()) { - let list = await afs.readdir(dir); - let tasks: Promise[] = []; - for (let f of list) { - if (f == "." || f == "..") continue; - let fp = path.join(dir, f); - tasks.push(this.remove_directory_recursive(fp)); - } - await Promise.all(tasks); - await afs.rmdir(dir); - } - } - - static async copy_files_with_config(cfg: { from: string, to: string, include?: string[], exclude?: string[] }, src_root: string, dst_root: string) { - - if (!fs.existsSync(src_root)) { - console.error(`copy file src_root ${src_root} is not exists!`); - return; - } - - - src_root = this.replace_env_variables(src_root); - dst_root = this.replace_env_variables(dst_root); - let from = this.replace_env_variables(cfg.from) - let to = this.replace_env_variables(cfg.to); - if (path.isAbsolute(from)) { - src_root = from; - from = "."; - } - if (path.isAbsolute(to)) { - dst_root = to; - to = "."; - } - - - // console.log(`copy ${JSON.stringify(cfg)}, ${from} -> ${to} from ${src_root} -> ${dst_root}`); - - let build_prefix_tree = (list0: string[]) => { - let tree: any = {}; - let list = list0.map(x => Array.from(x)); - while (list.length > 0) { - let t = list.shift()!; - let p = tree; - while (t.length > 0) { - let c = t.shift()!; - if (!(c in p)) { - p[c] = {}; - } - p = p[c]; - } - } - return tree; - }; - - let match_prefix_tree = (str: string, tree: any): boolean => { - if (tree == null) { - return false; - } - let arr = Array.from(str); - let i = 0; - let p = tree; - while (arr[i] in p) { - p = p[arr[i]]; - i++; - } - return i == arr.length && Object.keys(p).length == 0; - } - - let include_prefix = cfg.include ? build_prefix_tree(cfg.include) : null; - let exclude_prefix = cfg.exclude ? build_prefix_tree(cfg.exclude) : null; - - let cp_r_async = async (src_root: string, src_dir: string, dst_root: string) => { - let curr_full_dir = path.join(src_root, src_dir); - let stat = await afs.stat(curr_full_dir); - if (stat.isDirectory()) { - let files = await afs.readdir(curr_full_dir); - let subcopies: Promise[] = []; - for (let f of files) { - if (f == "." || f == "..") continue; - let path_in_src_root = path.join(src_dir, f); - if (exclude_prefix && match_prefix_tree(path_in_src_root, exclude_prefix)) { - if (include_prefix && match_prefix_tree(path_in_src_root, include_prefix)) { - //include - } else { - console.log(` - skip copy ${src_root} ${path_in_src_root} to ${dst_root}`); - continue; - } - } - subcopies.push(cp_r_async(src_root, path_in_src_root, dst_root)); - } - await Promise.all(subcopies); - } else if (stat.isFile()) { - // let dst_file_abs = path.isAbsolute(src_dir) ? src_dir : path.join(dst_root, src_dir); - await this.copy_file_async(curr_full_dir, path.join(dst_root, src_dir)); - } - } - - let copy_from = this.replace_env_variables(path.normalize(path.join(src_root, from))); - let copy_to = this.replace_env_variables(path.normalize(path.join(dst_root, to))); - await cp_r_async(src_root, from, copy_to); - } - - static async replace_in_file(patterns: { reg: string, text: string }[], filepath: string) { - filepath = this.replace_env_variables(filepath); - if (!fs.existsSync(filepath)) { - console.log(`warning: file ${filepath} not exists while replacing content!`); - return; - } - // console.log(`replace ${filepath} with ${JSON.stringify(patterns)}`); - let lines = (await afs.readFile(filepath)).toString("utf8").split("\n"); - - let new_content = lines.map(l => { - patterns.forEach(p => { - l = l.replace(new RegExp(p.reg), this.replace_env_variables(p.text)); - }); - return l; - }).join("\n"); - - await afs.writeFile(filepath, new_content); - } - - - static exact_value_from_file(regexp: RegExp, filename: string, idx: number): string | undefined { - if (!(fs.existsSync(filename))) { - console.error(`file ${filename} not exist!`); - return; - } - let lines = fs.readFileSync(filename).toString("utf-8").split("\n"); - for (let l of lines) { - let r = l.match(regexp); - if (r) { - return r[idx]; - } - } - } - - static async run_cmd(cmd: string, args: string[], slient: boolean, cwd?: string) { - return new Promise((resolve, reject) => { - console.log(`[run_cmd]: ${cmd} ${args.join(" ")}`); - let cp = child_process.spawn(cmd, args, { - shell: true, - env: process.env, - cwd: cwd! || process.cwd() - }); - if (!slient) { - cp.stdout.on(`data`, (chunk) => { - console.log(`[run_cmd ${cmd}] ${chunk}`); - }); - cp.stderr.on(`data`, (chunk) => { - console.log(`[run_cmd ${cmd} - error] ${chunk}`); - }); - } - cp.on("close", (code, signal) => { - if (code != 0 && !slient) return reject(`faile to exec ${cmd} ${args.join(" ")}`); - resolve(); - }); - }); - } - -} - - -class CCPluginRunner { - - private load_plugin(plugin_name: string): CCPlugin { - let p: CCPlugin | null = null; - let script_path = path.join(__dirname, `plugin_${plugin_name}.js`); - if (!fs.existsSync(script_path)) { - console.error(`Plugin ${plugin_name} is not defined!`); - process.exit(1); - } - - let exp = require(script_path); - let klsName = `CCPlugin${plugin_name.toUpperCase()}`; - if (klsName in exp) { - p = new exp[klsName]; - } else { - console.error(`${klsName} not defined in plugin_${plugin_name}.js`); - process.exit(1); - } - p!.set_plugin_name(plugin_name); - return p!; - } - - public async run() { - let plugin_name = process.argv[2]; - let task: CCPlugin[] = []; - let p: CCPlugin; - do { - p = this.load_plugin(plugin_name); - task.push(p); - } while ((plugin_name = p.depends()!) !== null); - - for (let i = task.length - 1; i >= 0; i--) { - await task[i].exec(); - } - } -} - -process.on("unhandledRejection", (err, promise) => { - console.error(`----unhandledRejection---`); - console.error(err); -}); - -let runner = new CCPluginRunner(); - -runner.run().then(() => { - console.log(`[all done!]`); - process.exit(0); -}); \ No newline at end of file diff --git a/native/tools/cocos-console/bin/cocos_config.json b/native/tools/cocos-console/bin/cocos_config.json deleted file mode 100644 index 25d51a5c21..0000000000 --- a/native/tools/cocos-console/bin/cocos_config.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "languages": [ - "js" - ], - "platforms": [ - "ios", - "mac", - "win32", - "android", - "ios-simulator" - ], - "support_templates":["link", "default"], - "default": { - "project_name": "MyGame" - }, - "availableTargetPlatforms": { - "mac": [ - "mac", - "ios", - "android" - ], - "win32": [ - "win32", - "android" - ] - }, - "defaultGeneratePlatforms": { - "mac":["mac", "ios-simulator"], - "win32":["win32"] - }, - "cmake": { - "win32": { - "generators": [ - { - "G": "Visual Studio 16 2019", - "A": "win32" - }, - { - "G": "Visual Studio 15 2017" - }, - { - "G": "Visual Studio 14 2015" - }, - { - "G": "Visual Studio 12 2013" - }, - { - "G": "Visual Studio 11 2012" - }, - { - "G": "Visual Studio 10 2010" - }, - { - "G": "Visual Studio 9 2008" - } - ] - } - } -} \ No newline at end of file diff --git a/native/tools/cocos-console/bin/cocos_project_config.js b/native/tools/cocos-console/bin/cocos_project_config.js deleted file mode 100644 index ff2a766b75..0000000000 --- a/native/tools/cocos-console/bin/cocos_project_config.js +++ /dev/null @@ -1,4 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CONFIG = '.cocos-project.json'; -//# sourceMappingURL=cocos_project_config.js.map \ No newline at end of file diff --git a/native/tools/cocos-console/bin/cocos_project_types.js b/native/tools/cocos-console/bin/cocos_project_types.js deleted file mode 100644 index 5174161dea..0000000000 --- a/native/tools/cocos-console/bin/cocos_project_types.js +++ /dev/null @@ -1,4 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CONFIG = '.cocos-project.json'; -//# sourceMappingURL=cocos_project_types.js.map \ No newline at end of file diff --git a/native/tools/cocos-console/bin/cocos_project_types.ts b/native/tools/cocos-console/bin/cocos_project_types.ts deleted file mode 100644 index dd4f58a22a..0000000000 --- a/native/tools/cocos-console/bin/cocos_project_types.ts +++ /dev/null @@ -1,63 +0,0 @@ - - - -export interface CocosProject{ - project_type:string; - has_native:boolean; - custom_step_script:string; - engine_version:string; - pre_build:string; - post_build:string; -} - - -export const CONFIG: string = '.cocos-project.json'; - -export interface CocosProjectTasks { - - exclude_from_template?: string[], - - append_from_template: { - from:string; - to:string; - exclude?:string[]; - }, - append_file: {from:string, to:string}[], - append_x_engine?:{ - from:string; to:string - }, - project_rename:{ - src_project_name:string; - files:[] - }, - project_replace_project_name: { - src_project_name:string, - files:string[]; - }, - project_replace_package_name: { - src_package_name:string; - files:string[] - }, - project_replace_mac_bundleid: { - src_bundle_id: string; - files:string[] - }, - project_replace_ios_bundleid: { - src_bundle_id:string, - files:string[] - }, - project_replace_cocos_x_root: { - pattern: string; - files:(string|{file:string, default?:string, link?:string, needFix?:boolean})[]; - }, - project_replace_projec_common: { - pattern: string; - files:(string|{file:string, default?:string, link?:string, needFix?:boolean})[]; - } - common_replace?: {pattern:string, value:string, files:string[]}[]; -} - -export interface CocosProjecConfig { - do_default:CocosProjectTasks, - do_add_native_support: CocosProjectTasks -} diff --git a/native/tools/cocos-console/bin/multi_language.js b/native/tools/cocos-console/bin/multi_language.js deleted file mode 100644 index e51c62cd9d..0000000000 --- a/native/tools/cocos-console/bin/multi_language.js +++ /dev/null @@ -1,120 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -const path = require("path"); -const fs = require("fs"); -const cfg_info = require("./strings.json"); -// const CONFIG_FILE_NAME = "strings.json"; -const DEFAULT_LANGUAGE = "en"; -let locale = null; -let cur_lang_string = null; -let default_lang_string = null; -function get_env_locale() { - const default_ret = { lang: "en" }; - let env = process.env; - let lang_encoding = env.LC_ALL || env.LC_MESSAGES || env.LANG || env.LANGUAGE || Intl.DateTimeFormat().resolvedOptions().locale; - if (!lang_encoding) { - return default_ret; - } - let p2 = lang_encoding.split("."); - return { lang: p2[0] || default_ret.lang }; -} -function get_avaiable_langs() { - if (!!cfg_info) { - return Object.keys(cfg_info); - } - return []; -} -function get_lang_key(lang) { - let p2 = lang.split("_"); - if (p2[0] == "zh") - return (p2.length == 1 || p2[1] == "cn") ? "zh" : "zh_tr"; - return p2[0]; -} -function do_init() { - locale = get_env_locale(); - cur_lang_string = cfg_info[get_lang_key(locale.lang)]; - if (!cur_lang_string) { - cur_lang_string = cfg_info[DEFAULT_LANGUAGE]; - } - default_lang_string = cfg_info[DEFAULT_LANGUAGE]; -} -do_init(); -function set_current_language(lang) { - let lang_key = get_lang_key(lang); - if (lang in cfg_info) { - cur_lang_string = cfg_info[lang]; - locale.lang = lang; - } - else if (lang_key in cfg_info) { - cur_lang_string = cfg_info[lang_key]; - locale.lang = lang_key; - } - else { - console.warn(); - } -} -exports.set_current_language = set_current_language; -function get_string(key, ...fmts) { - if (cur_lang_string) { - let fmt = cur_lang_string[key]; - if (!fmt) { - return `[KEY "${key}" is not found! lang: ${locale.lang}]`; - } - if (fmts.length == 0) { - return fmt; - } - let chars = Array.from(fmt); - let ret = []; - let len = chars.length; - let p = 0; - let ai = 0; - let place_holders = 0; - while (p < len) { - if (chars[p] == "%") { - if (chars[p + 1] == "d" || chars[p + 1] == "f") { - ret.push(fmts[ai++] + ""); // %d | %f - place_holders++; - } - else if (chars[p + 1] == "s") { - ret.push(fmts[ai++] + ""); // %s - place_holders++; - } - else if (chars[p + 1] == "%") { - ret.push("%"); // %% - } - else { - // unknown formatter? - ret.push(fmts[ai++] + ""); // %? - place_holders++; - } - p += 2; - } - else { - ret.push(chars[p]); - p += 1; - } - } - if (place_holders != fmts.length) { - console.error(`format argument mismatch: ${fmt} & ${fmts.join(", ")}`); - } - return ret.join(""); - } - return `[language ${locale.lang} not set, key ${key}]`; -} -exports.get_string = get_string; -function has_key(key, data) { - return !!data && (key in data); -} -exports.has_key = has_key; -function get_current_string(key) { - let ret; - if (has_key(key, cur_lang_string)) { - ret = cur_lang_string[key]; - } - else if (has_key(key, default_lang_string)) { - ret = default_lang_string[key]; - } - return ret || key; -} -exports.get_current_string = get_current_string; -//# sourceMappingURL=multi_language.js.map \ No newline at end of file diff --git a/native/tools/cocos-console/bin/multi_language.ts b/native/tools/cocos-console/bin/multi_language.ts deleted file mode 100644 index d3b0a7f6bc..0000000000 --- a/native/tools/cocos-console/bin/multi_language.ts +++ /dev/null @@ -1,127 +0,0 @@ - - -const path = require("path"); -const fs = require("fs"); -const cfg_info = require("./strings.json"); - - -// const CONFIG_FILE_NAME = "strings.json"; -const DEFAULT_LANGUAGE = "en"; - -interface LocaleInfo { - lang:string; - encoding?:string; -} - -let locale: LocaleInfo | null = null; -let cur_lang_string : {[key:string]:string}|null = null; -let default_lang_string : {[key:string]:string}|null = null; - -function get_env_locale() : LocaleInfo { - const default_ret = {lang: "en"}; - let env = process.env; - let lang_encoding = env.LC_ALL || env.LC_MESSAGES || env.LANG || env.LANGUAGE || Intl.DateTimeFormat().resolvedOptions().locale; - if(!lang_encoding) { - return default_ret; - } - let p2 = lang_encoding.split("."); - return {lang: p2[0] || default_ret.lang}; -} - -function get_avaiable_langs() : string[] { - if(!!cfg_info) { - return Object.keys(cfg_info); - } - return []; -} - -function get_lang_key(lang: string) : string { - let p2 = lang.split("_"); - if(p2[0] == "zh") - return (p2.length == 1 || p2[1] == "cn") ? "zh" : "zh_tr"; - return p2[0]; -} - -function do_init() { - locale = get_env_locale(); - cur_lang_string = cfg_info[get_lang_key(locale.lang)]; - if(!cur_lang_string) { - cur_lang_string = cfg_info[DEFAULT_LANGUAGE]; - } - default_lang_string = cfg_info[DEFAULT_LANGUAGE]; -} - -do_init(); - -export function set_current_language(lang:string) { - let lang_key = get_lang_key(lang); - if(lang in cfg_info) { - cur_lang_string = cfg_info[lang]; - locale!.lang = lang; - } else if(lang_key in cfg_info) { - cur_lang_string = cfg_info[lang_key]; - locale!.lang = lang_key; - } else { - console.warn() - } -} - - -export function get_string(key:string, ...fmts: (string|number)[]) { - if(cur_lang_string) { - let fmt = cur_lang_string[key]; - if(!fmt){ - return `[KEY "${key}" is not found! lang: ${locale!.lang}]` - } - if(fmts.length == 0) { - return fmt; - } - - let chars = Array.from(fmt); - let ret : string []= []; - let len = chars.length; - let p = 0; - let ai = 0; - let place_holders = 0; - while(p < len) { - if(chars[p] == "%") { - if(chars[p + 1] == "d" || chars[p+1] == "f") { - ret.push(fmts[ai++] + ""); // %d | %f - place_holders ++; - } else if(chars[p + 1] == "s") { - ret.push(fmts[ai++] + ""); // %s - place_holders ++; - } else if(chars[p + 1] == "%") { - ret.push("%"); // %% - } else { - // unknown formatter? - ret.push(fmts[ai++] + ""); // %? - place_holders++; - } - p +=2; - }else { - ret.push(chars[p]); - p += 1; - } - } - if(place_holders != fmts.length) { - console.error(`format argument mismatch: ${fmt} & ${fmts.join(", ")}`) - } - return ret.join(""); - } - return `[language ${locale!.lang} not set, key ${key}]` -} - -export function has_key(key:string, data: {[key:string]:string}|null):boolean { - return !!data && (key in data); -} - -export function get_current_string(key:string):string { - let ret:string|undefined; - if(has_key(key, cur_lang_string)) { - ret = cur_lang_string![key]; - } else if(has_key(key, default_lang_string)) { - ret = default_lang_string![key]; - } - return ret || key; -} \ No newline at end of file diff --git a/native/tools/cocos-console/bin/plugin_compile.js b/native/tools/cocos-console/bin/plugin_compile.js deleted file mode 100644 index 84c6c38af9..0000000000 --- a/native/tools/cocos-console/bin/plugin_compile.js +++ /dev/null @@ -1,140 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const cocos_cli_1 = require("./cocos_cli"); -const path = require("path"); -const cocos_cfg = require("./cocos_config.json"); -const fs = require("fs"); -const PackageNewConfig = "cocos-project-template.json"; -class CCPluginCOMPILE extends cocos_cli_1.CCPlugin { - depends() { - return "generate"; - } - define_args() { - this.parser.add_predefined_argument("build_dir"); - this.parser.add_predefined_argument("cmake_path"); - this.parser.add_predefined_argument("ios_simulator"); - this.parser.add_predefined_argument("directory"); - } - init() { - if (cocos_cfg.platforms.indexOf(this.get_platform()) < 0) { - console.error(`invalidate platform "${this.get_platform()}"`); - } - return true; - } - run() { - return __awaiter(this, void 0, void 0, function* () { - yield this.compile_platform(this.get_platform()); - return true; - }); - } - compile_platform(p) { - return __awaiter(this, void 0, void 0, function* () { - let c = this.get_current_platform(); - let allow_targets = cocos_cfg.availableTargetPlatforms[c]; - if (!!!allow_targets) { - console.error(`current host platform ${c} is not supported.`); - process.exit(1); - return; - } - if (allow_targets.indexOf(p) < 0) { - console.error(`target platform "${p}" is not listed [${allow_targets.join(", ")}]`); - process.exit(1); - return; - } - if (p === "mac") { - yield this.compile_mac(); - } - else if (p == "ios") { - yield this.compile_ios(); - } - else if (p == "win32") { - yield this.compile_win32(); - } - else if (p == "android") { - yield this.compile_android(); - } - }); - } - compile_android() { - return __awaiter(this, void 0, void 0, function* () { - yield (new AndroidCompileCMD(this)).compile(); - }); - } - compile_ios() { - return __awaiter(this, void 0, void 0, function* () { - yield (new IOSCompileCMD(this)).compile(); - }); - } - compile_mac() { - return __awaiter(this, void 0, void 0, function* () { - yield (new MacCompileCMD(this)).compile(); - }); - } - compile_win32() { - return __awaiter(this, void 0, void 0, function* () { - yield (new Win32CompileCMD(this)).compile(); - }); - } -} -exports.CCPluginCOMPILE = CCPluginCOMPILE; -class PlatformCompileCmd { - constructor(plugin) { - this.plugin = plugin; - } -} -class IOSCompileCMD extends PlatformCompileCmd { - compile() { - return __awaiter(this, void 0, void 0, function* () { - let build_dir = this.plugin.get_build_dir(); - yield this.plugin.run_cmake(["--build", `${build_dir}`, "--config", "Debug", "--", "-allowProvisioningUpdates", "-quiet"]); - return true; - }); - } -} -class MacCompileCMD extends PlatformCompileCmd { - compile() { - return __awaiter(this, void 0, void 0, function* () { - let build_dir = this.plugin.get_build_dir(); - yield this.plugin.run_cmake(["--build", `${build_dir}`, "--config", "Debug", "--", "-quiet"]); - return true; - }); - } -} -class Win32CompileCMD extends PlatformCompileCmd { - compile() { - return __awaiter(this, void 0, void 0, function* () { - let build_dir = this.plugin.get_build_dir(); - yield this.plugin.run_cmake(["--build", `${cocos_cli_1.cchelper.fix_path(build_dir)}`, "--config", "Debug", "--", "-verbosity:quiet"]); - return true; - }); - } -} -class AndroidCompileCMD extends PlatformCompileCmd { - compile() { - return __awaiter(this, void 0, void 0, function* () { - let build_dir = this.plugin.get_build_dir(); - let proj_dir = path.join(this.plugin.project_dir, "frameworks/runtime-src/proj.android-studio"); - if (!fs.existsSync(proj_dir)) { - console.error(`dir ${proj_dir} not exits`); - return false; - } - let gradle = "gradlew"; - if (this.plugin.get_current_platform() == "win32") { - gradle += ".bat"; - } - gradle = path.join(proj_dir, gradle); - yield cocos_cli_1.cchelper.run_cmd(gradle, ["assembleDebug", "--quiet", "--build-cache", "--project-cache-dir", build_dir], false, proj_dir); - return true; - }); - } -} -//# sourceMappingURL=plugin_compile.js.map \ No newline at end of file diff --git a/native/tools/cocos-console/bin/plugin_compile.ts b/native/tools/cocos-console/bin/plugin_compile.ts deleted file mode 100644 index 5516855ed4..0000000000 --- a/native/tools/cocos-console/bin/plugin_compile.ts +++ /dev/null @@ -1,133 +0,0 @@ - -import { CCPlugin, pa, cchelper } from "./cocos_cli"; - -import * as path from "path"; -import * as os from "os"; -import * as cocos_cfg from "./cocos_config.json"; -import * as child_process from "child_process"; -import { afs } from "./afs"; -import * as fs from "fs"; -const PackageNewConfig = "cocos-project-template.json"; - -export class CCPluginCOMPILE extends CCPlugin { - - - depends():string |null { - return "generate"; - } - - define_args(): void { - this.parser.add_predefined_argument("build_dir"); - this.parser.add_predefined_argument("cmake_path"); - this.parser.add_predefined_argument("ios_simulator"); - this.parser.add_predefined_argument("directory"); - } - init(): boolean { - if (cocos_cfg.platforms.indexOf(this.get_platform()) < 0) { - console.error(`invalidate platform "${this.get_platform()}"`); - } - return true; - } - - async run(): Promise { - await this.compile_platform(this.get_platform()!); - return true; - } - - - async compile_platform(p: string) { - let c = this.get_current_platform(); - - let allow_targets = (cocos_cfg.availableTargetPlatforms as any)[c]; - if (!!!allow_targets) { - console.error(`current host platform ${c} is not supported.`); - process.exit(1); - return; - } - - if (allow_targets.indexOf(p) < 0) { - console.error(`target platform "${p}" is not listed [${allow_targets.join(", ")}]`); - process.exit(1); - return; - } - - if (p === "mac") { - await this.compile_mac(); - } else if (p == "ios") { - await this.compile_ios(); - } else if (p == "win32") { - await this.compile_win32(); - } else if (p == "android") { - await this.compile_android(); - } - } - - - async compile_android() { - await (new AndroidCompileCMD(this)).compile(); - } - - async compile_ios() { - await (new IOSCompileCMD(this)).compile(); - } - - async compile_mac() { - await (new MacCompileCMD(this)).compile(); - } - - async compile_win32() { - await (new Win32CompileCMD(this)).compile(); - } - -} - -abstract class PlatformCompileCmd { - plugin: CCPluginCOMPILE; - constructor(plugin: CCPluginCOMPILE) { - this.plugin = plugin; - } - abstract async compile(): Promise; -} - -class IOSCompileCMD extends PlatformCompileCmd { - async compile() { - let build_dir = this.plugin.get_build_dir(); - await this.plugin.run_cmake(["--build", `${build_dir}`, "--config", "Debug", "--", "-allowProvisioningUpdates", "-quiet"]); - return true; - } -} - -class MacCompileCMD extends PlatformCompileCmd { - async compile() { - let build_dir = this.plugin.get_build_dir(); - await this.plugin.run_cmake(["--build", `${build_dir}`, "--config", "Debug", "--", "-quiet"]); - return true; - } -} - - -class Win32CompileCMD extends PlatformCompileCmd { - async compile() { - let build_dir = this.plugin.get_build_dir(); - await this.plugin.run_cmake(["--build", `${cchelper.fix_path(build_dir)}`, "--config", "Debug", "--", "-verbosity:quiet"]); - return true; - } -} - -class AndroidCompileCMD extends PlatformCompileCmd { - async compile() { - let build_dir = this.plugin.get_build_dir(); - let proj_dir:string = path.join(this.plugin.project_dir!, "frameworks/runtime-src/proj.android-studio"); - if(!fs.existsSync(proj_dir)) { - console.error(`dir ${proj_dir} not exits`); - return false; - } - let gradle = "gradlew"; - if(this.plugin.get_current_platform() == "win32") { - gradle += ".bat"; - } - gradle = path.join(proj_dir, gradle); - await cchelper.run_cmd(gradle, ["assembleDebug", "--quiet", "--build-cache", "--project-cache-dir",build_dir], false, proj_dir); - return true; - } -} \ No newline at end of file diff --git a/native/tools/cocos-console/bin/plugin_generate.js b/native/tools/cocos-console/bin/plugin_generate.js deleted file mode 100644 index cc4e8f3bcd..0000000000 --- a/native/tools/cocos-console/bin/plugin_generate.js +++ /dev/null @@ -1,276 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const cocos_cli_1 = require("./cocos_cli"); -const os = require("os"); -const cocos_cfg = require("./cocos_config.json"); -const child_process = require("child_process"); -const afs_1 = require("./afs"); -const PackageNewConfig = "cocos-project-template.json"; -class CCPluginGENERATE extends cocos_cli_1.CCPlugin { - depends() { - // return "new"; // recreate project file will override everything - return null; - } - define_args() { - this.parser.add_required_predefined_argument("build_dir"); - this.parser.add_required_predefined_argument("directory"); - this.parser.add_predefined_argument("cmake_generator"); - this.parser.add_predefined_argument("cmake_path"); - this.parser.add_predefined_argument("ios_simulator"); - this.parser.add_predefined_argument("teamid"); - this.parser.add_predefined_argument_with_default("template_name", "link"); - } - init() { - if (cocos_cfg.platforms.indexOf(this.get_platform()) < 0) { - console.error(`invalidate platform "${this.get_platform()}"`); - } - return true; - } - run() { - return __awaiter(this, void 0, void 0, function* () { - let arg_p = this.parser.get_string("platform"); - if (!arg_p) { - let ps = cocos_cfg["defaultGeneratePlatforms"][this.get_current_platform()]; - for (let p of ps) { - yield this.generate_platform(p); - } - } - else { - yield this.generate_platform(arg_p); - } - return true; - }); - } - generate_platform(p) { - return __awaiter(this, void 0, void 0, function* () { - let c = this.get_current_platform(); - if (p == "ios-simulator") { - p = "ios"; - this.set_platform("ios"); - this.extend_argv(["--ios-simulator"]); - this.args.set_bool("ios_simulator", true); - } - let allow_targets = cocos_cfg.availableTargetPlatforms[c]; - if (!!!allow_targets) { - console.error(`current host platform ${c} is not supported.`); - process.exit(1); - return; - } - if (allow_targets.indexOf(p) < 0) { - console.error(`target platform "${p}" is not listed [${allow_targets.join(", ")}]`); - process.exit(1); - return; - } - if (p === "mac") { - yield this.generate_mac(); - } - else if (p == "ios") { - yield this.generate_ios(); - } - else if (p == "win32") { - yield this.generate_win32(); - } - else if (p == "android") { - yield this.generate_android(); - } - }); - } - generate_android() { - return __awaiter(this, void 0, void 0, function* () { - }); - } - generate_ios() { - return __awaiter(this, void 0, void 0, function* () { - yield (new IOSGenerateCMD(this)).generate(); - }); - } - generate_mac() { - return __awaiter(this, void 0, void 0, function* () { - yield (new MacGenerateCMD(this)).generate(); - }); - } - generate_win32() { - return __awaiter(this, void 0, void 0, function* () { - yield (new Win32GenerateCMD(this)).generate(); - }); - } -} -exports.CCPluginGENERATE = CCPluginGENERATE; -class PlatformGenerateCmd { - constructor(plugin) { - this.plugin = plugin; - } - get project_src_dir() { - return cocos_cli_1.cchelper.join(this.plugin.project_dir, "..", `common-${this.plugin.args.get_string("template_name")}`); - } - append_cmake_res_dir_args(args) { - args.push(`-DRES_DIR="${cocos_cli_1.cchelper.fix_path(this.plugin.project_dir)}"`); - } -} -class IOSGenerateCMD extends PlatformGenerateCmd { - generate() { - return __awaiter(this, void 0, void 0, function* () { - let build_dir = this.plugin.get_build_dir(); - if (!(yield afs_1.afs.exists(cocos_cli_1.cchelper.join(this.project_src_dir, "CMakelists.txt")))) { - throw new Error(`CMakeLists.txt not found in ${this.project_src_dir}`); - } - if (!(yield afs_1.afs.exists(build_dir))) { - cocos_cli_1.cchelper.make_directory_recursive(build_dir); - } - let osx_sysroot = "iphoneos"; - let ext = []; - if (this.plugin.enable_ios_simulator()) { - osx_sysroot = "iphonesimulator"; - ext.push("-DCMAKE_OSX_ARCHITECTURES=x86_64"); - } - else { - ext.push("-DCMAKE_OSX_ARCHITECTURES=arm64"); - } - let teamid = this.plugin.get_app_team_id(); - if (teamid) { - ext.push(`-DDEVELOPMENT_TEAM=${teamid}`); - } - this.append_cmake_res_dir_args(ext); - const do_build = false; - if (do_build) { - if (!this.plugin.enable_ios_simulator() && !teamid) { - console.error(`can not build ios without teamid`); - process.exit(1); - } - } - yield this.plugin.run_cmake(["-S", `${this.project_src_dir}`, "-GXcode", `-B${build_dir}`, "-DCMAKE_SYSTEM_NAME=iOS", `-DCMAKE_OSX_SYSROOT=${osx_sysroot}`].concat(ext)); - if (do_build) { - yield this.plugin.run_cmake(["--build", `${build_dir}`, "--config", "Debug", "--", "-allowProvisioningUpdates"]); - } - return true; - }); - } -} -class MacGenerateCMD extends PlatformGenerateCmd { - generate() { - return __awaiter(this, void 0, void 0, function* () { - let build_dir = this.plugin.get_build_dir(); - if (!(yield afs_1.afs.exists(cocos_cli_1.cchelper.join(this.project_src_dir, "CMakelists.txt")))) { - throw new Error(`CMakeLists.txt not found in ${this.project_src_dir}`); - } - if (!(yield afs_1.afs.exists(build_dir))) { - cocos_cli_1.cchelper.make_directory_recursive(build_dir); - } - let cmake_args = ["-S", `${this.project_src_dir}`, "-GXcode", `-B${build_dir}`, "-DCMAKE_SYSTEM_NAME=Darwin"]; - this.append_cmake_res_dir_args(cmake_args); - yield this.plugin.run_cmake(cmake_args); - return true; - }); - } -} -class Win32GenerateCMD extends PlatformGenerateCmd { - win32_select_cmake_generator_args() { - return __awaiter(this, void 0, void 0, function* () { - console.log(`selecting visual studio generator ...`); - const visualstudio_generators = cocos_cfg.cmake.win32.generators; - let test_proj_dir = yield afs_1.afs.mkdtemp(cocos_cli_1.cchelper.join(os.tmpdir(), "cmake_test_")); - let test_cmake_lists_path = cocos_cli_1.cchelper.join(test_proj_dir, "CMakeLists.txt"); - let test_cpp_file = cocos_cli_1.cchelper.join(test_proj_dir, "test.cpp"); - { - let cmake_content = ` - cmake_minimum_required(VERSION 3.8) - set(APP_NAME test-cmake) - project(\${APP_NAME} CXX) - add_library(\${APP_NAME} test.cpp) - `; - let cpp_src = ` - #include - int main(int argc, char **argv) - { - std::cout << "Hello World" << std::endl; - return 0; - } - `; - yield afs_1.afs.writeFile(test_cmake_lists_path, cmake_content); - yield afs_1.afs.writeFile(test_cpp_file, cpp_src); - } - let try_run_cmake_with_arguments = (args, workdir) => { - return new Promise((resolve, reject) => { - let cp = child_process.spawn(this.plugin.get_cmake_path(), args, { - cwd: workdir, - env: process.env, - shell: true - }); - cp.on("close", (code, sig) => { - if (code != 0) { - resolve(false); - return; - } - resolve(true); - }); - }); - }; - let available_generators = []; - for (let cfg of visualstudio_generators) { - let build_dir = cocos_cli_1.cchelper.join(test_proj_dir, `build_${cfg.G.replace(/ /g, "_")}`); - let args = [`-S"${test_proj_dir}"`, `-G"${cfg.G}"`, `-B"${build_dir}"`]; - if ("A" in cfg) { - args.push("-A", cfg.A); - } - yield afs_1.afs.mkdir(build_dir); - if (yield try_run_cmake_with_arguments(args, build_dir)) { - available_generators.push(cfg.G); - break; - } - yield cocos_cli_1.cchelper.remove_directory_recursive(build_dir); - } - yield cocos_cli_1.cchelper.remove_directory_recursive(test_proj_dir); - let ret = []; - if (available_generators.length == 0) { - return []; // use cmake default option -G - } - let opt = visualstudio_generators.filter(x => x.G == available_generators[0])[0]; - for (let k in opt) { - ret.push(`-${k}"${opt[k]}"`); - } - console.log(` using ${opt.G}`); - return ret; - }); - } - generate() { - return __awaiter(this, void 0, void 0, function* () { - let build_dir = this.plugin.get_build_dir(); - if (!(yield afs_1.afs.exists(cocos_cli_1.cchelper.join(this.project_src_dir, "CMakelists.txt")))) { - throw new Error(`CMakeLists.txt not found in ${this.project_src_dir}`); - } - if (!(yield afs_1.afs.exists(build_dir))) { - cocos_cli_1.cchelper.make_directory_recursive(build_dir); - } - let g = this.plugin.get_cmake_generator(); - let generate_args = []; - if (g) { - let optlist = cocos_cfg.cmake.win32.generators.filter(x => x.G.toLowerCase() == g.toLowerCase()); - if (optlist.length == 0) { - generate_args.push(`-G"${g}"`); - } - else { - let opt = optlist[0]; - for (let t of opt) { - generate_args.push(`-${t}"${opt[t]}"`); - } - } - } - else { - generate_args = generate_args.concat(yield this.win32_select_cmake_generator_args()); - } - this.append_cmake_res_dir_args(generate_args); - yield this.plugin.run_cmake([`-S"${cocos_cli_1.cchelper.fix_path(this.project_src_dir)}"`, `-B"${cocos_cli_1.cchelper.fix_path(build_dir)}"`].concat(generate_args)); - return true; - }); - } -} -//# sourceMappingURL=plugin_generate.js.map \ No newline at end of file diff --git a/native/tools/cocos-console/bin/plugin_generate.ts b/native/tools/cocos-console/bin/plugin_generate.ts deleted file mode 100644 index e0d68a478f..0000000000 --- a/native/tools/cocos-console/bin/plugin_generate.ts +++ /dev/null @@ -1,288 +0,0 @@ - -import { CCPlugin, pa, cchelper } from "./cocos_cli"; - -import * as path from "path"; -import * as os from "os"; -import * as cocos_cfg from "./cocos_config.json"; -import * as child_process from "child_process"; -import { afs } from "./afs"; -const PackageNewConfig = "cocos-project-template.json"; - -export class CCPluginGENERATE extends CCPlugin { - - depends():string |null { - // return "new"; // recreate project file will override everything - return null; - } - - define_args(): void { - this.parser.add_required_predefined_argument("build_dir"); - this.parser.add_required_predefined_argument("directory"); - this.parser.add_predefined_argument("cmake_generator"); - this.parser.add_predefined_argument("cmake_path"); - this.parser.add_predefined_argument("ios_simulator"); - this.parser.add_predefined_argument("teamid"); - this.parser.add_predefined_argument_with_default("template_name", "link"); - } - init(): boolean { - if (cocos_cfg.platforms.indexOf(this.get_platform()) < 0) { - console.error(`invalidate platform "${this.get_platform()}"`); - } - return true; - } - - async run(): Promise { - - let arg_p = this.parser.get_string("platform"); - if(!arg_p) { - let ps = (cocos_cfg as any)["defaultGeneratePlatforms"][this.get_current_platform()]; - for(let p of ps){ - await this.generate_platform(p); - } - }else{ - await this.generate_platform(arg_p); - } - return true; - } - - - async generate_platform(p: string) { - let c = this.get_current_platform(); - - if(p == "ios-simulator") { - p = "ios"; - this.set_platform("ios"); - this.extend_argv(["--ios-simulator"]); - this.args.set_bool("ios_simulator", true); - } - - let allow_targets = (cocos_cfg.availableTargetPlatforms as any)[c]; - if (!!!allow_targets) { - console.error(`current host platform ${c} is not supported.`); - process.exit(1); - return; - } - - if (allow_targets.indexOf(p) < 0) { - console.error(`target platform "${p}" is not listed [${allow_targets.join(", ")}]`); - process.exit(1); - return; - } - - if (p === "mac") { - await this.generate_mac(); - } else if (p == "ios") { - await this.generate_ios(); - } else if (p == "win32") { - await this.generate_win32(); - } else if (p == "android") { - await this.generate_android(); - } - } - - async generate_android() { - - } - - async generate_ios() { - await (new IOSGenerateCMD(this)).generate(); - } - - async generate_mac() { - await (new MacGenerateCMD(this)).generate(); - } - - async generate_win32() { - await (new Win32GenerateCMD(this)).generate(); - } - -} - -abstract class PlatformGenerateCmd { - plugin: CCPluginGENERATE; - constructor(plugin: CCPluginGENERATE) { - this.plugin = plugin; - } - - abstract async generate(): Promise; - - get project_src_dir():string { - return cchelper.join(this.plugin.project_dir!, "..", `common-${this.plugin.args.get_string("template_name")}`); - } - - append_cmake_res_dir_args(args:string[]) { - args.push(`-DRES_DIR="${cchelper.fix_path(this.plugin.project_dir!)}"`); - } -} - -class IOSGenerateCMD extends PlatformGenerateCmd { - async generate() { - let build_dir = this.plugin.get_build_dir(); - - if (!(await afs.exists(cchelper.join(this.project_src_dir, "CMakelists.txt")))) { - throw new Error(`CMakeLists.txt not found in ${this.project_src_dir}`); - } - - if (!(await afs.exists(build_dir))) { - cchelper.make_directory_recursive(build_dir); - } - - let osx_sysroot = "iphoneos"; - let ext:string[] = []; - if(this.plugin.enable_ios_simulator()){ - osx_sysroot = "iphonesimulator"; - ext.push("-DCMAKE_OSX_ARCHITECTURES=x86_64") - }else{ - ext.push("-DCMAKE_OSX_ARCHITECTURES=arm64") - } - - let teamid = this.plugin.get_app_team_id(); - if(teamid) { - ext.push(`-DDEVELOPMENT_TEAM=${teamid}`); - } - - this.append_cmake_res_dir_args(ext); - - const do_build = false; - if(do_build) { - if(!this.plugin.enable_ios_simulator() && !teamid) { - console.error(`can not build ios without teamid`); - process.exit(1); - } - } - - await this.plugin.run_cmake(["-S", `${this.project_src_dir}`, "-GXcode", `-B${build_dir}`, "-DCMAKE_SYSTEM_NAME=iOS", `-DCMAKE_OSX_SYSROOT=${osx_sysroot}`].concat(ext)); - if(do_build) { - await this.plugin.run_cmake(["--build", `${build_dir}`, "--config", "Debug", "--", "-allowProvisioningUpdates"]); - } - return true; - } -} - -class MacGenerateCMD extends PlatformGenerateCmd { - async generate() { - let build_dir = this.plugin.get_build_dir(); - - if (!(await afs.exists(cchelper.join(this.project_src_dir, "CMakelists.txt")))) { - throw new Error(`CMakeLists.txt not found in ${this.project_src_dir}`); - } - - if (!(await afs.exists(build_dir))) { - cchelper.make_directory_recursive(build_dir); - } - - let cmake_args = ["-S", `${this.project_src_dir}`, "-GXcode", `-B${build_dir}`, "-DCMAKE_SYSTEM_NAME=Darwin"]; - this.append_cmake_res_dir_args(cmake_args); - - await this.plugin.run_cmake(cmake_args); - return true; - } -} - - -class Win32GenerateCMD extends PlatformGenerateCmd { - - async win32_select_cmake_generator_args(): Promise { - - console.log(`selecting visual studio generator ...`); - const visualstudio_generators = cocos_cfg.cmake.win32.generators; - - let test_proj_dir = await afs.mkdtemp(cchelper.join(os.tmpdir(), "cmake_test_")); - let test_cmake_lists_path = cchelper.join(test_proj_dir, "CMakeLists.txt"); - let test_cpp_file = cchelper.join(test_proj_dir, "test.cpp"); - { - let cmake_content = ` - cmake_minimum_required(VERSION 3.8) - set(APP_NAME test-cmake) - project(\${APP_NAME} CXX) - add_library(\${APP_NAME} test.cpp) - `; - let cpp_src = ` - #include - int main(int argc, char **argv) - { - std::cout << "Hello World" << std::endl; - return 0; - } - ` - await afs.writeFile(test_cmake_lists_path, cmake_content); - await afs.writeFile(test_cpp_file, cpp_src); - } - - let try_run_cmake_with_arguments = (args: string[], workdir: string) => { - return new Promise((resolve, reject) => { - let cp = child_process.spawn(this.plugin.get_cmake_path(), args, { - cwd: workdir, - env: process.env, - shell: true - }); - cp.on("close", (code, sig) => { - if (code != 0) { - resolve(false); - return; - } - resolve(true); - }); - }); - } - let available_generators: string[] = []; - for (let cfg of visualstudio_generators) { - let build_dir = cchelper.join(test_proj_dir, `build_${cfg.G.replace(/ /g, "_")}`); - let args: string[] = [`-S"${test_proj_dir}"`, `-G"${cfg.G}"`, `-B"${build_dir}"`]; - if ("A" in cfg) { - args.push("-A", cfg.A!) - } - await afs.mkdir(build_dir); - if (await try_run_cmake_with_arguments(args, build_dir)) { - available_generators.push(cfg.G); - break; - } - await cchelper.remove_directory_recursive(build_dir); - } - await cchelper.remove_directory_recursive(test_proj_dir); - - let ret: string[] = []; - if (available_generators.length == 0) { - return []; // use cmake default option -G - } - let opt = visualstudio_generators.filter(x => x.G == available_generators[0])[0]; - for (let k in opt) { - ret.push(`-${k}"${(opt as any)[k]}"`); - } - console.log(` using ${opt.G}`) - return ret; - } - - - - async generate() { - let build_dir = this.plugin.get_build_dir(); - - if (!(await afs.exists(cchelper.join(this.project_src_dir, "CMakelists.txt")))) { - throw new Error(`CMakeLists.txt not found in ${this.project_src_dir}`); - } - - if (!(await afs.exists(build_dir))) { - cchelper.make_directory_recursive(build_dir); - } - - let g = this.plugin.get_cmake_generator(); - let generate_args: string[] = []; - if (g) { - let optlist = cocos_cfg.cmake.win32.generators.filter(x => x.G.toLowerCase() == g!.toLowerCase()); - if (optlist.length == 0) { - generate_args.push(`-G"${g}"`); - } else { - let opt = optlist[0] as any; - for (let t of opt) { - generate_args.push(`-${t}"${opt[t]}"`); - } - } - } else { - generate_args = generate_args.concat(await this.win32_select_cmake_generator_args()); - } - this.append_cmake_res_dir_args(generate_args); - await this.plugin.run_cmake([`-S"${cchelper.fix_path(this.project_src_dir)}"`, `-B"${cchelper.fix_path(build_dir)}"`].concat(generate_args)); - return true; - } -} \ No newline at end of file diff --git a/native/tools/cocos-console/bin/plugin_new.js b/native/tools/cocos-console/bin/plugin_new.js deleted file mode 100644 index ed8bfa53eb..0000000000 --- a/native/tools/cocos-console/bin/plugin_new.js +++ /dev/null @@ -1,556 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const cocos_cli_1 = require("./cocos_cli"); -const path = require("path"); -const fs = require("fs"); -const cocos_project = require("./cocos_project_types"); -const cocos2dx_files = require("../../../templates/cocos2dx_files.json"); -const cocos_cfg = require("./cocos_config.json"); -const afs_1 = require("./afs"); -const PackageNewConfig = "cocos-project-template.json"; -let project_CONFIG = { - project_type: "js", - has_native: true, - engine_version: "", - custom_step_script: null /* script path*/ -}; -class CCPluginNEW extends cocos_cli_1.CCPlugin { - depends() { - return null; - } - define_args() { - let parser = this.parser; - parser.add_predefined_argument_with_default("package_name", "CocosGame"); - parser.add_required_predefined_argument("directory"); - parser.add_predefined_argument_with_default("ios_bundleid", "org.cocos2dx.ios"); - parser.add_predefined_argument_with_default("mac_bundleid", "org.cocos2dx.mac"); - parser.add_predefined_argument("engine_path"); - parser.add_predefined_argument("portrait"); - parser.add_predefined_argument("no_native"); - parser.add_predefined_argument("build_dir"); - parser.add_predefined_argument_with_default("language", "js"); - parser.add_predefined_argument("do_list_templates", this.do_list_templates.bind(this)); - parser.add_predefined_argument_with_default("template_name", "link"); - parser.add_predefined_argument("shared_dir"); - } - init() { - this.set_env("PROJECT_NAME", this.project_name); - this.set_env("COMMON_DIR", cocos_cli_1.cchelper.join(this.shared_dir, this.common_dir)); - let parser = this.parser; - // console.log(`PROJECT_NAME name ${this.project_name}`); - let cocos_dir = this.get_cocos_root(); - if (!fs.existsSync(cocos_cli_1.cchelper.join(cocos_dir, "cocos/cocos2d.h"))) { - console.error(`cocos2d.h not found in ${cocos_dir}, path incorrect!`); - return false; - } - if (this.project_dir && !fs.existsSync(this.project_dir)) { - cocos_cli_1.cchelper.make_directory_recursive(this.project_dir); - } - return true; - } - get common_dir() { - return `common-${this.args.get_string("template_name")}`; - } - run() { - return __awaiter(this, void 0, void 0, function* () { - let tp = new TemplateCreator(this); - yield tp.run(); // async - return true; - }); - } - /* override */ - get_engine_path() { - return this.args.get_path("engine_path"); - } - do_list_templates() { - console.log(`templates:`); - let dirs = this.get_templates_dir_names(); - for (let d of dirs) { - console.log(` - ${d}/`); - } - } - get project_name() { - if (this.args.get_otherargs().length == 0) { - console.error(`argument project name is not set!`); - } - let pname = this.args.get_otherargs()[0]; - if (!pname.match(/^[a-zA-Z0-9-_]+$/)) { - console.error(`project name "${pname}" seems to be a bad argument!`); - } - return pname; - } - get project_dir() { - let dir = this.args.get_path("directory"); - if (!dir || !this.project_name) - return; - return cocos_cli_1.cchelper.join(dir, this.project_name); - } - get shared_dir() { - let dir = this.args.get_path("shared_dir"); - if (!dir) - return cocos_cli_1.cchelper.join(this.project_dir, ".."); - return dir; - } - get engine_path() { - return this.args.get_path("engine_path"); - } - get selected_template_dir_name() { - let tpn = this.args.get_path("template_name"); - let template_names = this.get_templates_dir_names(); - if (template_names.length == 1) { - return template_names[0]; - } - let dirs = template_names.filter(x => x === `template-${tpn}`); - if (dirs.length == 0) { - console.error(`can not find template ${tpn} in ${template_names.join(",")}`); - } - return dirs[0]; - } - get selected_template_path() { - if (!this.selected_template_dir_name) - return null; - let dir = cocos_cli_1.cchelper.join(this.get_templates_root_path(), this.selected_template_dir_name); - if (!fs.existsSync(dir)) { - console.error(`selected template path not exists: ${dir}`); - } - let st = fs.statSync(dir); - if (!st.isDirectory()) { - console.error(`selected template path is not directory: ${dir}`); - } - let check_files = ["main.js", "project.json", PackageNewConfig, "frameworks"]; - for (let f of check_files) { - if (!fs.existsSync(cocos_cli_1.cchelper.join(dir, f))) { - console.warn(`warning: file "${f}" does not exists in ${dir}, template path can be incorrect setting!`); - } - } - return dir; - } -} -exports.CCPluginNEW = CCPluginNEW; -class TemplateCreator { - constructor(plugin) { - this.excludes = []; - this.plugin = plugin; - let args = plugin.args; - let template_dir = cocos_cli_1.cchelper.join(plugin.get_templates_root_path(), plugin.selected_template_dir_name); - this.lang = args.get_path("language"); - this.cocos_root = plugin.get_cocos_root(); - this.project_name = plugin.project_name; - this.project_dir = plugin.project_dir; - this.package_name = args.get_string("package_name"); - this.mac_bundleid = args.get_string("mac_bundleid"); - this.ios_bundleid = args.get_string("ios_bundleid"); - this.tp_name = args.get_path("template_name"); - this.tp_dir = template_dir; - if (cocos_cfg.support_templates.indexOf(this.tp_name) < 0) { - console.error(`template name "${this.tp_name}" is not supported!`); - } - if (!fs.existsSync(cocos_cli_1.cchelper.join(this.tp_dir, PackageNewConfig))) { - console.error(`can not find ${PackageNewConfig} in ${this.tp_dir}`); - return; - } - this.template_info = JSON.parse(fs.readFileSync(cocos_cli_1.cchelper.join(this.tp_dir, PackageNewConfig)).toString("utf8")); - if (!("do_default" in this.template_info)) { - console.error(`can not find "do_default" in ${PackageNewConfig}`); - return; - } - } - do_post_steps() { - return __awaiter(this, void 0, void 0, function* () { - yield this.set_orientation(); - yield this.update_android_gradle_values(); - }); - } - get_config_path() { - return cocos_cli_1.cchelper.join(this.project_dir, cocos_project.CONFIG); - } - run() { - return __awaiter(this, void 0, void 0, function* () { - let shared_dir = this.plugin.shared_dir; - { - let dir = cocos_cli_1.cchelper.join(shared_dir, this.plugin.common_dir); - if (!fs.existsSync(dir)) { - yield cocos_cli_1.cchelper.copy_files_with_config({ - from: cocos_cli_1.cchelper.join(this.tp_dir, "common"), - to: dir, - }, this.tp_dir, this.project_dir); - } - } - cocos_cli_1.cchelper.copy_file_sync(this.tp_dir, "project.json", this.project_dir, "project.json"); - // copy by platform - let plat = this.plugin.args.get_string("platform"); - { - let dir = cocos_cli_1.cchelper.join(this.project_dir, "proj"); - if (plat && !fs.existsSync(dir)) { - yield cocos_cli_1.cchelper.copy_files_with_config({ - from: cocos_cli_1.cchelper.join(this.tp_dir, "platforms", plat), - to: dir, - }, this.tp_dir, this.project_dir); - } - } - delete this.template_info.do_default; - for (let key in this.template_info) { - // console.log(`other commands ${key}`) - yield this.execute(this.template_info[key]); - } - yield this.do_post_steps(); - project_CONFIG.engine_version = this.get_cocos_version(); - let cfg = {}; - let cfgPath = this.get_config_path(); - if (fs.existsSync(cfgPath)) { - cfg = JSON.parse(fs.readFileSync(cfgPath).toString("utf-8")); - } - cfg = Object.assign(cfg, project_CONFIG); - fs.writeFileSync(cfgPath, JSON.stringify(cfg, undefined, 2)); - }); - } - get_cocos_version() { - const cocos2d_h = cocos_cli_1.cchelper.join(this.cocos_root, "cocos/cocos2d.h"); - if (!fs.existsSync(cocos2d_h)) { - return "unknown"; - } - else { - let lines = fs.readFileSync(cocos2d_h).toString("utf-8").split("\n").filter(x => x.indexOf("COCOS2D_VERSION") >= 0); - if (lines.length > 0) { - let ps = lines[0].split(" "); - let v = parseInt(ps[ps.length - 1]); - return `${v >> 16}.${(v & 0x0000FF00) >> 8}.${v & 0x000000FF}`; - } - } - return "unknown"; - } - get_project_pkg_config(platform) { - if (!fs.existsSync(this.get_config_path())) { - return undefined; - } - let p = JSON.parse(fs.readFileSync(this.get_config_path()).toString("utf-8")); - if (!p.packages) { - return undefined; - } - return p.packages[platform]; - } - set_orientation() { - return __awaiter(this, void 0, void 0, function* () { - let cfgPath = this.get_config_path(); - if (fs.existsSync(cfgPath)) { - let json = JSON.parse(fs.readFileSync(cfgPath).toString("utf-8")); - if (json.ios) { - let cfg = json.ios.orientation; - let infoPlist = cocos_cli_1.cchelper.join(this.project_dir, 'proj/Info.plist'); - if (fs.existsSync(infoPlist)) { - let orientations = []; - if (cfg.landscapeRight) { - orientations.push('UIInterfaceOrientationLandscapeRight'); - } - if (cfg.landscapeLeft) { - orientations.push('UIInterfaceOrientationLandscapeLeft'); - } - if (cfg.portrait) { - orientations.push('UIInterfaceOrientationPortrait'); - } - if (cfg.upsideDown) { - orientations.push('UIInterfaceOrientationPortraitUpsideDown'); - } - let replacement = `\tUISupportedInterfaceOrientations\t${orientations.map(x => `\t\t${x}`)}\t`; - let newlines = []; - let lines = fs.readFileSync(infoPlist).toString("utf-8").split("\n"); - let found_key = 0; - let found_values = 0; - for (let i = 0; i < lines.length; i++) { - if (lines[i].indexOf("UISupportedInterfaceOrientations") >= 0) { - found_key += 1; - newlines.push(lines[i]); - i++; - while (i < lines.length && lines[i].indexOf("") < 0) { - i++; - } - if (lines[i].indexOf("") >= 0) { - found_values += 1; - } - i++; - newlines.push(replacement); - } - else { - newlines.push(lines[i]); - } - } - if (found_key != 1 || found_values != 1) { - console.error(`error occurs while setting orientations for iOS`); - } - else { - yield afs_1.afs.writeFile(infoPlist, newlines.join("\n")); - } - } - else { - console.error(`file ${infoPlist} not exist!`); - } - } - if (json.android) { - let cfg = json.android.orientation; - let manifestPath = cocos_cli_1.cchelper.join(this.project_dir, 'proj/app/AndroidManifest.xml'); - if (fs.existsSync(manifestPath)) { - let pattern = /android:screenOrientation=\"[^"]*\"/; - let replaceString = 'android:screenOrientation="unspecified"'; - if (cfg.landscapeRight && cfg.landscapeLeft && cfg.portrait && cfg.upsideDown) { - replaceString = 'android:screenOrientation="fullSensor"'; - } - else if (cfg.landscapeRight && !cfg.landscapeLeft) { - replaceString = 'android:screenOrientation="landscape"'; - } - else if (!cfg.landscapeRight && cfg.landscapeLeft) { - replaceString = 'android:screenOrientation="reverseLandscape"'; - } - else if (cfg.landscapeRight && cfg.landscapeLeft) { - replaceString = 'android:screenOrientation="sensorLandscape"'; - } - else if (cfg.portrait && !cfg.upsideDown) { - replaceString = 'android:screenOrientation="portrait"'; - } - else if (!cfg.portrait && cfg.upsideDown) { - let oriValue = 'reversePortrait'; - replaceString = `android:screenOrientation="${oriValue}"`; - } - else if (cfg.portrait && cfg.upsideDown) { - let oriValue = 'sensorPortrait'; - replaceString = `android:screenOrientation="${oriValue}"`; - } - let content = yield afs_1.afs.readFile(manifestPath, 'utf8'); - content = content.replace(pattern, replaceString); - yield afs_1.afs.writeFile(manifestPath, content); - } - else { - console.error(`file ${manifestPath} not exist!`); - } - } - } - else { - console.error(`file ${cfgPath} not found!`); - } - }); - } - update_android_gradle_values() { - return __awaiter(this, void 0, void 0, function* () { - let cfg = this.get_project_pkg_config("android"); - if (!cfg) - return; - // android-studio gradle.properties - console.log(`update gradle.prperties`); - let gradlePropertyPath = cocos_cli_1.cchelper.join(this.project_dir, 'proj/gradle.properties'); - if (fs.existsSync(gradlePropertyPath)) { - let keystorePath = cfg.keystorePath; - if (this.plugin.get_current_platform() == "win32") { - keystorePath = cocos_cli_1.cchelper.fix_path(keystorePath); - } - let apiLevel = cfg.apiLevel; - if (!apiLevel) { - apiLevel = 27; - } - console.log(`AndroidAPI level ${apiLevel}`); - let content = fs.readFileSync(gradlePropertyPath, 'utf-8'); - if (keystorePath) { - content = content.replace(/.*RELEASE_STORE_FILE=.*/, `RELEASE_STORE_FILE=${keystorePath}`); - content = content.replace(/.*RELEASE_STORE_PASSWORD=.*/, `RELEASE_STORE_PASSWORD=${cfg.keystorePassword}`); - content = content.replace(/.*RELEASE_KEY_ALIAS=.*/, `RELEASE_KEY_ALIAS=${cfg.keystoreAlias}`); - content = content.replace(/.*RELEASE_KEY_PASSWORD=.*/, `RELEASE_KEY_PASSWORD=${cfg.keystoreAliasPassword}`); - } - else { - content = content.replace(/.*RELEASE_STORE_FILE=.*/, `# RELEASE_STORE_FILE=${keystorePath}`); - content = content.replace(/.*RELEASE_STORE_PASSWORD=.*/, `# RELEASE_STORE_PASSWORD=${cfg.keystorePassword}`); - content = content.replace(/.*RELEASE_KEY_ALIAS=.*/, `# RELEASE_KEY_ALIAS=${cfg.keystoreAlias}`); - content = content.replace(/.*RELEASE_KEY_PASSWORD=.*/, `# RELEASE_KEY_PASSWORD=${cfg.keystoreAliasPassword}`); - } - let SDK_VERSION = typeof apiLevel === "string" ? apiLevel.match(/\d+/)[0] : apiLevel; - content = content.replace(/PROP_TARGET_SDK_VERSION=.*/, `PROP_TARGET_SDK_VERSION=${SDK_VERSION}`); - content = content.replace(/PROP_COMPILE_SDK_VERSION=.*/, `PROP_COMPILE_SDK_VERSION=${SDK_VERSION}`); - let abis = (cfg.appABIs && cfg.appABIs.length > 0) ? cfg.appABIs.join(':') : 'armeabi-v7a'; - //todo:新的template里面有个注释也是这个字段,所以要加个g - content = content.replace(/PROP_APP_ABI=.*/g, `PROP_APP_ABI=${abis}`); - fs.writeFileSync(gradlePropertyPath, content); - // generate local.properties - content = ''; - content += `ndk.dir=${process.env.NDK_ROOT}\n`; - content += `sdk.dir=${process.env.ANDROID_SDK_ROOT}`; - //windows 需要使用的这样的格式 e\:\\aa\\bb\\cc - if (process.platform === 'win32') { - content = content.replace(/\\/g, '\\\\'); - content = content.replace(/:/g, '\\:'); - } - fs.writeFileSync(cocos_cli_1.cchelper.join(path.dirname(gradlePropertyPath), 'local.properties'), content); - } - else { - console.log(`warning: ${gradlePropertyPath} not found!`); - } - }); - } - execute(cmds) { - return __awaiter(this, void 0, void 0, function* () { - if (cmds.append_file) { - cmds.append_file.forEach(cmd => { - cocos_cli_1.cchelper.copy_file_sync(this.cocos_root, cmd.from, this.project_dir, cmd.to); - }); - delete cmds.append_file; - } - if (cmds.exclude_from_template) { - // do nothing - delete cmds.exclude_from_template; - } - /// only in link mode - let project_x_root = cmds.append_x_engine; - if (cmds.append_x_engine && this.tp_name != "link") { - let common = cocos2dx_files.common; - let engine_to = cocos_cli_1.cchelper.replace_env_variables(cmds.append_x_engine.to); - let to = path.isAbsolute(engine_to) ? engine_to : cocos_cli_1.cchelper.join(this.project_dir, engine_to); - yield cocos_cli_1.cchelper.parallel_copy_files(20, this.cocos_root, common, to); - if (this.lang == "js") { - let fileList = cocos2dx_files.js; - yield cocos_cli_1.cchelper.parallel_copy_files(20, this.cocos_root, fileList, to); - } - } - delete cmds.append_x_engine; - if (cmds.append_from_template) { - let cmd = cmds.append_from_template; - // console.log(`append-from-template ${JSON.stringify(cmd)}`); - yield cocos_cli_1.cchelper.copy_files_with_config({ - from: cmd.from, - to: cmd.to, - exclude: cmd.exclude - }, this.tp_dir, this.project_dir); - delete cmds.append_from_template; - } - let replace_files_delay = {}; - ; - if (cmds.project_replace_project_name) { - let cmd = cmds.project_replace_project_name; - cmd.files.forEach(file => { - let fp = cocos_cli_1.cchelper.join(this.project_dir, file); - replace_files_delay[fp] = replace_files_delay[fp] || []; - replace_files_delay[fp].push({ - reg: cmd.src_project_name, - content: this.project_name - }); - }); - delete cmds.project_replace_project_name; - } - if (cmds.project_replace_package_name) { - let cmd = cmds.project_replace_package_name; - let name = cmd.src_package_name.replace(/\./g, "\\."); - cmd.files.forEach(file => { - let fp = cocos_cli_1.cchelper.join(this.project_dir, file); - replace_files_delay[fp] = replace_files_delay[fp] || []; - replace_files_delay[fp].push({ - reg: name, - content: this.package_name - }); - }); - delete cmds.project_replace_package_name; - } - if (cmds.project_replace_mac_bundleid) { - let cmd = cmds.project_replace_mac_bundleid; - let bundle_id = cmd.src_bundle_id.replace(/\./g, "\\."); - cmd.files.forEach(file => { - let fp = cocos_cli_1.cchelper.join(this.project_dir, file); - replace_files_delay[fp] = replace_files_delay[fp] || []; - replace_files_delay[fp].push({ - reg: bundle_id, - content: this.mac_bundleid - }); - }); - delete cmds.project_replace_mac_bundleid; - } - if (cmds.project_replace_ios_bundleid) { - let cmd = cmds.project_replace_ios_bundleid; - let bundle_id = cmd.src_bundle_id.replace(/\./g, "\\."); - cmd.files.forEach(file => { - let fp = cocos_cli_1.cchelper.join(this.project_dir, file); - replace_files_delay[fp] = replace_files_delay[fp] || []; - replace_files_delay[fp].push({ - reg: bundle_id, - content: this.ios_bundleid - }); - }); - delete cmds.project_replace_ios_bundleid; - } - if (cmds.project_replace_cocos_x_root) { - let cmd = cmds.project_replace_cocos_x_root; - let cocos_x_root = path.normalize(this.cocos_root); - let proj_cocos_path = path.normalize(cocos_cli_1.cchelper.join(this.project_dir, project_x_root.to)); - for (let f of cmd.files) { - let p = typeof (f) == "string" ? f : f.file; - // console.log(`warning: project dir ${this.project_dir!} + ${p}`); - let fp = cocos_cli_1.cchelper.join(this.project_dir, p); - let list = replace_files_delay[fp] = replace_files_delay[fp] || []; - if (this.tp_name == "link") { - let v = typeof f.link == "string" ? f.link : cocos_x_root; - v = cocos_cli_1.cchelper.fix_path(v); - list.push({ - reg: cmd.pattern, - content: v - }); - } - else { - // use relative path - let rel_path = path.relative(fp, proj_cocos_path); - let v = !!f.default ? f.default : rel_path; - v = cocos_cli_1.cchelper.fix_path(v); - list.push({ - reg: cmd.pattern, - content: v - }); - } - } - delete cmds.project_replace_cocos_x_root; - } - if (cmds.project_replace_projec_common) { - let cmd = cmds.project_replace_projec_common; - let cocos_x_root = path.normalize(this.cocos_root); - let proj_common_dir = cocos_cli_1.cchelper.join(this.project_dir, this.plugin.common_dir); - for (let f of cmd.files) { - let p = typeof (f) == "string" ? f : f.file; - let fp = cocos_cli_1.cchelper.join(this.project_dir, p); - let list = replace_files_delay[fp] = replace_files_delay[fp] || []; - let rel_path = path.relative(fp, proj_common_dir); - list.push({ - reg: cmd.pattern, - content: cocos_cli_1.cchelper.fix_path(rel_path) - }); - } - delete cmds.project_replace_projec_common; - } - if (cmds.common_replace) { - for (let cmd of cmds.common_replace) { - for (let f of cmd.files) { - let fp = cocos_cli_1.cchelper.join(this.project_dir, f); - replace_files_delay[fp] = replace_files_delay[fp] || []; - replace_files_delay[fp].push({ - reg: cmd.pattern, - content: cmd.value - }); - } - } - delete cmds.common_replace; - } - for (let fullpath in replace_files_delay) { - let cfg = replace_files_delay[fullpath]; - yield cocos_cli_1.cchelper.replace_in_file(cfg.map(x => { - return { reg: x.reg, text: x.content }; - }), fullpath); - } - if (Object.keys(cmds).length > 0) { - for (let f in cmds) { - console.error(`command "${f}" is not parsed in ${PackageNewConfig}`); - } - } - }); - } -} -exports.TemplateCreator = TemplateCreator; -//# sourceMappingURL=plugin_new.js.map \ No newline at end of file diff --git a/native/tools/cocos-console/bin/plugin_new.ts b/native/tools/cocos-console/bin/plugin_new.ts deleted file mode 100644 index 95a7563791..0000000000 --- a/native/tools/cocos-console/bin/plugin_new.ts +++ /dev/null @@ -1,610 +0,0 @@ - -import { CCPlugin, pa, cchelper as ccutils } from "./cocos_cli"; - -import * as path from "path"; -import * as fs from "fs"; -import * as cocos_project from "./cocos_project_types"; -import * as cocos2dx_files from "../../../templates/cocos2dx_files.json"; -import * as cocos_cfg from "./cocos_config.json"; -import { afs } from "./afs"; - -const PackageNewConfig = "cocos-project-template.json"; - -import { CCPluginGENERATE } from "./plugin_generate"; -import { CCPluginRUN } from "./plugin_run"; - -let project_CONFIG = -{ - project_type: "js", - has_native: true, - engine_version: "", - custom_step_script: null /* script path*/ -}; - -export class CCPluginNEW extends CCPlugin { - - depends(): string | null { - return null; - } - - define_args(): void { - let parser = this.parser; - parser.add_predefined_argument_with_default("package_name", "CocosGame"); - parser.add_required_predefined_argument("directory"); - parser.add_predefined_argument_with_default("ios_bundleid", "org.cocos2dx.ios"); - parser.add_predefined_argument_with_default("mac_bundleid", "org.cocos2dx.mac"); - parser.add_predefined_argument("engine_path"); - parser.add_predefined_argument("portrait"); - parser.add_predefined_argument("no_native"); - parser.add_predefined_argument("build_dir"); - parser.add_predefined_argument_with_default("language", "js"); - parser.add_predefined_argument("do_list_templates", this.do_list_templates.bind(this)); - parser.add_predefined_argument_with_default("template_name", "link"); - parser.add_predefined_argument("shared_dir"); - } - init(): boolean { - - this.set_env("PROJECT_NAME", this.project_name!); - this.set_env("COMMON_DIR", ccutils.join(this.shared_dir!, this.common_dir)); - - let parser = this.parser; - // console.log(`PROJECT_NAME name ${this.project_name}`); - let cocos_dir = this.get_cocos_root(); - if (!fs.existsSync(ccutils.join(cocos_dir!, "cocos/cocos2d.h"))) { - console.error(`cocos2d.h not found in ${cocos_dir}, path incorrect!`); - return false; - } - - if (this.project_dir && !fs.existsSync(this.project_dir)) { - ccutils.make_directory_recursive(this.project_dir); - } - - return true; - } - - get common_dir() { - return `common-${this.args.get_string("template_name")}`; - } - - async run(): Promise { - let tp = new TemplateCreator(this); - await tp.run(); // async - return true; - } - /* override */ - get_engine_path(): string | null { - return this.args.get_path("engine_path"); - } - - private do_list_templates() { - console.log(`templates:`) - let dirs = this.get_templates_dir_names(); - for (let d of dirs) { - console.log(` - ${d}/`); - } - } - - get project_name(): string | undefined { - if (this.args.get_otherargs().length == 0) { - console.error(`argument project name is not set!`); - } - let pname = this.args.get_otherargs()[0]; - if (!pname.match(/^[a-zA-Z0-9-_]+$/)) { - console.error(`project name "${pname}" seems to be a bad argument!`) - } - return pname; - } - - get project_dir(): string | undefined { - let dir = this.args.get_path("directory"); - if (!dir || !this.project_name) return; - return ccutils.join(dir, this.project_name!); - } - - get shared_dir(): string | undefined { - let dir = this.args.get_path("shared_dir"); - if (!dir) return ccutils.join(this.project_dir!, ".."); - return dir; - } - - get engine_path(): string { - return this.args.get_path("engine_path"); - } - - get selected_template_dir_name(): string { - let tpn = this.args.get_path("template_name"); - let template_names = this.get_templates_dir_names(); - if (template_names.length == 1) { - return template_names[0]; - } - let dirs = template_names.filter(x => x === `template-${tpn}`); - if (dirs.length == 0) { - console.error(`can not find template ${tpn} in ${template_names.join(",")}`); - } - return dirs[0]; - } - - get selected_template_path(): string | null { - if (!this.selected_template_dir_name) return null; - let dir = ccutils.join(this.get_templates_root_path()!, this.selected_template_dir_name); - if (!fs.existsSync(dir)) { - console.error(`selected template path not exists: ${dir}`); - } - let st = fs.statSync(dir); - if (!st.isDirectory()) { - console.error(`selected template path is not directory: ${dir}`); - } - - let check_files: string[] = ["main.js", "project.json", PackageNewConfig, "frameworks"]; - for (let f of check_files) { - if (!fs.existsSync(ccutils.join(dir, f))) { - console.warn(`warning: file "${f}" does not exists in ${dir}, template path can be incorrect setting!`); - } - } - return dir; - } -} - - - -export class TemplateCreator { - lang?: string; - cocos_root?: string; - project_name?: string; - project_dir?: string; - tp_name?: string; - tp_dir?: string; - package_name?: string; - mac_bundleid?: string; - ios_bundleid?: string; - template_info?: cocos_project.CocosProjecConfig; - - excludes: string[] = []; - plugin: CCPluginNEW; - - constructor(plugin: CCPluginNEW) { - this.plugin = plugin; - let args = plugin.args; - let template_dir = ccutils.join(plugin.get_templates_root_path()!, plugin.selected_template_dir_name); - - this.lang = args.get_path("language"); - this.cocos_root = plugin.get_cocos_root()!; - this.project_name = plugin.project_name; - this.project_dir = plugin.project_dir; - this.package_name = args.get_string("package_name"); - this.mac_bundleid = args.get_string("mac_bundleid"); - this.ios_bundleid = args.get_string("ios_bundleid"); - this.tp_name = args.get_path("template_name"); - this.tp_dir = template_dir; - - if (cocos_cfg.support_templates.indexOf(this.tp_name) < 0) { - console.error(`template name "${this.tp_name}" is not supported!`); - } - - if (!fs.existsSync(ccutils.join(this.tp_dir, PackageNewConfig))) { - console.error(`can not find ${PackageNewConfig} in ${this.tp_dir}`); - return; - } - - this.template_info = JSON.parse(fs.readFileSync(ccutils.join(this.tp_dir, PackageNewConfig)).toString("utf8")); - if (!("do_default" in this.template_info!)) { - console.error(`can not find "do_default" in ${PackageNewConfig}`); - return; - } - } - - async do_post_steps() { - await this.set_orientation(); - await this.update_android_gradle_values(); - } - - get_config_path(): string { - return ccutils.join(this.project_dir!, cocos_project.CONFIG); - } - - async run() { - - let shared_dir = this.plugin.shared_dir!; - - { - let dir = ccutils.join(shared_dir, this.plugin.common_dir); - if(!fs.existsSync(dir)) { - await ccutils.copy_files_with_config( - { - from: ccutils.join(this.tp_dir!, "common"), - to: dir, - }, this.tp_dir!, this.project_dir!); - } - } - - ccutils.copy_file_sync(this.tp_dir!, "project.json", this.project_dir!, "project.json"); - - // copy by platform - let plat = this.plugin.args.get_string("platform"); - { - let dir = ccutils.join(this.project_dir!, "proj"); - if (plat && !fs.existsSync(dir)) { - await ccutils.copy_files_with_config( - { - from: ccutils.join(this.tp_dir!, "platforms", plat), - to: dir, - }, this.tp_dir!, this.project_dir!); - } - } - - delete this.template_info!.do_default; - - for (let key in this.template_info!) { - // console.log(`other commands ${key}`) - await this.execute((this.template_info as any)[key] as any); - } - - - await this.do_post_steps(); - project_CONFIG.engine_version = this.get_cocos_version(); - - let cfg: any = {}; - let cfgPath = this.get_config_path(); - if (fs.existsSync(cfgPath)) { - cfg = JSON.parse(fs.readFileSync(cfgPath).toString("utf-8")); - } - cfg = Object.assign(cfg, project_CONFIG); - fs.writeFileSync(cfgPath, JSON.stringify(cfg, undefined, 2)); - } - - get_cocos_version(): string { - const cocos2d_h = ccutils.join(this.cocos_root!, "cocos/cocos2d.h"); - if (!fs.existsSync(cocos2d_h)) { - return "unknown"; - } else { - let lines = fs.readFileSync(cocos2d_h).toString("utf-8").split("\n").filter(x => x.indexOf("COCOS2D_VERSION") >= 0); - if (lines.length > 0) { - let ps = lines[0].split(" "); - let v = parseInt(ps[ps.length - 1]); - return `${v >> 16}.${(v & 0x0000FF00) >> 8}.${v & 0x000000FF}`; - } - } - return "unknown"; - } - - get_project_pkg_config(platform: string): any { - if (!fs.existsSync(this.get_config_path())) { - return undefined; - } - let p = JSON.parse(fs.readFileSync(this.get_config_path()).toString("utf-8")); - if (!p.packages) { - return undefined; - } - return p.packages[platform]; - } - - async set_orientation() { - let cfgPath = this.get_config_path(); - if (fs.existsSync(cfgPath)) { - let json = JSON.parse(fs.readFileSync(cfgPath).toString("utf-8")); - if (json.ios) { - let cfg = json.ios.orientation; - let infoPlist = ccutils.join(this.project_dir!, 'proj/Info.plist'); - if (fs.existsSync(infoPlist)) { - let orientations: string[] = []; - if (cfg.landscapeRight) { - orientations.push('UIInterfaceOrientationLandscapeRight'); - } - if (cfg.landscapeLeft) { - orientations.push('UIInterfaceOrientationLandscapeLeft'); - } - if (cfg.portrait) { - orientations.push('UIInterfaceOrientationPortrait'); - } - if (cfg.upsideDown) { - orientations.push('UIInterfaceOrientationPortraitUpsideDown'); - } - let replacement: string = `\tUISupportedInterfaceOrientations\t${orientations.map(x => `\t\t${x}`)}\t`; - let newlines: string[] = []; - let lines = fs.readFileSync(infoPlist).toString("utf-8").split("\n"); - let found_key = 0; - let found_values = 0; - for (let i = 0; i < lines.length; i++) { - if (lines[i].indexOf("UISupportedInterfaceOrientations") >= 0) { - found_key += 1; - newlines.push(lines[i]); - i++; - while (i < lines.length && lines[i].indexOf("") < 0) { - i++; - } - if (lines[i].indexOf("") >= 0) { - found_values += 1; - } - i++; - newlines.push(replacement); - } else { - newlines.push(lines[i]); - } - } - if (found_key != 1 || found_values != 1) { - console.error(`error occurs while setting orientations for iOS`); - } else { - await afs.writeFile(infoPlist, newlines.join("\n")); - } - } else { - console.error(`file ${infoPlist} not exist!`); - } - } - - if (json.android) { - let cfg = json.android.orientation; - let manifestPath = ccutils.join(this.project_dir!, 'proj/app/AndroidManifest.xml'); - if (fs.existsSync(manifestPath)) { - let pattern = /android:screenOrientation=\"[^"]*\"/; - let replaceString = 'android:screenOrientation="unspecified"'; - - if (cfg.landscapeRight && cfg.landscapeLeft && cfg.portrait && cfg.upsideDown) { - replaceString = 'android:screenOrientation="fullSensor"'; - } - else if (cfg.landscapeRight && !cfg.landscapeLeft) { - replaceString = 'android:screenOrientation="landscape"'; - } - else if (!cfg.landscapeRight && cfg.landscapeLeft) { - replaceString = 'android:screenOrientation="reverseLandscape"'; - } - else if (cfg.landscapeRight && cfg.landscapeLeft) { - replaceString = 'android:screenOrientation="sensorLandscape"'; - } - else if (cfg.portrait && !cfg.upsideDown) { - replaceString = 'android:screenOrientation="portrait"'; - } - else if (!cfg.portrait && cfg.upsideDown) { - let oriValue = 'reversePortrait'; - replaceString = `android:screenOrientation="${oriValue}"`; - } - else if (cfg.portrait && cfg.upsideDown) { - let oriValue = 'sensorPortrait'; - replaceString = `android:screenOrientation="${oriValue}"`; - } - - let content = await afs.readFile(manifestPath, 'utf8'); - content = content.replace(pattern, replaceString); - await afs.writeFile(manifestPath, content); - } else { - console.error(`file ${manifestPath} not exist!`); - } - } - } else { - console.error(`file ${cfgPath} not found!`) - } - } - - async update_android_gradle_values() { - - let cfg = this.get_project_pkg_config("android"); - if (!cfg) return; - - // android-studio gradle.properties - console.log(`update gradle.prperties`) - let gradlePropertyPath = ccutils.join(this.project_dir!, 'proj/gradle.properties'); - if (fs.existsSync(gradlePropertyPath)) { - let keystorePath = cfg.keystorePath; - if (this.plugin.get_current_platform() == "win32") { - keystorePath = ccutils.fix_path(keystorePath); - } - let apiLevel = cfg.apiLevel; - if (!apiLevel) { - apiLevel = 27; - } - console.log(`AndroidAPI level ${apiLevel}`); - let content = fs.readFileSync(gradlePropertyPath, 'utf-8'); - if (keystorePath) { - content = content.replace(/.*RELEASE_STORE_FILE=.*/, `RELEASE_STORE_FILE=${keystorePath}`); - content = content.replace(/.*RELEASE_STORE_PASSWORD=.*/, `RELEASE_STORE_PASSWORD=${cfg.keystorePassword}`); - content = content.replace(/.*RELEASE_KEY_ALIAS=.*/, `RELEASE_KEY_ALIAS=${cfg.keystoreAlias}`); - content = content.replace(/.*RELEASE_KEY_PASSWORD=.*/, `RELEASE_KEY_PASSWORD=${cfg.keystoreAliasPassword}`); - } else { - content = content.replace(/.*RELEASE_STORE_FILE=.*/, `# RELEASE_STORE_FILE=${keystorePath}`); - content = content.replace(/.*RELEASE_STORE_PASSWORD=.*/, `# RELEASE_STORE_PASSWORD=${cfg.keystorePassword}`); - content = content.replace(/.*RELEASE_KEY_ALIAS=.*/, `# RELEASE_KEY_ALIAS=${cfg.keystoreAlias}`); - content = content.replace(/.*RELEASE_KEY_PASSWORD=.*/, `# RELEASE_KEY_PASSWORD=${cfg.keystoreAliasPassword}`); - } - let SDK_VERSION = typeof apiLevel === "string"? apiLevel.match(/\d+/)![0] : apiLevel; - content = content.replace(/PROP_TARGET_SDK_VERSION=.*/, `PROP_TARGET_SDK_VERSION=${SDK_VERSION}`); - content = content.replace(/PROP_COMPILE_SDK_VERSION=.*/, `PROP_COMPILE_SDK_VERSION=${SDK_VERSION}`); - - let abis = (cfg.appABIs && cfg.appABIs.length > 0) ? cfg.appABIs.join(':') : 'armeabi-v7a'; - //todo:新的template里面有个注释也是这个字段,所以要加个g - content = content.replace(/PROP_APP_ABI=.*/g, `PROP_APP_ABI=${abis}`); - - fs.writeFileSync(gradlePropertyPath, content); - - // generate local.properties - content = ''; - content += `ndk.dir=${process.env.NDK_ROOT}\n`; - content += `sdk.dir=${process.env.ANDROID_SDK_ROOT}`; - - //windows 需要使用的这样的格式 e\:\\aa\\bb\\cc - if (process.platform === 'win32') { - content = content.replace(/\\/g, '\\\\'); - content = content.replace(/:/g, '\\:'); - } - - fs.writeFileSync(ccutils.join(path.dirname(gradlePropertyPath), 'local.properties'), content); - } else { - console.log(`warning: ${gradlePropertyPath} not found!`); - } - } - - private async execute(cmds: cocos_project.CocosProjectTasks) { - if (cmds.append_file) { - cmds.append_file.forEach(cmd => { - ccutils.copy_file_sync(this.cocos_root!, cmd.from, this.project_dir!, cmd.to); - }); - delete cmds.append_file; - } - - if (cmds.exclude_from_template) { - // do nothing - delete cmds.exclude_from_template; - } - - /// only in link mode - let project_x_root = cmds.append_x_engine!; - if (cmds.append_x_engine && this.tp_name != "link") { - let common = cocos2dx_files.common; - let engine_to = ccutils.replace_env_variables(cmds.append_x_engine.to); - let to = path.isAbsolute(engine_to) ? engine_to : ccutils.join(this.project_dir!, engine_to); - await ccutils.parallel_copy_files(20, this.cocos_root!, common, to); - if (this.lang == "js") { - let fileList = cocos2dx_files.js; - await ccutils.parallel_copy_files(20, this.cocos_root!, fileList, to); - } - } - delete cmds.append_x_engine; - - if (cmds.append_from_template) { - let cmd = cmds.append_from_template; - - // console.log(`append-from-template ${JSON.stringify(cmd)}`); - await ccutils.copy_files_with_config({ - from: cmd.from, - to: cmd.to, - exclude: cmd.exclude - }, this.tp_dir!, this.project_dir!); - - delete cmds.append_from_template; - } - - let replace_files_delay: { [key: string]: { reg: string, content: string }[] } = {};; - if (cmds.project_replace_project_name) { - let cmd = cmds.project_replace_project_name; - - cmd.files.forEach(file => { - let fp = ccutils.join(this.project_dir!, file); - replace_files_delay[fp] = replace_files_delay[fp] || []; - replace_files_delay[fp].push({ - reg: cmd.src_project_name, - content: this.project_name! - }); - }); - delete cmds.project_replace_project_name; - } - - if (cmds.project_replace_package_name) { - let cmd = cmds.project_replace_package_name; - let name = cmd.src_package_name.replace(/\./g, "\\."); - cmd.files.forEach(file => { - let fp = ccutils.join(this.project_dir!, file); - replace_files_delay[fp] = replace_files_delay[fp] || []; - replace_files_delay[fp].push({ - reg: name, - content: this.package_name! - }); - }); - delete cmds.project_replace_package_name; - } - - if (cmds.project_replace_mac_bundleid) { - let cmd = cmds.project_replace_mac_bundleid; - let bundle_id = cmd.src_bundle_id.replace(/\./g, "\\."); - cmd.files.forEach(file => { - let fp = ccutils.join(this.project_dir!, file); - replace_files_delay[fp] = replace_files_delay[fp] || []; - replace_files_delay[fp].push({ - reg: bundle_id, - content: this.mac_bundleid! - }); - }); - delete cmds.project_replace_mac_bundleid; - } - - if (cmds.project_replace_ios_bundleid) { - let cmd = cmds.project_replace_ios_bundleid; - let bundle_id = cmd.src_bundle_id.replace(/\./g, "\\."); - cmd.files.forEach(file => { - let fp = ccutils.join(this.project_dir!, file); - replace_files_delay[fp] = replace_files_delay[fp] || []; - replace_files_delay[fp].push({ - reg: bundle_id, - content: this.ios_bundleid! - }); - }); - delete cmds.project_replace_ios_bundleid; - } - - if (cmds.project_replace_cocos_x_root) { - let cmd = cmds.project_replace_cocos_x_root!; - let cocos_x_root = path.normalize(this.cocos_root!); - let proj_cocos_path = path.normalize(ccutils.join(this.project_dir!, project_x_root.to)); - for (let f of cmd.files) { - - let p = typeof (f) == "string" ? f : f.file; - // console.log(`warning: project dir ${this.project_dir!} + ${p}`); - let fp = ccutils.join(this.project_dir!, p); - let list = replace_files_delay[fp] = replace_files_delay[fp] || []; - - if (this.tp_name == "link") { - let v = typeof f.link == "string" ? f.link as string : cocos_x_root; - v = ccutils.fix_path(v); - list.push({ - reg: cmd.pattern, - content: v - }); - } else { - // use relative path - let rel_path = path.relative(fp, proj_cocos_path); - let v = !!(f as any).default ? (f as any).default : rel_path; - v = ccutils.fix_path(v); - list.push({ - reg: cmd.pattern, - content: v - }); - } - } - - delete cmds.project_replace_cocos_x_root; - } - - if (cmds.project_replace_projec_common) { - - let cmd = cmds.project_replace_projec_common!; - let cocos_x_root = path.normalize(this.cocos_root!); - let proj_common_dir = ccutils.join(this.project_dir!, this.plugin.common_dir); - for (let f of cmd.files) { - let p = typeof (f) == "string" ? f : f.file; - let fp = ccutils.join(this.project_dir!, p); - let list = replace_files_delay[fp] = replace_files_delay[fp] || []; - let rel_path = path.relative(fp, proj_common_dir); - list.push({ - reg: cmd.pattern, - content: ccutils.fix_path(rel_path) - }); - } - delete cmds.project_replace_projec_common; - } - - if (cmds.common_replace) { - for (let cmd of cmds.common_replace) { - for (let f of cmd.files) { - let fp = ccutils.join(this.project_dir!, f); - replace_files_delay[fp] = replace_files_delay[fp] || []; - replace_files_delay[fp].push({ - reg: cmd.pattern, - content: cmd.value - }); - } - } - delete cmds.common_replace; - } - - for (let fullpath in replace_files_delay) { - let cfg = replace_files_delay[fullpath]; - await ccutils.replace_in_file(cfg.map(x => { - return { reg: x.reg, text: x.content }; - }), fullpath); - } - - if (Object.keys(cmds).length > 0) { - for (let f in cmds) { - console.error(`command "${f}" is not parsed in ${PackageNewConfig}`); - } - } - } - -} \ No newline at end of file diff --git a/native/tools/cocos-console/bin/plugin_run.js b/native/tools/cocos-console/bin/plugin_run.js deleted file mode 100644 index c4b1cdee32..0000000000 --- a/native/tools/cocos-console/bin/plugin_run.js +++ /dev/null @@ -1,252 +0,0 @@ -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -const cocos_cli_1 = require("./cocos_cli"); -const path = require("path"); -const fs = require("fs"); -const os = require("os"); -const child_process = require("child_process"); -const PackageNewConfig = "cocos-project-template.json"; -class CCPluginRUN extends cocos_cli_1.CCPlugin { - depends() { - return "compile"; - } - define_args() { - this.parser.add_required_predefined_argument("build_dir"); - this.parser.add_predefined_argument("cmake_path"); - this.parser.add_predefined_argument("ios_simulator"); - } - init() { - return true; - } - run() { - return __awaiter(this, void 0, void 0, function* () { - let platform = this.get_platform(); - let build_dir = this.get_build_dir(); - let project_name = this.get_project_name_from_cmake(); - if (platform == "mac") { - return (new MacRunCMD(this)).run(); - } - else if (platform == "ios") { - return (new IOSRunCMD(this)).run(); - } - else if (platform == "android") { - return (new AndroidRunCMD(this)).run(); - } - else if (platform == "win32") { - return (new Win32RunCMD(this)).run(); - } - return true; - }); - } - get_project_name_from_cmake() { - let cmake_cache = path.join(this.get_build_dir(), "CMakeCache.txt"); - if (!fs.existsSync(cmake_cache)) { - console.error(`can not find "CMakeCache.txt" in ${this.get_build_dir()}, please run "cmake -G" first`); - } - let project_name = cocos_cli_1.cchelper.exact_value_from_file(/CMAKE_PROJECT_NAME:\w+=(.*)/, cmake_cache, 1); - return project_name; - } -} -exports.CCPluginRUN = CCPluginRUN; -class PlatformRunCmd { - constructor(plugin) { - this.plugin = plugin; - } - get project_name() { - return this.plugin.get_project_name_from_cmake(); - } -} -class MacRunCMD extends PlatformRunCmd { - run() { - return __awaiter(this, void 0, void 0, function* () { - this.mac_run(this.project_name); - return true; - }); - } - mac_open(app) { - console.log(`open ${app}`); - let cp = child_process.spawn(`open`, [app], { - shell: true, - env: process.env - }); - cp.stdout.on("data", (data) => { - console.log(`[open app] ${data}`); - }); - cp.stderr.on(`data`, (data) => { - console.error(`[open app error] ${data}`); - }); - cp.on("close", (code, sig) => { - console.log(`${app} exit with ${code}, sig: ${sig}`); - }); - } - mac_run(project_name) { - let debug_dir = path.join(this.plugin.get_build_dir(), "Debug"); - if (!fs.existsSync(debug_dir)) { - console.log(`[mac run] ${debug_dir} is not exist!`); - process.exit(1); - } - let app_path; - if (project_name) { - app_path = path.join(debug_dir, `${project_name}-desktop.app`); - if (fs.existsSync(app_path)) { - this.mac_open(app_path); - return; - } - } - let app_list = fs.readdirSync(debug_dir).filter(x => x.endsWith(".app")); - if (app_list.length == 1) { - return this.mac_open(path.join(debug_dir, app_list[0])); - } - console.error(`found ${app_list.length} apps, failed to open.`); - process.exit(1); - } -} -class IOSRunCMD extends PlatformRunCmd { - run() { - if (this.plugin.enable_ios_simulator()) { - return this.run_ios_simulator(); - } - else { - return this.run_ios_device(); - } - } - select_simulator_id() { - let iphones = child_process.execSync("xcrun instruments -s").toString("utf-8").split("\n").filter(x => x.startsWith("iPhone") && x.indexOf("Simulator") >= 0); - const exact = (l) => { - l = l.split("[")[0].substr(6); - return parseInt(l) * 100 + l.length; - }; - let ret = iphones.filter(x => x.indexOf("Apple Watch") < 0).sort((a, b) => { - return exact(b) - exact(a); - })[0]; - let m = ret.match(/iPhone\s*[^\[]*\[([^\]]*)\].*/); - console.log(`selected simualtor ${ret}`); - return m[1]; - } - select_ios_devices() { - let lines = child_process.execSync(`xcrun simctl list`).toString("utf-8").split("\n"); - let readDevices = (lines, idx) => { - while (idx < lines.length && !lines[idx].match(/== Devices ==/)) { - idx++; - } - return idx < lines.length ? idx : -1; - }; - let readIOSDevices = (list, idx) => { - let ret = []; - while (!list[idx].match(/-- iOS [^ ]* --/)) { - idx++; - } - if (list[idx].indexOf("iOS") < 0) { - console.error(`can not find iOS section!`); - return ret; - } - idx++; - while (list[idx].startsWith(" ")) { - ret.push(list[idx++]); - } - return ret.map(x => x.trim()); - }; - let idx = readDevices(lines, 0); - if (idx < 0) { - console.error(`can not find devices section!`); - return []; - } - let list = readIOSDevices(lines, idx); - let ret = list.filter(x => x.startsWith("iPhone")); - return ret; - } - read_bundle_id() { - let prj_name = this.project_name; - let cmake_tmp_dir = fs.readdirSync(path.join(this.plugin.get_build_dir(), "CMakeFiles")).filter(x => x.startsWith(prj_name))[0]; - let infoPlist = path.join(this.plugin.get_build_dir(), "CMakeFiles", cmake_tmp_dir, "Info.plist"); - if (fs.existsSync(infoPlist)) { - let lines = fs.readFileSync(infoPlist).toString("utf-8").split("\n"); - for (let i = 0; i < lines.length; i++) { - if (lines[i].match(/CFBundleIdentifier/)) { - i++; - while (!lines[i].match(//)) { - i++; - } - let m = lines[i].match(/([^<]*)<\/string>/); - return m[1]; - } - } - } - else { - console.error(`Info.plist not found ${infoPlist}`); - } - return null; - } - query_ios_device() { - let lines = child_process.execSync(`xcrun instruments -s devices`).toString("utf-8").split("\n"); - let ret = []; - //skip first line - for (let i = 1; i < lines.length; i++) { - if (lines[i].endsWith("(Simulator)")) { - continue; - } - else if (lines[i].match(/iPhone|iPad|iPod/)) { - ret.push(lines[i]); - } - } - if (ret.length > 0) { - console.log(`select ios device ${ret[0]}`); - return ret[0].match(/[^\[]]*\[([^\]]*)\]/)[1]; - } - return null; - } - run_ios_device() { - return __awaiter(this, void 0, void 0, function* () { - let build_dir = this.plugin.get_build_dir(); - let foudn_aps = child_process.execSync(`find ${build_dir} -name "*.app"`).toString("utf-8").split("\n").filter(x => x.trim().length > 0); - let device_id = this.query_ios_device(); - if (!device_id) { - console.error(`no connected device found!`); - return false; - } - if (foudn_aps.length > 0) { - let cwd = fs.mkdtempSync(path.join(os.tmpdir(), this.project_name)); - yield cocos_cli_1.cchelper.run_cmd(`xcrun`, ["instruments", "-t", "Blank", "-w", device_id, foudn_aps[0]], false, cwd); - } - return true; - }); - } - run_ios_simulator() { - return __awaiter(this, void 0, void 0, function* () { - let sim_id = this.select_simulator_id(); - let build_dir = this.plugin.get_build_dir(); - let bundle_id = this.read_bundle_id(); - console.log(` - build dir ${build_dir} - sim_id ${sim_id}`); - console.log(` - bundle id ${bundle_id}`); - let found_apps = child_process.execSync(`find ${build_dir} -name "*.app"`).toString("utf-8").split("\n").filter(x => x.trim().length > 0); - if (found_apps.length > 0 && bundle_id) { - yield cocos_cli_1.cchelper.run_cmd("xcrun", ["simctl", "boot", sim_id], true); - yield cocos_cli_1.cchelper.run_cmd("open", ["`xcode-select -p`/Applications/Simulator.app"], true); - yield cocos_cli_1.cchelper.run_cmd("xcrun", ["simctl", "boot", sim_id], true); - yield cocos_cli_1.cchelper.run_cmd("xcrun", ["simctl", "install", sim_id, found_apps[0].trim()], false); - yield cocos_cli_1.cchelper.run_cmd("xcrun", ["simctl", "launch", sim_id, `"${bundle_id}"`], false); - } - return false; - }); - } -} -class Win32RunCMD extends PlatformRunCmd { - run() { - throw new Error("Method not implemented."); - } -} -class AndroidRunCMD extends PlatformRunCmd { - run() { - throw new Error("Method not implemented."); - } -} -//# sourceMappingURL=plugin_run.js.map \ No newline at end of file diff --git a/native/tools/cocos-console/bin/plugin_run.ts b/native/tools/cocos-console/bin/plugin_run.ts deleted file mode 100644 index a8d7d5aeca..0000000000 --- a/native/tools/cocos-console/bin/plugin_run.ts +++ /dev/null @@ -1,267 +0,0 @@ -import { CCPlugin, pa, cchelper } from "./cocos_cli"; - -import * as path from "path"; -import * as fs from "fs"; -import * as os from "os"; -import * as cocos_cfg from "./cocos_config.json"; -import * as cocos_project from "./cocos_project_types"; -import * as cocos2dx_files from "../../../templates/cocos2dx_files.json"; -import * as child_process from "child_process"; -import { afs } from "./afs"; - -const PackageNewConfig = "cocos-project-template.json"; - -export class CCPluginRUN extends CCPlugin { - - depends(): string | null { - return "compile"; - } - - define_args(): void { - this.parser.add_required_predefined_argument("build_dir"); - this.parser.add_predefined_argument("cmake_path"); - this.parser.add_predefined_argument("ios_simulator"); - } - init(): boolean { - return true; - } - async run(): Promise { - let platform: string = this.get_platform(); - let build_dir: string = this.get_build_dir(); - let project_name: string | undefined = this.get_project_name_from_cmake(); - if (platform == "mac") { - return (new MacRunCMD(this)).run() - } else if (platform == "ios") { - return (new IOSRunCMD(this)).run(); - } else if (platform == "android") { - return (new AndroidRunCMD(this)).run(); - } else if (platform == "win32") { - return (new Win32RunCMD(this)).run(); - } - return true; - } - - get_project_name_from_cmake(): string | undefined { - let cmake_cache = path.join(this.get_build_dir(), "CMakeCache.txt"); - if (!fs.existsSync(cmake_cache)) { - console.error(`can not find "CMakeCache.txt" in ${this.get_build_dir()}, please run "cmake -G" first`); - } - let project_name = cchelper.exact_value_from_file(/CMAKE_PROJECT_NAME:\w+=(.*)/, cmake_cache, 1); - return project_name; - } -} - - -abstract class PlatformRunCmd { - plugin: CCPluginRUN; - constructor(plugin: CCPluginRUN) { - this.plugin = plugin; - } - abstract async run(): Promise; - - get project_name(): string | undefined { - return this.plugin.get_project_name_from_cmake(); - } -} - - -class MacRunCMD extends PlatformRunCmd { - async run(): Promise { - this.mac_run(this.project_name!); - return true; - } - - private mac_open(app: string) { - console.log(`open ${app}`); - let cp = child_process.spawn(`open`, [app], { - shell: true, - env: process.env - }); - cp.stdout.on("data", (data) => { - console.log(`[open app] ${data}`); - }); - cp.stderr.on(`data`, (data) => { - console.error(`[open app error] ${data}`); - }); - cp.on("close", (code, sig) => { - console.log(`${app} exit with ${code}, sig: ${sig}`); - }); - } - - private mac_run(project_name?: string) { - - let debug_dir = path.join(this.plugin.get_build_dir(), "Debug"); - if (!fs.existsSync(debug_dir)) { - console.log(`[mac run] ${debug_dir} is not exist!`); - process.exit(1); - } - let app_path: string; - if (project_name) { - app_path = path.join(debug_dir, `${project_name}-desktop.app`); - if (fs.existsSync(app_path)) { - this.mac_open(app_path); - return; - } - } - - let app_list = fs.readdirSync(debug_dir).filter(x => x.endsWith(".app")); - if (app_list.length == 1) { - return this.mac_open(path.join(debug_dir, app_list[0])); - } - console.error(`found ${app_list.length} apps, failed to open.`); - process.exit(1); - } - -} - -class IOSRunCMD extends PlatformRunCmd { - run(): Promise { - if (this.plugin.enable_ios_simulator()) { - return this.run_ios_simulator(); - } else { - return this.run_ios_device(); - } - } - - select_simulator_id(): string { - let iphones = child_process.execSync("xcrun instruments -s").toString("utf-8").split("\n").filter(x => x.startsWith("iPhone") && x.indexOf("Simulator") >= 0); - const exact = (l: string) => { - l = l.split("[")[0].substr(6); - return parseInt(l) * 100 + l.length; - } - let ret = iphones.filter(x => x.indexOf("Apple Watch") < 0).sort((a, b) => { - return exact(b) - exact(a); - })[0]; - let m = ret.match(/iPhone\s*[^\[]*\[([^\]]*)\].*/); - console.log(`selected simualtor ${ret}`); - return m![1]; - } - - select_ios_devices(): string[] { - let lines = child_process.execSync(`xcrun simctl list`).toString("utf-8").split("\n"); - - let readDevices = (lines: string[], idx: number): number => { - while (idx < lines.length && !lines[idx].match(/== Devices ==/)) { - idx++; - } - return idx < lines.length ? idx : -1; - } - - let readIOSDevices = (list: string[], idx: number): string[] => { - let ret: string[] = []; - while (!list[idx].match(/-- iOS [^ ]* --/)) { - idx++; - } - if (list[idx].indexOf("iOS") < 0) { - console.error(`can not find iOS section!`); - return ret; - } - idx++; - while (list[idx].startsWith(" ")) { - ret.push(list[idx++]); - } - return ret.map(x => x.trim()); - }; - - let idx = readDevices(lines, 0); - if (idx < 0) { - console.error(`can not find devices section!`); - return []; - } - - let list = readIOSDevices(lines, idx); - let ret = list.filter(x => x.startsWith("iPhone")); - return ret; - } - - read_bundle_id():string|null { - let prj_name = this.project_name!; - let cmake_tmp_dir = fs.readdirSync(path.join(this.plugin.get_build_dir(), "CMakeFiles")).filter(x=>x.startsWith(prj_name))[0]; - - let infoPlist = path.join(this.plugin.get_build_dir(), "CMakeFiles", cmake_tmp_dir, "Info.plist"); - if(fs.existsSync(infoPlist)) { - let lines = fs.readFileSync(infoPlist).toString("utf-8").split("\n"); - for(let i = 0;i< lines.length;i++) { - if (lines[i].match(/CFBundleIdentifier/)) { - i++; - while(!lines[i].match(//)){ - i++; - } - let m = lines[i].match(/([^<]*)<\/string>/); - return m![1]; - } - } - }else{ - console.error(`Info.plist not found ${infoPlist}`); - } - return null; - } - - query_ios_device():string|null { - let lines = child_process.execSync(`xcrun instruments -s devices`).toString("utf-8").split("\n"); - let ret:string[] = []; - //skip first line - for(let i = 1; i< lines.length; i++) { - if(lines[i].endsWith("(Simulator)")){ - continue; - }else if(lines[i].match(/iPhone|iPad|iPod/)) { - ret.push(lines[i]); - } - } - if(ret.length > 0) { - console.log(`select ios device ${ret[0]}`); - return ret[0].match(/[^\[]]*\[([^\]]*)\]/)![1]; - } - return null; - } - - async run_ios_device(): Promise { - let build_dir = this.plugin.get_build_dir(); - let foudn_aps = child_process.execSync(`find ${build_dir} -name "*.app"`).toString("utf-8").split("\n").filter(x => x.trim().length > 0); - let device_id = this.query_ios_device(); - if(!device_id) { - console.error(`no connected device found!`); - return false; - } - if(foudn_aps.length > 0) { - let cwd = fs.mkdtempSync(path.join(os.tmpdir(), this.project_name!)); - await cchelper.run_cmd(`xcrun`, ["instruments", "-t", "Blank", "-w", device_id, foudn_aps[0]], false, - cwd); - } - return true; - } - - async run_ios_simulator(): Promise { - let sim_id = this.select_simulator_id(); - let build_dir = this.plugin.get_build_dir(); - let bundle_id = this.read_bundle_id(); - console.log(` - build dir ${build_dir} - sim_id ${sim_id}`); - console.log(` - bundle id ${bundle_id}`); - - let found_apps = child_process.execSync(`find ${build_dir} -name "*.app"`).toString("utf-8").split("\n").filter(x => x.trim().length > 0); - - if (found_apps.length > 0 && bundle_id) { - - await cchelper.run_cmd("xcrun", ["simctl", "boot", sim_id], true); - await cchelper.run_cmd("open", ["`xcode-select -p`/Applications/Simulator.app"], true); - await cchelper.run_cmd("xcrun", ["simctl", "boot", sim_id], true); - await cchelper.run_cmd("xcrun", ["simctl", "install", sim_id, found_apps[0].trim()], false); - await cchelper.run_cmd("xcrun", ["simctl", "launch", sim_id, `"${bundle_id}"`], false); - } - return false; - } - -} -class Win32RunCMD extends PlatformRunCmd { - run(): Promise { - throw new Error("Method not implemented."); - } - -} - -class AndroidRunCMD extends PlatformRunCmd { - run(): Promise { - throw new Error("Method not implemented."); - } - -} \ No newline at end of file diff --git a/native/tools/cocos-console/bin/strings.json b/native/tools/cocos-console/bin/strings.json deleted file mode 100644 index 685ae24ac5..0000000000 --- a/native/tools/cocos-console/bin/strings.json +++ /dev/null @@ -1,1038 +0,0 @@ -{ - "en" : { - "COCOS_PARSE_PLUGIN_WARNING_FMT" : "Warning: plugin '%s' does not return a plugin name.", - "COCOS_HELP_BRIEF_FMT" : "\n%s %s - cocos console: A command line tool for cocos2d-x.", - "COCOS_HELP_AVAILABLE_CMD" : "\nAvailable commands:", - "COCOS_HELP_AVAILABLE_ARGS_FMT" : "\nAvailable arguments:\n\t-h, --help\t\t\tShow this help information.\n\t-v, --version\t\t\tShow the version of this command tool.\n\t--ol %s\tSpecify the language of output messages.\n\t--env\t\t\t\tSpecify the environment values.", - "COCOS_HELP_EXAMPLE" : "\nExample:\n\tcocos new --help\n\tcocos run --help", - "COCOS_HELP_ARG_SRC" : "Specify the path of the project.", - "COCOS_HELP_ARG_QUIET" : "Less output", - "COCOS_HELP_ARG_PLATFORM" : "Specify the target platform.", - "COCOS_HELP_ARG_PROJ_DIR" : "Specify the directory for target platform.", - "COCOS_HELP_ARG_ENV" : "Specify environment variables.", - "COCOS_ERROR_OL_NO_VALUE" : "Please specify the value of argument '--ol'.", - "COCOS_ERROR_ENV_NO_VALUE" : "Please specify the value of argument '--env'.", - "COCOS_WARNING_LANG_NOT_SUPPORT_FMT" : "Language '%s' is not support now.", - "COCOS_PYTHON_VERSION_TIP_FMT" : "The python version is %d.%d. But Python 2.7 is required.\nDownload it here: https://www.python.org/", - "COCOS_WARNING_INVALID_DIR_IN_INI_FMT" : "Warning: Invalid directory defined in cocos2d.ini: %s", - "COCOS_WARNING_INVALID_MODE_FMT" : "Warning: Invalid cocos2d-x mode: %s. Using 'source' as default.", - "COCOS_DEBUG_RUNNING_CMD_FMT" : "running: '%s'\n", - "COCOS_ERROR_RUNNING_CMD" : "Error running command.", - "COCOS_ERROR_RUNNING_CMD_RET_FMT" : "Error running command, return code: %s.", - "COCOS_ERROR_CHECK_LOG_FMT" : "Check the log file at %s", - "COCOS_WARNING_ENGINE_NOT_FOUND" : "Warning: cocos2d-x path not found.", - "COCOS_INFO_CHECK_TEMPLATE_PATH_FAILED_FMT" : "Check templates path %s failed:", - "COCOS_INFO_RUNNING_PLUGIN_FMT" : "Running command: %s", - "COCOS_ERROR_CMD_NOT_FOUND_FMT" : "Error: argument '%s' not found.\nTry with cocos -h", - "COCOS_ERROR_TEMPLATE_NOT_FOUND" : "Template path not found.", - "COCOS_ERROR_PROJECT_NOT_FOUND" : "No directory supplied and found no project at your current directory.\nYou can set the folder as a parameter with \"-s\" or \"--src\",\nor change your current working directory somewhere inside the project.\n(-h for the usage)", - "COCOS_ERROR_UNKNOWN_PLATFORM_FMT" : "Unknown platform: %s", - "COCOS_ERROR_INVALID_DEPENDENCY_FMT" : "Plugin '%s' lists non existant plugin '%s' as dependency.", - "COCOS_ERROR_ENV_NOT_DEFINED_FMT" : "%s not defined. Please define it in your environment.", - "COCOS_ERROR_XCODE_NOT_INSTALLED" : "Xcode wasn't installed.", - "PROJECT_CFG_NOT_FOUND_FMT" : "%s is not found.", - "PROJECT_CFG_BROKEN_FMT" : "Configuration file %s is broken!", - "PROJECT_CFG_PARSE_FAILED_FMT" : "Parse configuration in file '%s' failed.", - "PROJECT_CFG_GET_VALUE_FAILED_FMT" : "Can't get value of '%s' in file '%s'.", - "PROJECT_CFG_INVALID_LANG_FMT" : "The value of '%s' must be one of (%s)", - "PROJECT_INVALID_PLATFORM_FMT" : "Current available platforms : %s. '%s' is not available.", - "PROJECT_NO_AVAILABLE_PLATFORMS" : "There isn't any available platforms.", - "PROJECT_SPECIFY_PLATFORM_FMT" : "The target platform is not specified.\nYou can specify a target platform with '-p' or '--platform'.\nAvailable platforms : %s", - "PROJECT_INFO_FOUND_CUSTOM_STEP_FMT" : "Find custom step script: %s.", - "PROJECT_WARNING_CUSTOM_SCRIPT_NOT_FOUND_FMT" : "Can't find custom step script %s", - "PROJECT_WARNING_CUSTOM_STEP_FAILED_FMT" : "Custom step invoke failed: %s", - "DEPLOY_BRIEF" : "Compile and deploy a project to a device/simulator.", - "DEPLOY_ARG_MODE" : "Set the deploy mode, should be debug|release, default is debug.", - "DEPLOY_ARG_INSTANT_GAME" : "Indicate to deploy a Google Instant Game", - "DEPLOY_ERROR_XAPCMD_NOT_FOUND" : "XapDeployCmd.exe not found, can't deploy the application.", - "DEPLOY_INFO_FIND_XAP_FMT" : "Find xap deployment tools in registry : %s", - "DEPLOY_INFO_INSTALLING_APK" : "Installing on device", - "DEPLOY_INFO_MODE_FMT" : "Deploying mode: %s", - "RUN_BRIEF" : "Compiles, deploy and run project on the target.", - "RUN_ARG_MODE" : "Set the run mode, should be debug|release, default is debug.", - "RUN_ARG_GROUP_WEB" : "web project arguments", - "RUN_ARG_BROWSER" : "Specify the browser to open the url. Use the system default browser if not specified.", - "RUN_ARG_NO_CONSOLE" : "Disable simulator console window (by passing command line arguments '-console no' to simulator) for Windows, Mac and Linux.", - "RUN_ARG_WORKING_DIR" : "Specify simulator working directory for Windows, Mac and Linux (by passing command line arguments '-workdir \"\"' to simulator).", - "RUN_ARG_INSTANT_GAME" : "Indicate to run a Google Instant Game", - "RUN_ARG_LAUNCH_URL" : "Launch url property for Google Instant Game", - "RUN_ARG_PARAM" : "after Specify the browser to open the url, add the browser param.", - "RUN_ARG_PORT" : "Set the port of the local web server, defualt is 8000", - "RUN_ARG_HOST" : "Set the host of the local web server, defualt is 127.0.0.1", - "RUN_WARNING_IOS_FOR_DEVICE_FMT" : "The generated app is for device. Can't run it on simulator.\nThe signed app & ipa are generated in path : %s", - "RUN_INFO_HOST_PORT_FMT" : "Try start server on %s:%d", - "RUN_WARNING_SERVER_FAILED_FMT" : "Start server %s:%d error : %s", - "RUN_INFO_SERVING_FMT" : "Serving HTTP on %s, port %s ...", - "RUN_INFO_START_APP" : "Starting application.", - "RUN_ERROR_START_SERVER_FAILED" : "Start server failed.", - "NEW_BRIEF" : "Creates a new project.", - "NEW_ARG_NAME" : "Set the project name.", - "NEW_ARG_PACKAGE" : "Set a package name for project.", - "NEW_ARG_LANG" : "Major programming language you want to use, should be [cpp | lua | js]", - "NEW_ARG_DIR" : "Set the path where to place the new project.", - "NEW_ARG_TEMPLATE" : "Set the template name you want create from.", - "NEW_ARG_IOS_BUNDLEID" : "Set a bundle id for iOS project.", - "NEW_ARG_MAC_BUNDLEID" : "Set a bundle id for Mac project.", - "NEW_ARG_ENGINE_PATH" : "Set the path of engine.", - "NEW_ARG_PORTRAIT" : "Set the project be portrait.", - "NEW_ARG_GROUP_SCRIPT" : "lua/js project arguments", - "NEW_ARG_NO_NATIVE" : "Create the project without native support.", - "NEW_TEMPLATE_NOT_FOUND_FMT" : "Template named '%s' is not found.", - "NEW_SELECT_TEMPLATE_TIP1" : "Multiple templates detected!\nYou can select one via -t arguments.\nOr choose one now:\n", - "NEW_SELECT_TEMPLATE_TIP2" : "Select one (input number and press enter):", - "NEW_INFO_STEP_COPY_TEMPLATE_FMT" : "> Copy template into %s", - "NEW_WARNING_STEP_NOT_FOUND_FMT" : "WARNING: Can't find step %s.", - "NEW_ERROR_STEP_NOT_FOUND_FMT" : "Fatal: creating step '%s' is not found", - "NEW_INFO_STEP_COPY_H5" : "> Copying cocos2d-html5 files...", - "NEW_INFO_STEP_COPY_X" : "> Copying cocos2d-x files...", - "NEW_INFO_STEP_APPEND_TEMPLATE" : "> Copying files from template directory...", - "NEW_INFO_STEP_APPEND_DIR" : "> Copying directory from cocos root directory...", - "NEW_INFO_STEP_APPEND_FILE" : "> Copying files from cocos root directory...", - "NEW_INFO_STEP_RENAME_PROJ_FMT" : "> Rename project name from '%s' to '%s'", - "NEW_WARNING_FILE_NOT_FOUND_FMT" : "%s is not found.", - "NEW_INFO_STEP_REPLACE_PROJ_FMT" : "> Replace the project name from '%s' to '%s'", - "NEW_INFO_STEP_REPLACE_PKG_FMT" : "> Replace the project package name from '%s' to '%s'", - "NEW_INFO_STEP_IOS_BUNDLEID_FMT" : "> Replace the iOS bundle id from '%s' to '%s'", - "NEW_INFO_STEP_MAC_BUNDLEID_FMT" : "> Replace the Mac bundle id from '%s' to '%s'", - "NEW_INFO_STEP_MODIFY_FILE" : "> Modify files by re.sub()", - "NEW_WARNING_NOT_A_FILE_FMT" : "%s is not a file.", - "NEW_ERROR_FOLDER_EXISTED_FMT" : "Fatal: %s folder is already exist.", - "NEW_ERROR_ENGINE_TIP_FMT" : "You can specify the path of %s by argument '-e'.", - "NEW_ERROR_TEMPLATE_NOT_FOUND_FMT" : "Fatal: can't find any template for <%s> language.\n%s", - "NEW_ERROR_DEFAILT_CFG_NOT_FOUND_FMT" : "Fatal: the '%s' dosen't has 'do_default' creating step.", - "NEW_ERROR_CMD_NOT_FOUND_FMT" : "Method '%s' is not found.", - "NEW_ERROR_PKG_NAME_NOT_SPECIFIED" : "Package name not specified.", - "LUACOMPILE_BRIEF" : "Encrypt and/or compile lua files.", - "LUACOMPILE_ARG_VERBOSE" : "Verbose output.", - "LUACOMPILE_ARG_SRC" : "Source directory of lua files needed to be compiled, supports mutiple source directories.", - "LUACOMPILE_ARG_DST" : "Destination directory of output files to be stored.", - "LUACOMPILE_ARG_ENCRYPT" : "Whether or not to encrypt.", - "LUACOMPILE_ARG_ENCRYPT_KEY" : "The key for encrypt.", - "LUACOMPILE_ARG_ENCRYPT_SIGN" : "The sign for encrypt.", - "LUACOMPILE_ARG_DISABLE_COMPILE" : "Not compile the lua files to bytecode.", - "LUACOMPILE_DEBUG_COMPILE_FILE_FMT" : "Compiling lua (%s) to bytecode...", - "LUACOMPILE_INFO_PROCESS_FILE" : "Processing lua script files", - "LUACOMPILE_WARNING_TIP_MSG" : "By using luacompile, you could precompile the Lua script files to the bytecode files and encrypt the Lua script files or the bytecode files by XXTEA.\nThe mechanism of generating the bytecode files is based on the LuaJIT v2.0.3, so the generated bytecode files cann't be used on the 64-bit iOS devices.", - "LUACOMPILE_INFO_FINISHED" : "Compilation finished.", - "LUACOMPILE_ERROR_TOOL_NOT_FOUND" : "Can't find right luajit for current system.", - "LUACOMPILE_ERROR_SRCDIR_NAME_NOT_FOUND" : "Can't find src directory in file path.", - "LUACOMPILE_ERROR_MKDIR_FAILED_FMT" : "Error: create directory %s failed.", - "LUACOMPILE_ERROR_SRC_NOT_SPECIFIED" : "Error: Please set source folder by '-s' or '--src'.", - "LUACOMPILE_ERROR_DST_NOT_SPECIFIED" : "Error: Please set destination folder by '-d' or '--dst'.", - "LUACOMPILE_ERROR_DIR_NOT_EXISTED_FMT" : "Error: %s is not existed.", - "JSCOMPILE_BRIEF" : "Compile and/or compress js files.", - "JSCOMPILE_ARG_SRC" : "Source directory of js files needed to be compiled, supports mutiple source directory.", - "JSCOMPILE_ARG_DST" : "Destination directory of js bytecode files to be stored.", - "JSCOMPILE_ARG_CLOSURE" : "Whether to use closure compiler to compress all js files into just a big file.", - "JSCOMPILE_ARG_OUT_FILE_NAME" : "Specify the output file name of the compressed big file. Only available when '-c' option is used.", - "JSCOMPILE_ARG_JSON_FILE" : "The configuration for closure compiler by using JSON, please refer to compiler_config_sample.json.", - "JSCOMPILE_ARG_EXTRA_PARAM" : "Extra parameters to pass to Google Closure Compiler. Values supplied here override the ones defined in the compiler config.", - "JSCOMPILE_DEBUG_COMPILE_FILE_FMT" : "Compiling js (%s) to bytecode...", - "JSCOMPILE_INFO_COMPRESS_TIP" : "Compressing js files into one file.", - "JSCOMPILE_INFO_COMPILE_TO_BYTECODE" : "Compiling js files to bytecode.", - "JSCOMPILE_ERROR_SRC_NOT_SPECIFIED" : "Error: Please set source folder by '-s' or '--src'.", - "COMPILE_BRIEF" : "Compile projects to binary.", - "COMPILE_ARG_MODE" : "Set the compiling mode, should be debug|release, default is debug.", - "COMPILE_ARG_JOBS" : "Allow N jobs at once.", - "COMPILE_ARG_OUTPUT" : "Specify the output directory.", - "COMPILE_ARG_GROUP_ANDROID" : "Android Options", - "COMPILE_ARG_AP" : "Specify the Android platform used for building Android apk.", - "COMPILE_ARG_NDK_MODE" : "Set the compiling mode of ndk-build, should be debug|release|none, native code will not be compiled when the value is none. Default is same value with '-m'.", - "COMPILE_ARG_APP_ABI" : "Set the APP_ABI of ndk-build.Can be multi value separated with ':'. Sample : --app-abi armeabi:x86:mips. Default value is 'armeabi'.", - "COMPILE_ARG_TOOLCHAIN" : "Specify the NDK_TOOLCHAIN of ndk-build.", - "COMPILE_ARG_CPPFLAGS" : "Specify the APP_CPPFLAGS of ndk-build.", - "COMPILE_ARG_STUDIO" : "Use the Android Studio project for Android platform.", - "COMPILE_ARG_NO_APK" : "Not generate the apk file.", - "COMPILE_ARG_INSTANT_GAME" : "Indicate to compile a Google Instant Game project", - "COMPILE_ARG_XCWORKSPACE" : "Use Xcode workspace project to compile or run", - "COMPILE_ARG_GROUP_WIN" : "Windows Options", - "COMPILE_ARG_VS" : "Specify the Visual Studio version will be used. Such as: 2013. Default find available version automatically.", - "COMPILE_ARG_GROUP_WEB" : "Web Options", - "COMPILE_ARG_SOURCE_MAP" : "Enable source-map", - "COMPILE_ARG_ADVANCE" : "Compile all source js files using Closure Compiler's advanced mode, bigger compression ratio bug more risk.", - "COMPILE_ARG_GROUP_IOS_MAC" : "iOS/Mac Options", - "COMPILE_ARG_TARGET" : "Specify the target name to be compiled.", - "COMPILE_ARG_GROUP_IOS" : "iOS Options", - "COMPILE_ARG_IOS_SIGN" : "The code sign identity for iOS.", - "COMPILE_ARG_GROUP_LUA_JS" : "lua/js project Options", - "COMPILE_ARG_NO_RES" : "Package without project resources.", - "COMPILE_ARG_COMPILE_SCRIPT" : "Diable/Enable the compiling of lua/js script files.", - "COMPILE_ARG_GROUP_LUA" : "lua project Options", - "COMPILE_ARG_LUA_ENCRYPT" : "Enable the encrypting of lua scripts.", - "COMPILE_ARG_LUA_ENCRYPT_KEY" : "Specify the encrypt key for the encrypting of lua scripts.", - "COMPILE_ARG_LUA_ENCRYPT_SIGN" : "Specify the encrypt sign for the encrypting of lua scripts.", - "COMPILE_DETECT_CPU_FAILED" : "Failed to detect number of cpus, assume 1 cpu.", - "COMPILE_INFO_BUILD_NATIVE" : "Building native...", - "COMPILE_INFO_BUILD_APK" : "Building apk...", - "COMPILE_INFO_BUILD_SUCCEED" : "Build succeed.", - "COMPILE_INFO_IOS_SIGN_FMT" : "Code Sign Identity: %s", - "COMPILE_INFO_BUILDING" : "Building...", - "COMPILE_INFO_FIND_IN_REG_FMT" : "Finding VS in registry : %s", - "COMPILE_INFO_REQUIRED_VS_FMT" : "Required VS version : %s", - "COMPILE_ERROR_WRONG_MODE_FMT" : "Value of '-m' should be one of %s.", - "COMPILE_ERROR_WRONG_NDK_MODE_FMT" : "Value of '--ndk-mode' should be one of %s.", - "COMPILE_ERROR_WRONG_VS_VER_FMT" : "VS %d is not supported.", - "COMPILE_ERROR_LOW_VS_VER" : "Version of VS is too low.", - "COMPILE_ERROR_MSDBUILD_NOT_FOUND" : "MSBuild is not found.", - "COMPILE_ERROR_UNKNOWN_ANDROID_SDK_TOOLS_VERSION" : "Unknown Android SDK Tools version!", - "COMPILE_INFO_FIND_VS_PATH_FMT" : "Find VS path : %s", - "COMPILE_INFO_DEVENV_NOT_FOUND" : "Not found devenv. Try to use msbuild instead.", - "COMPILE_INFO_FIND_MSBUILD_FMT" : "Found msbuild path: %s", - "COMPILE_INFO_COPYING_FMT" : "Copying %s", - "COMPILE_WARNING_NOT_SUPPORT_COMPILE_SCRIPT" : "Warning: Now script compiling is not supported for linux.", - "COMPILE_INFO_BUILD_MODE_FMT" : "Building mode: %s", - "COMPILE_WARNING_NDK_VERSION" : "The NDK version is not r10c or above.\nYour application may crash or freeze on Android L(5.0) when using BMFont and HttpClient.\nFor More information:\nhttps://github.com/cocos2d/cocos2d-x/issues/9114\nhttps://github.com/cocos2d/cocos2d-x/issues/9138\n", - "COMPILE_WARNING_TOOLCHAIN_FMT" : "Your application may crash when using c++ 11 regular expression with NDK_TOOLCHAIN_VERSION %s", - "COMPILE_ERROR_NDK_BUILD_FAILED" : "Ndk build failed!", - "COMPILE_ERROR_UPDATE_XCODE" : "Update xcode please.", - "COMPILE_ERROR_XCODEPROJ_NOT_FOUND" : "Can't find the '.xcodeproj' file", - "COMPILE_ERROR_BUILD_ON_MAC" : "Please build on MacOSX.", - "COMPILE_ERROR_NO_IOS_TARGET" : "Can't find iOS target.", - "COMPILE_ERROR_BUILD_FAILED" : "Build failed: Take a look at the output above for details.", - "COMPILE_ERROR_NO_MAC_TARGET" : "Can't find Mac target.", - "COMPILE_ERROR_NO_MSBUILD" : "MSBuild is not installed yet!", - "COMPILE_ERROR_PARSE_SLN_FAILED" : "Can't parse the sln file to find required VS version.", - "COMPILE_ERROR_VS_NOT_FOUND" : "Can't find correct Visual Studio's path in the registry.", - "COMPILE_ERROR_BUILD_ON_WIN" : "Please build on winodws.", - "COMPILE_ERROR_CFG_NOT_FOUND_FMT" : "Must specified '%s' when '%s' is specified in file '%s'", - "COMPILE_ERROR_SLN_NOT_FOUND" : "Can't find the '.sln' file.", - "COMPILE_ERROR_BUILD_PATH_NOT_FOUND_FMT" : "Can not find the %s", - "COMPILE_ERROR_FILE_NOT_FOUND_FMT" : "%s is not found", - "COMPILE_ERROR_MANIFEST_PARSE_FAILED_FMT" : "Can't parse manifest file %s.", - "COMPILE_ERROR_NO_VALID_JDK" : "No valid JDK installed.", - "COMPILE_WARNING_GET_NDK_VER_FAILED_FMT" : "Parse NDK version from file %s failed.", - "COMPILE_WARNING_COMPILE_SDK_FMT" : "The value of compileSdkVersion is %s in file build.gradle, but %s is not found.", - "COMPILE_WARNING_BUILD_TOOLS_FMT" : "The value of buildToolsVersion is %s in file build.gradle, but %s is not found.", - "COMPILE_INFO_NDK_TOOLCHAIN_VER_FMT" : "NDK_TOOLCHAIN_VERSION: %s", - "COMPILE_INFO_NDK_MODE" : "NDK build mode: %s", - "COMPILE_INFO_AUTO_SELECT_AP" : "Android platform not specified, searching a default one...", - "COMPILE_INFO_MOVE_APK_FMT" : "Move apk to %s", - "COMPILE_INFO_NOT_A_FILE" : "The string inputed is not a file!", - "COMPILE_INFO_ANDROID_PROJPATH_FMT" : "Using %s project : %s", - "COMPILE_TIP_INPUT_KEYSTORE" : "Please input the absolute/relative path of '.keystore' file:", - "COMPILE_TIP_INPUT_ALIAS" : "Please input the alias:", - "COMPILE_TIP_INPUT_KEY_PASS" : "Please input the password of key store:", - "COMPILE_TIP_INPUT_ALIAS_PASS" : "Please input the password of alias:", - "COMPILE_ERROR_GRALEW_NOT_EXIST_FMT" : "%s is not existed.", - "COMPILE_ERROR_NOT_VALID_AP_FMT" : "%s is not a valid Android target platform.", - "COMPILE_ERROR_TARGET_NOT_FOUND_FMT" : "Can't find 'target' in file '%s'", - "COMPILE_ERROR_AP_TOO_LOW_FMT" : "The Android-platform of project '%s' should be equal/larger than %d, but %d is specified.", - "COMPILE_ERROR_AP_NOT_FOUND_FMT" : "Can't find right Android-platform for project : '%s'. The Android-platform should be equal/larger than %d.", - "COMPILE_ERROR_NO_AP_IN_SDK_FMT" : "The directory '%s' can't be found in Android SDK", - "COMPILE_ERROR_NOT_SPECIFY_OUTPUT" : "Not specified the output directory!", - "COMPILE_ERROR_PARSE_CFG_FAILED_FMT" : "Configuration file '%s' is not existed or broken!", - "GEN_LIBS_BRIEF" : "Generate prebuilt libs of engine. The libs will be placed in 'prebuilt' folder of the engine root path.", - "GEN_LIBS_ARG_CLEAN" : "Remove the 'prebuilt' folder at first.", - "GEN_LIBS_ARG_ENGINE" : "Specify the engine path. Default is the engine root path of current tools.", - "GEN_LIBS_ARG_PLATFORM" : "Specify the target platform. Can specify multi platform by using '-p' multi times. Default generate all available platforms.", - "GEN_LIBS_ARG_MODE" : "Generate cocos libs for debug or release. Default is release.", - "GEN_LIBS_ARG_DISABLE_STRIP" : "Disable the strip of the generated libs.", - "GEN_LIBS_GROUP_WIN" : "Windows Options", - "GEN_LIBS_ARG_VS" : "Specify the Visual Studio version, such as 2013. Default find available version automatically.", - "GEN_LIBS_GROUP_ANDROID" : "Android Options", - "GEN_LIBS_ARG_ABI" : "Set the APP_ABI of ndk-build. Can be multi value separated with ':'. Sample : --app-abi armeabi:x86:mips. Default value is 'armeabi'.", - "GEN_LIBS_ERROR_WRONG_PATH_FMT" : "%s is not a valid path.", - "GEN_LIBS_ERROR_WRONG_FILE_FMT" : "%s is not a valid config file.", - "GEN_LIBS_ERROR_PARSE_FILE_FMT" : "Parse %s failed.", - "GEN_LIBS_ERROR_KEY_NOT_FOUND_FMT" : "Key %s is not found in %s", - "GEN_LIBS_ERROR_NOT_SUPPORT_VS_FMT" : "Not support VS%d.", - "GEN_LIBS_WARNING_VS_NOT_FOUND_FMT" : "Not found VS%d", - "GEN_LIBS_ERROR_VS_NOT_FOUND" : "Not found available Visual Studio.", - "GEN_LIBS_ERROR_LIB_NOT_GEN_FMT" : "Library %s not generated as expected!", - "GEN_SIM_BRIEF" : "Generate Cocos Simulator.", - "GEN_SIM_ARG_CLEAN" : "Clean the output directory before generating. Will remove the output directory at first.", - "GEN_SIM_ARG_ENGINE" : "Specify the engine path. Default is the engine root path of current tools.", - "GEN_SIM_ARG_MODE" : "Generate simulator for debug or release. Default is debug.", - "GEN_SIM_ARG_OUTPUT" : "Where to save Cocos Simulator. Default is the 'simulator' folder in the root path of engine.", - "GEN_SIM_ARG_PLATFORM" : "Specify the target platform. Can specify multi platform by using '-p' multi times. Default generate all available platforms.", - "GEN_SIM_ARG_VS" : "Specify the Visual Studio version, such as 2013. Default find available version automatically.", - "GEN_SIM_ERROR_WRONG_PATH_FMT" : "%s is not a valid path.", - "GEN_SIM_ERROR_FILE_NOT_FOUND_FMT" : "Can not find %s", - "GEN_SIM_ROLL_BACK_FAIL_FMT" : "Roll back file %s failed.\nPlease rollback %s to %s manually.", - "GEN_SIM_BUILD_SUCCESS_FMT" : "Build %s %s success.\n", - "GEN_TEMP_BRIEF" : "Generate templates for Cocos Framework.", - "GEN_TEMP_ERROR_VER_NOT_FOUND_FMT" : "Can't find engine version in %s", - "GEN_TEMP_SAVE_XCODE_PROJ_FMT" : "Save xcode project %s", - "GEN_TEMP_SAVE_VS_PROJ_FMT" : "Save Visual Studio project %s", - "GEN_TEMP_SUCCESS_FMT" : "Templates for Cocos Framework have been generated in %s.\nThe new templates are named with format '[language]-template-binary'.", - "GEN_TEMP_UNKNOWN_LANGUAGE_FMT" : "Unknown program language of file %s", - "FRAMEWORK_BRIEF" : "Manage frameworks for the project.", - "FRAMEWORK_ERROR_TOO_FEW_ARGS" : "cocos framework: error: too few arguments", - "FRAMEWORK_ERROR_INVALID_CMD_FMT" : "Fatal: invalid command 'cocos framework %s'", - "FRAMEWORK_ADD_BRIEF" : "Adds a new framework to an existing project.", - "FRAMEWORK_ADD_ARG_NAME" : "Specifies the package name.", - "FRAMEWORK_CREATE_BRIEF" : "Creates a framework in an existing project.", - "FRAMEWORK_CREATE_ARG_NAME" : "Specifies the package name.", - "FRAMEWORK_REMOVE_BRIEF" : "Removes a framework from an existing project.", - "FRAMEWORK_REMOVE_ARG_NAME" : "Specifies the package name.", - "FRAMEWORK_SET_BRIEF" : "Setts install.json for a framework", - "FRAMEWORK_SET_ARG_NAME" : "Specifies the package name.", - "FRAMEWORK_UPDATE_BRIEF" : "Updates a framework from an existing project.", - "FRAMEWORK_UPDATE_ARG_NAME" : "Specifies the package name.", - "PACKAGE_BRIEF" : "Manage package for cocos.", - "PACKAGE_HELP" : "cocos package will fulfil your daily package needs.\n\nExample usage:\n\tcocos package search [package_name]\n\tcocos package info [package_name]\n\tcocos package install [package_name]\n\tcocos package list", - "PACKAGE_ERROR_INVALID_CMD_FMT" : "invalid command 'cocos package %s' \nuse cocos package -h for help", - "PACKAGE_SEARCH_BRIEF" : "Search packages by name.", - "PACKAGE_SEARCH_ARG_KEY" : "Specifies the package name.", - "PACKAGE_SEARCH_ERROR_NO_KEY_FMT" : "[PACKAGE] can't find package '%s'", - "PACKAGE_SEARCH_TIP_FMT" : "[PACKAGE] all the packages matching '%s'", - "PACKAGE_ITEM_FMT" : "[PACKAGE] > %s %s (%s)", - "PACKAGE_LIST_BRIEF" : "List all installed packages.", - "PACKAGE_LIST_NOT_FOUND" : "[PACKAGE] not found installed packages.", - "PACKAGE_LIST_TIP" : "[PACKAGE] installed packages:", - "PACKAGE_INSTALL_BRIEF" : "Install a package.", - "PACKAGE_INSTALL_ARG_NAME" : "Specifies the package name.", - "PACKAGE_INSTALL_ARG_FORCE" : "Ignore exists file, force to download zip from remote repo.", - "PACKAGE_INSTALL_ERROR_NO_PKG_FMT" : "Fatal: not found package '%s', version='%s'", - "PACKAGE_INFO_BRIEF" : "Search packages by keywords in remote repo", - "PACKAGE_INFO_ARG_NAME" : "Specifies the package name.", - "PACKAGE_INFO_ARG_VERSION" : "Specifies the package version.", - "PACKAGE_INFO_ERROR_NO_PKG_FMT" : "[PACKAGE] can't find package '%s', version='%s'", - "PACKAGE_INFO_PKG_FMT" : "[PACKAGE] > getting info for package '%s' ... ok\n\nname: %s\nversion: %s\nupdated: %s\nauthor: %s\nsize: %d KB\n\n%s\n", - "PACKAGE_ERROR_NOT_ZIP_FMT" : "%s is not a zip file.", - "PACKAGE_EXTRACT_TIP" : "==> Extracting files, please wait ...", - "PACKAGE_EXTRACT_END" : "==> Extraction done!", - "PACKAGE_READY_DOWNLOAD_FMT" : "==> Ready to download '%s' from '%s'", - "PACKAGE_ERROR_URL_FMT" : "==> Error: Could not find the file from url: '%s'", - "PACKAGE_ERROR_DOWNLOAD_FAILED_FMT" : "==> Http request failed, error code: %s, reason: %s", - "PACKAGE_START_DOWNLOAD" : "==> Start to download, please wait ...", - "PACKAGE_DOWNLOAD_PERCENT_FMT_1" : "Downloaded: %6dK / Total: %dK, Percent: %3.2f%%, Speed: %6.2f KB/S ", - "PACKAGE_DOWNLOAD_PERCENT_FMT_2" : "Downloaded: %6dK, Speed: %6.2f KB/S ", - "PACKAGE_DOWNLOAD_END" : "==> Downloading finished!", - "PACKAGE_EXISTS_FMT" : "==> '%s' exists, skip download.", - "PACKAGE_ERROR_UNKNOWN_FORMAT_FMT" : "==> Unrecognized zip format from your local '%s' file!", - "PACKAGE_ERROR_PATH_NOT_FOUND_FMT" : "ERROR: The path '%s' is not found!", - "PACKAGE_ERROR_READ_SLN" : "Read error: no *.sln file for platform 'win'", - "PACKAGE_ERROR_NOT_FOUND_PROJ" : "Not found project '%s' in *.sln for platform 'win'", - "PACKAGE_ERROR_JSON_READ_FAILED" : "File 'install.json' read error", - "PACKAGE_ERROR_JSON_ERROR" : "File 'install.json' has errors", - "PACKAGE_ERROR_NOT_FOUND_JSON" : "ERROR: Not found 'install.json'", - "PACKAGE_ERROR_WIN32_NOT_FOUND" : "This project not include proj.win32", - "PACKAGE_ERROR_NO_SLN_IN_WIN32" : "Not found *.sln in proj.win32", - "PACKAGE_ERROR_WRONG_DIR" : "Fatal: you must run 'cocos framework add' at project root dir.", - "PACKAGE_NOT_FOUND_PKG_FMT" : "[PACKAGE] Not found installed package '%s' to support the version of engine of project which is '%s'. Please execute command: 'cocos package install %s' to install the newest version of package.", - "PACKAGE_PROJ_PATH_FMT" : "[PROJECT] > project path: %s", - "PACKAGE_PROJ_TYPE_FMT" : "[PROJECT] > project type: %s", - "PACKAGE_PKG_ADDED_WARN_FMT" : "[PROJECT] > Package '%s' has been added. Please execute command: 'cocos framework update %s' to update it to new version.", - "PACKAGE_PROJ_UNKOWN_ENGINE" : "[PROJECT] > Fatal: Unknow version of engine", - "PACKAGE_PKG_ADD_FMT" : "[PROJECT] > Adding '%s %s (%s)' ...", - "PACKAGE_NO_PKG_FOUND" : "[PROJECT] > Not found any packages.", - "PACKAGE_PKG_NOT_FOUND_FMT" : "[PROJECT] > Not found package '%s'.", - "PACKAGE_PKG_REMOVE_FMT" : "[PROJECT] > Removing '%s' ...", - "PACKAGE_WORKDIR_FMT" : "[PACKAGE] workdir: %s", - "PACKAGE_PKG_REMOVE_OK" : "[PROJECT] > Remove OK", - "PACKAGE_PKG_IS_NEWEST_FMT" : "[PROJECT] > The package '%s' is local newest version. If there is newer version on PMR server, please execute command: 'cocos package install %s' to renew local version, and run update command again.", - "PACKAGE_PROJ_PKG_UPDATE_OK" : "[PROJECT] > Update OK", - "PACKAGE_ERROR_WITH_CODE_FMT" : "error: %s, code %s", - "PACKAGE_PKG_ADD_OK_FMT" : "[PACKAGE] add package '%s' ok.", - "PACKAGE_PKG_REMOVE_OK_FMT" : "[PACKAGE] remove package '%s' ok.", - "PACKAGE_PKG_UPDATE_OK_FMT" : "[PACKAGE] update '%s' ok.", - "PACKAGE_PKG_NOT_FOUND_PKG_FMT" : "Fatal: not found specified package '%s'", - "PACKAGE_PATH_EXISTED_FMT" : "ERROR: The path '%s' is exist!", - "PACKAGE_CREATE_OK_FMT" : "%s create OK", - "PACKAGE_UNABLE_COPY_FMT" : "ERROR: '%s' is not able to copy !", - "PACKAGE_MAC_NOT_FOUND" : "This project not include proj.ios_mac", - "PACKAGE_XCODE_PROJ_NOT_FOUND" : "Not found *.xcodeproj in proj.ios_mac", - "PACKAGE_VS_PROJ_NOT_FOUND" : "Not found *.vcxproj in proj.win32", - "PACKAGE_ANDROID_PROJ_NOT_FOUND" : "This project not include proj.android", - "PACKAGE_ANDROID_MK_NOT_FOUND" : "Not found Android.mk in proj.android/jni", - "PACKAGE_APPDELEGATE_NOT_FOUND" : "Not found AppDelegate.cpp in Classes/", - "PACKAGE_BUILD_CFG_NOT_FOUND" : "Not found build_cfg.json in proj.android/", - "PACKAGE_CMD_NOT_FOUND_FMT" : "Command %s is not found.", - "PACKAGE_ERROR_INVALID_PLATFORM_FMT" : "Invalid platform '%s'", - "PACKAGE_TAG_NOT_FOUND_FMT" : "Not found '%s' TAG in project for platform '%s'", - "PACKAGE_ENTRY_DECLARE_FAILED" : "Error for declare of entry function", - "PACKAGE_ERROR_IN_FILE_FMT" : "Error in file: %s", - "PACKAGE_WIN_PROJ_NOT_FOUND" : "Not found project file for platform 'win'", - "PACKAGE_NDK_MODULE_NOT_FOUND" : "Not found 'ndk_module_path' in build config file for platform 'Android'", - "PACKAGE_NOT_XCODE_PROJ_FMT" : "'%s' is not xcode project" - }, - "zh" : { - "COCOS_PARSE_PLUGIN_WARNING_FMT" : "警告:'%s' 不是可用的命令。", - "COCOS_HELP_BRIEF_FMT" : "\n%s %s - cocos console: cocos2d-x 的命令行工具集。", - "COCOS_HELP_AVAILABLE_CMD" : "\n可用的命令:", - "COCOS_HELP_AVAILABLE_ARGS_FMT" : "\n可用的参数:\n\t-h, --help\t\t\t显示帮助信息。\n\t-v, --version\t\t\t显示命令行工具的版本号。\n\t--ol %s\t指定输出信息的语言。\n\t--env\t\t\t\t指定环境变量。", - "COCOS_HELP_EXAMPLE" : "\n示例:\n\tcocos new --help\n\tcocos run --help", - "COCOS_HELP_ARG_SRC" : "指定工程路径。", - "COCOS_HELP_ARG_QUIET" : "较少的输出。", - "COCOS_HELP_ARG_PLATFORM" : "指定目标平台。", - "COCOS_HELP_ARG_PROJ_DIR" : "指定目标平台路径。", - "COCOS_HELP_ARG_ENV" : "指定环境变量。", - "COCOS_ERROR_OL_NO_VALUE" : "参数 '--ol' 未指定值。", - "COCOS_ERROR_ENV_NO_VALUE" : "参数 '--env' 未指定值。", - "COCOS_WARNING_LANG_NOT_SUPPORT_FMT" : "目前不支持 '%s' 语言。", - "COCOS_PYTHON_VERSION_TIP_FMT" : "当前 python 版本为:%d.%d。要求使用 Python 2.7。\n下载地址:https://www.python.org/", - "COCOS_WARNING_INVALID_DIR_IN_INI_FMT" : "警告:cocos2d.ini 中使用了无效的路径 %s", - "COCOS_WARNING_INVALID_MODE_FMT" : "警告:cocos2d.ini 中使用了无效的 cocos2d-x 模式'%s'。使用默认模式'source'。", - "COCOS_DEBUG_RUNNING_CMD_FMT" : "正在执行:'%s'\n", - "COCOS_ERROR_RUNNING_CMD" : "执行命令出错。", - "COCOS_ERROR_RUNNING_CMD_RET_FMT" : "执行命令出错,返回值:%s。", - "COCOS_ERROR_CHECK_LOG_FMT" : "查看日志文件 %s", - "COCOS_WARNING_ENGINE_NOT_FOUND" : "警告:无法找到 cocos2d-x 的路径。", - "COCOS_INFO_CHECK_TEMPLATE_PATH_FAILED_FMT" : "检查模板路径 %s 失败:", - "COCOS_INFO_RUNNING_PLUGIN_FMT" : "执行命令:%s", - "COCOS_ERROR_CMD_NOT_FOUND_FMT" : "错误:无效参数'%s'。\n请使用 cocos -h 查看帮助信息。", - "COCOS_ERROR_TEMPLATE_NOT_FOUND" : "找不到模板路径。", - "COCOS_ERROR_PROJECT_NOT_FOUND" : "未指定工程路径,且当前路径也不是有效的工程目录。\n可以通过'-s'或者'--src'指定工程路径,\n或者进入工程目录执行命令。\n(更多信息参考 -h 输出内容)", - "COCOS_ERROR_UNKNOWN_PLATFORM_FMT" : "未知的平台:%s", - "COCOS_ERROR_INVALID_DEPENDENCY_FMT" : "'%s'命令依赖了不存在的命令'%s'。", - "COCOS_ERROR_ENV_NOT_DEFINED_FMT" : "环境变量 %s 没有定义。", - "COCOS_ERROR_XCODE_NOT_INSTALLED" : "未安装 Xcode。", - "PROJECT_CFG_NOT_FOUND_FMT" : "未找到配置文件 %s", - "PROJECT_CFG_BROKEN_FMT" : "配置文件 %s 被损坏!", - "PROJECT_CFG_PARSE_FAILED_FMT" : "解析配置文件 '%s' 失败。", - "PROJECT_CFG_GET_VALUE_FAILED_FMT" : "无法获取配置 '%s'(配置文件:'%s')", - "PROJECT_CFG_INVALID_LANG_FMT" : "'%s' 的值必须是下列值之一:(%s)", - "PROJECT_INVALID_PLATFORM_FMT" : "当前可用的平台:%s。'%s' 不可用。", - "PROJECT_NO_AVAILABLE_PLATFORMS" : "没有可用的平台。", - "PROJECT_SPECIFY_PLATFORM_FMT" : "未指定平台。\n请使用 '-p' 或者 '--platform' 来指定。\n可用的平台有:%s", - "PROJECT_INFO_FOUND_CUSTOM_STEP_FMT" : "找到自定义步骤脚本:%s", - "PROJECT_WARNING_CUSTOM_SCRIPT_NOT_FOUND_FMT" : "找不到自定义步骤脚本:%s", - "PROJECT_WARNING_CUSTOM_STEP_FAILED_FMT" : "调用自定义步骤失败:%s", - "DEPLOY_BRIEF" : "编译并在设备或模拟器上部署工程。", - "DEPLOY_ARG_MODE" : "设置部署模式,可选值为 debug/release,默认值为 debug。", - "DEPLOY_ERROR_XAPCMD_NOT_FOUND" : "找不到 XapDeployCmd.exe,无法安装应用。", - "DEPLOY_INFO_FIND_XAP_FMT" : "在 %s 注册表中查找 xap 部署工具。", - "DEPLOY_INFO_INSTALLING_APK" : "正在安装应用程序。", - "DEPLOY_INFO_MODE_FMT" : "部署模式:%s", - "RUN_BRIEF" : "在设备或者模拟器上编译,部署和运行工程。", - "RUN_ARG_MODE" : "设置运行模式,可选值为 debug/release,默认值为 debug。", - "RUN_ARG_GROUP_WEB" : "web 工程可用参数", - "RUN_ARG_BROWSER" : "设置指定浏览器打开 url。如果未指定使用系统默认浏览器。", - "RUN_ARG_NO_CONSOLE" : "关闭 Windows,Mac 和 Linux 下的模拟器控制台窗口(传入命令行参数 '-console no' 给模拟器)。", - "RUN_ARG_WORKING_DIR" : "指定 Windows,Mac 和 Linux 下模拟器运行的工作目录(传入命令行参数 '-workdir \"\"' 给模拟器)。", - "RUN_ARG_PARAM" : "在设置指定浏览器打开后,添加上特殊参数。", - "RUN_ARG_PORT" : "设置本地服务器的端口,默认值为 8000", - "RUN_ARG_HOST" : "设置本地服务器的主机地址,默认值为 127.0.0.1", - "RUN_WARNING_IOS_FOR_DEVICE_FMT" : "生成的 app 只适用于 iOS 真机。\napp 和 ipa 存放路径:%s", - "RUN_INFO_HOST_PORT_FMT" : "尝试启动服务器 %s:%d", - "RUN_WARNING_SERVER_FAILED_FMT" : "启动服务器 %s:%d 失败:%s", - "RUN_INFO_SERVING_FMT" : "HTTP 服务已启动,主机:%s,端口:%s ...", - "RUN_INFO_START_APP" : "启动应用。", - "RUN_ERROR_START_SERVER_FAILED" : "启动服务器失败。", - "NEW_BRIEF" : "创建一个新的工程。", - "NEW_ARG_NAME" : "设置工程名称。", - "NEW_ARG_PACKAGE" : "设置工程的包名。", - "NEW_ARG_LANG" : "设置工程使用的编程语言,可选值:[cpp | lua | js]", - "NEW_ARG_DIR" : "设置工程存放路径。", - "NEW_ARG_TEMPLATE" : "设置使用的模板名称。", - "NEW_ARG_IOS_BUNDLEID" : "设置工程的 iOS Bundle ID。", - "NEW_ARG_MAC_BUNDLEID" : "设置工程的 Mac Bundle ID。", - "NEW_ARG_ENGINE_PATH" : "设置引擎路径。", - "NEW_ARG_PORTRAIT" : "设置工程为竖屏。", - "NEW_ARG_GROUP_SCRIPT" : "lua/js 工程可用参数", - "NEW_ARG_NO_NATIVE" : "设置新建的工程不包含 C++ 代码与各平台工程。", - "NEW_TEMPLATE_NOT_FOUND_FMT" : "未找到 '%s' 模板。", - "NEW_SELECT_TEMPLATE_TIP1" : "检测到多个模板。\n可以通过 -t 参数指定模板。\n或者选择一个:\n", - "NEW_SELECT_TEMPLATE_TIP2" : "输入你选择的数字,然后按回车:", - "NEW_INFO_STEP_COPY_TEMPLATE_FMT" : "> 拷贝模板到 %s", - "NEW_WARNING_STEP_NOT_FOUND_FMT" : "警告:配置文件中找不到 %s 的定义。", - "NEW_ERROR_STEP_NOT_FOUND_FMT" : "错误:配置文件中找不到 %s 的定义。", - "NEW_INFO_STEP_COPY_H5" : "> 拷贝 cocos2d-html5 ...", - "NEW_INFO_STEP_COPY_X" : "> 拷贝 cocos2d-x ...", - "NEW_INFO_STEP_APPEND_TEMPLATE" : "> 拷贝模板中的文件夹...", - "NEW_INFO_STEP_APPEND_DIR" : "> 拷贝引擎中的文件夹...", - "NEW_INFO_STEP_APPEND_FILE" : "> 拷贝引擎中的文件...", - "NEW_INFO_STEP_RENAME_PROJ_FMT" : "> 替换文件名中的工程名称,'%s' 替换为 '%s'。", - "NEW_WARNING_FILE_NOT_FOUND_FMT" : "找不到 %s", - "NEW_INFO_STEP_REPLACE_PROJ_FMT" : "> 替换文件中的工程名称,'%s' 替换为 '%s'。", - "NEW_INFO_STEP_REPLACE_PKG_FMT" : "> 替换工程的包名,'%s' 替换为 '%s'。", - "NEW_INFO_STEP_IOS_BUNDLEID_FMT" : "> 替换 iOS 工程的 Bundle ID,'%s' 替换为 '%s'。", - "NEW_INFO_STEP_MAC_BUNDLEID_FMT" : "> 替换 Mac 工程的 Bundle ID,'%s' 替换为 '%s'。", - "NEW_INFO_STEP_MODIFY_FILE" : "> 使用 re.sub() 修改文件内容。", - "NEW_WARNING_NOT_A_FILE_FMT" : "%s 不是有效的文件。", - "NEW_ERROR_FOLDER_EXISTED_FMT" : "错误:文件夹 %s 已经存在", - "NEW_ERROR_ENGINE_TIP_FMT" : "可以使用 -e 参数指定 %s 的路径。", - "NEW_ERROR_TEMPLATE_NOT_FOUND_FMT" : "错误:找不到 <%s> 模板。\n%s", - "NEW_ERROR_DEFAILT_CFG_NOT_FOUND_FMT" : "错误:'%s' 没有配置 'do_default' 数据。", - "NEW_ERROR_CMD_NOT_FOUND_FMT" : "未找到 '%s' 函数。", - "NEW_ERROR_PKG_NAME_NOT_SPECIFIED" : "未指定包名。", - "LUACOMPILE_BRIEF" : "对 lua 文件进行加密和编译为字节码的处理。", - "LUACOMPILE_ARG_VERBOSE" : "更多输出信息。", - "LUACOMPILE_ARG_SRC" : "指定需要编译的 lua 文件路径,支持指定多个路径。", - "LUACOMPILE_ARG_DST" : "指定输出文件的路径。", - "LUACOMPILE_ARG_ENCRYPT" : "开启 XXTEA 加密功能。", - "LUACOMPILE_ARG_ENCRYPT_KEY" : "指定 XXTEA 加密功能的 key 字段。", - "LUACOMPILE_ARG_ENCRYPT_SIGN" : "指定 XXTEA 加密功能的 sign 字段。", - "LUACOMPILE_ARG_DISABLE_COMPILE" : "关闭编译为字节码的功能。", - "LUACOMPILE_DEBUG_COMPILE_FILE_FMT" : "正在将 %s 编译为字节码...", - "LUACOMPILE_INFO_PROCESS_FILE" : "正在处理 lua 文件。", - "LUACOMPILE_WARNING_TIP_MSG" : "通过 luacompile 命令对 lua 文件进行 XXTEA 加密以及编译为字节码的处理。\n编译为字节码的功能基于 LuaJIT v2.0.3,所以目前编译成字节码的文件不适用于 iOS 64位设备。", - "LUACOMPILE_INFO_FINISHED" : "编译完成。", - "LUACOMPILE_ERROR_TOOL_NOT_FOUND" : "无法找到适用于当前系统的 luajit。", - "LUACOMPILE_ERROR_SRCDIR_NAME_NOT_FOUND" : "在文件路径中找不到源目录。", - "LUACOMPILE_ERROR_MKDIR_FAILED_FMT" : "错误:创建文件夹 %s 失败。", - "LUACOMPILE_ERROR_SRC_NOT_SPECIFIED" : "错误:请通过 '-s' 或者 '--src' 参数设置 lua 文件路径。", - "LUACOMPILE_ERROR_DST_NOT_SPECIFIED" : "错误:请通过 '-d' 或者 '--dst' 参数设置生成文件的存放路径。", - "LUACOMPILE_ERROR_DIR_NOT_EXISTED_FMT" : "错误:%s 不存在。", - "JSCOMPILE_BRIEF" : "对 js 文件进行加密和压缩处理。", - "JSCOMPILE_ARG_SRC" : "指定需要编译的 js 文件路径,支持指定多个路径。", - "JSCOMPILE_ARG_DST" : "指定输出文件的路径。", - "JSCOMPILE_ARG_CLOSURE" : "使用 closure 编译器将所有 js 文件压缩为一个大的文件。", - "JSCOMPILE_ARG_OUT_FILE_NAME" : "指定压缩为一个大的 js 文件名称。只有当使用了 '-c' 参数时起效。", - "JSCOMPILE_ARG_JSON_FILE" : "指定 json 格式的 closure 编译器配置,请参考 compiler_config_sample.json。", - "JSCOMPILE_ARG_EXTRA_PARAM" : "传给 closure 编译器的扩展参数。会覆盖 closure 编译器的已有配置。", - "JSCOMPILE_DEBUG_COMPILE_FILE_FMT" : "正在将 %s 编译为字节码...", - "JSCOMPILE_INFO_COMPRESS_TIP" : "正在将所有 js 文件压缩为一个文件...", - "JSCOMPILE_INFO_COMPILE_TO_BYTECODE" : "正在处理 js 文件。", - "JSCOMPILE_ERROR_SRC_NOT_SPECIFIED" : "错误:请通过 '-s' 或者 '--src' 参数设置 js 文件路径。", - "COMPILE_BRIEF" : "编译并打包工程。", - "COMPILE_ARG_MODE" : "设置编译模式,可选值为 debug|release,默认值为 debug。", - "COMPILE_ARG_JOBS" : "指定使用几个 cpu 进行编译。", - "COMPILE_ARG_OUTPUT" : "指定输出文件的路径。", - "COMPILE_ARG_GROUP_ANDROID" : "Android 相关参数", - "COMPILE_ARG_AP" : "指定编译 Android 工程所需使用的目标平台。", - "COMPILE_ARG_NDK_MODE" : "设置 ndk-build 的模式,可选值为 debug|release|none,如果指定为 none,ndk-build 不会被调用。默认值与 '-m' 参数值相同。", - "COMPILE_ARG_APP_ABI" : "设置 ndk-build 的 APP_ABI 属性。可以使用 ':' 分隔多个值。示例:--app-abi armeabi:x86:mips。默认值为 'armeabi'。", - "COMPILE_ARG_TOOLCHAIN" : "指定 ndk-build 的 NDK_TOOLCHAIN 属性。", - "COMPILE_ARG_CPPFLAGS" : "指定 ndk-build 的 APP_CPPFLAGS 属性。", - "COMPILE_ARG_STUDIO" : "使用 Android Studio 工程来编译 Android 平台。", - "COMPILE_ARG_NO_APK" : "不生成 apk 文件。", - "COMPILE_ARG_INSTANT_GAME" : "编译 Google Instant 工程", - "COMPILE_ARG_XCWORKSPACE" : "使用 Xcode workspace 工程进行编译和运行", - "COMPILE_ARG_GROUP_WIN" : "Windows 相关参数", - "COMPILE_ARG_VS" : "指定编译所使用的 Visual Studio 版本。如:2013。默认自动查找可用版本。", - "COMPILE_ARG_GROUP_WEB" : "Web 相关参数", - "COMPILE_ARG_SOURCE_MAP" : "启用 source-map", - "COMPILE_ARG_ADVANCE" : "使用 closure 编译器的高级模式编译 js 文件,会获得更高的压缩率,但是有出现 bug 的风险。", - "COMPILE_ARG_GROUP_IOS_MAC" : "iOS/Mac 相关参数", - "COMPILE_ARG_TARGET" : "指定需要编译的 target。", - "COMPILE_ARG_GROUP_IOS" : "iOS 相关参数", - "COMPILE_ARG_IOS_SIGN" : "指定 iOS 的代码签名 ID。", - "COMPILE_ARG_GROUP_LUA_JS" : "lua/js 相关参数", - "COMPILE_ARG_NO_RES" : "指定生成的包中不包含工程资源文件。", - "COMPILE_ARG_COMPILE_SCRIPT" : "开启/关闭编译 lua/js 脚本文件的功能。", - "COMPILE_ARG_GROUP_LUA" : "lua 相关参数", - "COMPILE_ARG_LUA_ENCRYPT" : "开启 XXTEA 加密功能。", - "COMPILE_ARG_LUA_ENCRYPT_KEY" : "指定 XXTEA 加密功能的 key 字段。", - "COMPILE_ARG_LUA_ENCRYPT_SIGN" : "指定 XXTEA 加密功能的 sign 字段。", - "COMPILE_DETECT_CPU_FAILED" : "检测机器 cpu 数量失败,使用 1 个 cpu 进行编译。", - "COMPILE_INFO_BUILD_NATIVE" : "正在执行 ndk-build...", - "COMPILE_INFO_BUILD_APK" : "正在生成 apk 文件...", - "COMPILE_INFO_BUILD_SUCCEED" : "编译成功。", - "COMPILE_INFO_IOS_SIGN_FMT" : "代码签名 ID:%s", - "COMPILE_INFO_BUILDING" : "正在编译...", - "COMPILE_INFO_FIND_IN_REG_FMT" : "在 %s 注册表中查找 VS 安装路径。", - "COMPILE_INFO_REQUIRED_VS_FMT" : "要求的 VS 版本:%s", - "COMPILE_ERROR_WRONG_MODE_FMT" : "'-m' 参数取值范围:%s。", - "COMPILE_ERROR_WRONG_NDK_MODE_FMT" : "'--ndk-mode' 参数取值范围:%s。", - "COMPILE_ERROR_WRONG_VS_VER_FMT" : "不支持 VS %d。", - "COMPILE_ERROR_LOW_VS_VER" : "VS 版本过低。", - "COMPILE_ERROR_MSDBUILD_NOT_FOUND" : "未找到 MSBuild 工具。", - "COMPILE_ERROR_UNKNOWN_ANDROID_SDK_TOOLS_VERSION" : "无法识别 Android SDK Tools 版本.", - "COMPILE_INFO_FIND_VS_PATH_FMT" : "找到 VS 安装路径:%s", - "COMPILE_INFO_DEVENV_NOT_FOUND" : "未找到 devenv。尝试使用 msbuild 来代替。", - "COMPILE_INFO_FIND_MSBUILD_FMT" : "找到 msbuild 安装路径:%s", - "COMPILE_INFO_COPYING_FMT" : "正在拷贝:%s", - "COMPILE_WARNING_NOT_SUPPORT_COMPILE_SCRIPT" : "警告:linux 系统暂不支持脚本编译功能。", - "COMPILE_INFO_BUILD_MODE_FMT" : "编译模式:%s", - "COMPILE_WARNING_NDK_VERSION" : "NDK 版本低于 r10c。\n程序中如果使用了 BMFont 和 HttpClient,在 Android 5.0 的设备上可能出现崩溃或卡死的情况。\n请参考:\nhttps://github.com/cocos2d/cocos2d-x/issues/9114\nhttps://github.com/cocos2d/cocos2d-x/issues/9138\n", - "COMPILE_WARNING_TOOLCHAIN_FMT" : "NDK_TOOLCHAIN_VERSION 为 %s,程序中如果使用了 c++ 11 正则表达式,可能会崩溃。", - "COMPILE_ERROR_NDK_BUILD_FAILED" : "NDK 编译失败!", - "COMPILE_ERROR_UPDATE_XCODE" : "请更新 XCode 版本。", - "COMPILE_ERROR_XCODEPROJ_NOT_FOUND" : "未找到 '.xcodeproj' 文件。", - "COMPILE_ERROR_BUILD_ON_MAC" : "请使用 MacOSX 进行编译。", - "COMPILE_ERROR_NO_IOS_TARGET" : "未找到 iOS target。", - "COMPILE_ERROR_BUILD_FAILED" : "编译失败:请从上面的输出中查看错误细节。", - "COMPILE_ERROR_NO_MAC_TARGET" : "未找到 Mac target。", - "COMPILE_ERROR_NO_MSBUILD" : "未安装 MSBuild", - "COMPILE_ERROR_PARSE_SLN_FAILED" : "无法通过解析 sln 文件获取依赖的 VS 版本。", - "COMPILE_ERROR_VS_NOT_FOUND" : "无法从注册表中找到可用的 VS 安装路径。", - "COMPILE_ERROR_BUILD_ON_WIN" : "请使用 windows 进行编译。", - "COMPILE_ERROR_CFG_NOT_FOUND_FMT" : "'%s'必须设置,因为 '%s' 在 '%s' 文件中配置了。", - "COMPILE_ERROR_SLN_NOT_FOUND" : "未找到 '.sln' 文件。", - "COMPILE_ERROR_BUILD_PATH_NOT_FOUND_FMT" : "未找到 %s", - "COMPILE_ERROR_FILE_NOT_FOUND_FMT" : "未找到 %s", - "COMPILE_ERROR_MANIFEST_PARSE_FAILED_FMT" : "无法解析 manifest 文件 %s", - "COMPILE_ERROR_NO_VALID_JDK" : "没有安装可用的 JDK。", - "COMPILE_WARNING_GET_NDK_VER_FAILED_FMT" : "从 %s 文件获取 NDK 版本失败。", - "COMPILE_WARNING_COMPILE_SDK_FMT" : "build.gradle 文件中 compileSdkVersion 的值为 %s,但是文件夹 %s 不存在。", - "COMPILE_WARNING_BUILD_TOOLS_FMT" : "build.gradle 文件中 buildToolsVersion 的值为 %s,但是文件夹 %s 不存在。", - "COMPILE_INFO_NDK_TOOLCHAIN_VER_FMT" : "NDK_TOOLCHAIN_VERSION: %s", - "COMPILE_INFO_NDK_MODE" : "NDK 编译模式:%s", - "COMPILE_INFO_AUTO_SELECT_AP" : "未指定 Android 目标平台版本,自动查找一个可用版本...", - "COMPILE_INFO_MOVE_APK_FMT" : "正在移动 apk 文件 %s", - "COMPILE_INFO_NOT_A_FILE" : "输入的路径不是一个有效的文件。", - "COMPILE_INFO_ANDROID_PROJPATH_FMT" : "使用 %s 工程:%s", - "COMPILE_TIP_INPUT_KEYSTORE" : "请输入 '.keystore' 文件的绝对路径(相对路径):", - "COMPILE_TIP_INPUT_ALIAS" : "请输入签名文件的别名:", - "COMPILE_TIP_INPUT_KEY_PASS" : "请输入签名文件的密码:", - "COMPILE_TIP_INPUT_ALIAS_PASS" : "请输入别名的密码:", - "COMPILE_ERROR_GRALEW_NOT_EXIST_FMT" : "文件 %s 不存在。", - "COMPILE_ERROR_NOT_VALID_AP_FMT" : "%s 不是一个有效的 Android 目标平台。", - "COMPILE_ERROR_TARGET_NOT_FOUND_FMT" : "在 '%s' 文件中未找到 'target'。", - "COMPILE_ERROR_AP_TOO_LOW_FMT" : "'%s' 工程的 Android 目标平台版本应该大于等于 %d,但是指定的值为 %d。", - "COMPILE_ERROR_AP_NOT_FOUND_FMT" : "未找到工程 '%s' 可用的 Android 目标平台。 Android 目标平台版本应该大于或等于 %d。", - "COMPILE_ERROR_NO_AP_IN_SDK_FMT" : "在 Android SDK 中未找到文件夹 '%s'。", - "COMPILE_ERROR_NOT_SPECIFY_OUTPUT" : "未指定输出路径。", - "COMPILE_ERROR_PARSE_CFG_FAILED_FMT" : "配置文件 '%s' 不存在或者已损坏。", - "GEN_LIBS_BRIEF" : "生成引擎的预编译库。生成的库文件会保存在引擎根目录的 'prebuilt' 文件夹。", - "GEN_LIBS_ARG_CLEAN" : "生成预编译库之前先删除 'prebuilt' 文件夹。", - "GEN_LIBS_ARG_ENGINE" : "指定引擎文件夹。默认值为当前工具所在的引擎根目录。", - "GEN_LIBS_ARG_PLATFORM" : "指定需要编译的目标平台。可以通过多个 '-p' 参数指定编译多个目标平台。\n默认编译所有可用的目标平台。", - "GEN_LIBS_ARG_MODE" : "指定使用 debug 或者 release 模式来生成预编译库。默认值为 release。", - "GEN_LIBS_ARG_DISABLE_STRIP" : "关闭生成预编译库的 strip 功能。", - "GEN_LIBS_GROUP_WIN" : "Windows 相关参数", - "GEN_LIBS_ARG_VS" : "指定使用的 Visual Studio 版本,例如 2013。默认自动查找可用的版本。", - "GEN_LIBS_GROUP_ANDROID" : "Android 相关参数", - "GEN_LIBS_ARG_ABI" : "设置 ndk-build 的 APP_ABI 属性。可以使用 ':' 分隔多个值。示例:--app-abi armeabi:x86:mips。默认值为 'armeabi'。", - "GEN_LIBS_ERROR_WRONG_PATH_FMT" : "%s 不是有效的路径。", - "GEN_LIBS_ERROR_WRONG_FILE_FMT" : "%s 不是有效的配置文件。", - "GEN_LIBS_ERROR_PARSE_FILE_FMT" : "%s 文件解析失败。", - "GEN_LIBS_ERROR_KEY_NOT_FOUND_FMT" : "未找到配置 %s(配置文件 %s)。", - "GEN_LIBS_ERROR_NOT_SUPPORT_VS_FMT" : "目前不支持 VS%d。", - "GEN_LIBS_WARNING_VS_NOT_FOUND_FMT" : "未找到 VS%d。", - "GEN_LIBS_ERROR_VS_NOT_FOUND" : "未找到可用的 Visual Studio。", - "GEN_LIBS_ERROR_LIB_NOT_GEN_FMT" : "库文件 %s 未生成。", - "GEN_SIM_BRIEF" : "生成 Cocos 模拟器。", - "GEN_SIM_ARG_CLEAN" : "生成之前清除输出目录。会完全删除输出目录。", - "GEN_SIM_ARG_ENGINE" : "指定引擎文件夹。默认值为当前工具所在的引擎根目录。", - "GEN_SIM_ARG_MODE" : "指定使用 debug 或者 release 模式来生成模拟器。默认值为 debug。", - "GEN_SIM_ARG_OUTPUT" : "指定模拟器的输出目录。默认值为引擎根目录下的 'simulator' 文件夹。", - "GEN_SIM_ARG_PLATFORM" : "指定需要编译的目标平台。可以通过多个 '-p' 参数指定编译多个目标平台。\n默认编译所有可用的目标平台。", - "GEN_SIM_ARG_VS" : "指定使用的 Visual Studio 版本,例如 2013。默认自动查找可用的版本。", - "GEN_SIM_ERROR_WRONG_PATH_FMT" : "%s 不是有效的路径。", - "GEN_SIM_ERROR_FILE_NOT_FOUND_FMT" : "无法找到 %s。", - "GEN_SIM_ROLL_BACK_FAIL_FMT" : "回退文件 %s 失败。\n请手动将 %s 文件拷贝到 %s。", - "GEN_SIM_BUILD_SUCCESS_FMT" : "生成 %s %s 成功。\n", - "GEN_TEMP_BRIEF" : "生成用于 Cocos Framework 环境的模板。", - "GEN_TEMP_ERROR_VER_NOT_FOUND_FMT" : "无法在 %s 中找到引擎版本信息。", - "GEN_TEMP_SAVE_XCODE_PROJ_FMT" : "保存 Xcode 工程文件 %s", - "GEN_TEMP_SAVE_VS_PROJ_FMT" : "保存 Visual Studio 工程文件 %s", - "GEN_TEMP_SUCCESS_FMT" : "Cocos Framework 模板已生成在 %s 文件夹。\n生成的模板命名格式为 '[language]-template-binary'。", - "GEN_TEMP_UNKNOWN_LANGUAGE_FMT" : "文件 %s 未检测出编程语言。", - "FRAMEWORK_BRIEF" : "管理工程使用的 frameworks。", - "FRAMEWORK_ERROR_TOO_FEW_ARGS" : "错误:参数过少", - "FRAMEWORK_ERROR_INVALID_CMD_FMT" : "错误:无效的命令 'cocos framework %s'", - "FRAMEWORK_ADD_BRIEF" : "为已有工程添加一个 framework。", - "FRAMEWORK_ADD_ARG_NAME" : "指定 framework 的名称。", - "FRAMEWORK_CREATE_BRIEF" : "为已有工程创建一个 framework。", - "FRAMEWORK_CREATE_ARG_NAME" : "指定 framework 的名称。", - "FRAMEWORK_REMOVE_BRIEF" : "移除工程中使用的 framework。", - "FRAMEWORK_REMOVE_ARG_NAME" : "指定 framework 的名称。", - "FRAMEWORK_SET_BRIEF" : "为一个 framework 设置 install.json。", - "FRAMEWORK_SET_ARG_NAME" : "指定 framework 的名称。", - "FRAMEWORK_UPDATE_BRIEF" : "更新工程中已有的 framework。", - "FRAMEWORK_UPDATE_ARG_NAME" : "指定 framework 的名称。", - "PACKAGE_BRIEF" : "管理 cocos 中的 package。", - "PACKAGE_HELP" : "cocos package 可以为你提供开发所需的各种资源。\n\n示例:\n\tcocos package search [package_name]\n\tcocos package info [package_name]\n\tcocos package install [package_name]\n\tcocos package list", - "PACKAGE_ERROR_INVALID_CMD_FMT" : "无效的命令 'cocos package %s'\n通过 cocos package -h 查看更多帮助信息。", - "PACKAGE_SEARCH_BRIEF" : "通过名称查找 package", - "PACKAGE_SEARCH_ARG_KEY" : "指定 package 名称", - "PACKAGE_SEARCH_ERROR_NO_KEY_FMT" : "[PACKAGE] 未找到 package '%s'", - "PACKAGE_SEARCH_TIP_FMT" : "[PACKAGE] 匹配 '%s' 的所有 package:", - "PACKAGE_ITEM_FMT" : "[PACKAGE] > %s %s (%s)", - "PACKAGE_LIST_BRIEF" : "列出所有已安装的 package。", - "PACKAGE_LIST_NOT_FOUND" : "[PACKAGE] 未安装 package", - "PACKAGE_LIST_TIP" : "[PACKAGE] 安装的 package:", - "PACKAGE_INSTALL_BRIEF" : "安装一个 package", - "PACKAGE_INSTALL_ARG_NAME" : "指定 package 名称", - "PACKAGE_INSTALL_ARG_FORCE" : "忽略已有文件,强制下载新的 zip 文件。", - "PACKAGE_INSTALL_ERROR_NO_PKG_FMT" : "错误:未找到 package '%s', 版本号'%s'", - "PACKAGE_INFO_BRIEF" : "从服务器查找 package。", - "PACKAGE_INFO_ARG_NAME" : "指定 package 名称", - "PACKAGE_INFO_ARG_VERSION" : "指定 package 版本", - "PACKAGE_INFO_ERROR_NO_PKG_FMT" : "[PACKAGE] 未找到 package '%s', 版本号'%s'", - "PACKAGE_INFO_PKG_FMT" : "[PACKAGE] > 获取 package '%s' 的信息 ... 成功\n\n名称:%s\n版本:%s\n更新时间:%s\n作者:%s\n大小:%d KB\n\n%s\n", - "PACKAGE_ERROR_NOT_ZIP_FMT" : "%s 不是 zip 文件。", - "PACKAGE_EXTRACT_TIP" : "==> 解压中,请稍候...", - "PACKAGE_EXTRACT_END" : "==> 解压完成!", - "PACKAGE_READY_DOWNLOAD_FMT" : "==> 准备好下载 '%s'(来源:'%s')", - "PACKAGE_ERROR_URL_FMT" : "==> 错误:未找到文件,出错的 url:'%s'", - "PACKAGE_ERROR_DOWNLOAD_FAILED_FMT" : "==> Http 请求失败,错误码:%s,出错原因:%s", - "PACKAGE_START_DOWNLOAD" : "==> 开始下载,请稍候...", - "PACKAGE_DOWNLOAD_PERCENT_FMT_1" : "已下载:%6dK / 全部:%dK,百分比:%3.2f%%,速度:%6.2f KB/S ", - "PACKAGE_DOWNLOAD_PERCENT_FMT_2" : "已下载:%6dK,速度:%6.2f KB/S ", - "PACKAGE_DOWNLOAD_END" : "==> 下载完成!", - "PACKAGE_EXISTS_FMT" : "==> '%s' 已存在,跳过下载。", - "PACKAGE_ERROR_UNKNOWN_FORMAT_FMT" : "==> 未识别的 zip 格式文件 '%s'!", - "PACKAGE_ERROR_PATH_NOT_FOUND_FMT" : "错误:路径 '%s' 未找到。", - "PACKAGE_ERROR_READ_SLN" : "错误:未找到 win 平台的 *.sln 文件。", - "PACKAGE_ERROR_NOT_FOUND_PROJ" : "在 *.sln 文件中未找到工程 '%s'", - "PACKAGE_ERROR_JSON_READ_FAILED" : "读取 'install.json' 文件失败。", - "PACKAGE_ERROR_JSON_ERROR" : "文件 'install.json' 格式错误。", - "PACKAGE_ERROR_NOT_FOUND_JSON" : "错误:未找到 'install.json'", - "PACKAGE_ERROR_WIN32_NOT_FOUND" : "工程中没有 proj.win32 文件夹。", - "PACKAGE_ERROR_NO_SLN_IN_WIN32" : "proj.win32 文件夹中未找到 *.sln 文件。", - "PACKAGE_ERROR_WRONG_DIR" : "错误:必须在工程的根目录调用 'cocos framework add'。", - "PACKAGE_NOT_FOUND_PKG_FMT" : "[PACKAGE] 在本机未找到支持当前工程所使用的引擎版本的 package '%s'。需要支持的引擎版本为 '%s'。请先运行命令: 'cocos package install %s' 将最新版本的 package 安装到本地。", - "PACKAGE_PROJ_PATH_FMT" : "[PROJECT] > 工程路径:%s", - "PACKAGE_PROJ_TYPE_FMT" : "[PROJECT] > 工程类型:%s", - "PACKAGE_PKG_ADDED_WARN_FMT" : "[PROJECT] > Package '%s' 已经被添加。更新其版本请运行命令: 'cocos framework update %s' 。", - "PACKAGE_PROJ_UNKOWN_ENGINE" : "[PROJECT] > 错误:无法识别引擎版本", - "PACKAGE_PKG_ADD_FMT" : "[PROJECT] > 增加 '%s %s (%s)' ...", - "PACKAGE_NO_PKG_FOUND" : "[PROJECT] > 未找到任何 package", - "PACKAGE_PKG_NOT_FOUND_FMT" : "[PROJECT] > 未找到 package '%s'.", - "PACKAGE_PKG_REMOVE_FMT" : "[PROJECT] > 移除 '%s' ...", - "PACKAGE_WORKDIR_FMT" : "[PACKAGE] 工作目录:%s", - "PACKAGE_PKG_REMOVE_OK" : "[PROJECT] > 移除成功", - "PACKAGE_PKG_IS_NEWEST_FMT" : "[PROJECT] > package '%s' 已经是本机的最新版本。如果 PMR 服务器上有更新版本, 请运行命令: 'cocos package install %s' 更新本机版本后再升级 package。", - "PACKAGE_PROJ_PKG_UPDATE_OK" : "[PROJECT] > 升级成功", - "PACKAGE_ERROR_WITH_CODE_FMT" : "错误:%s,错误码:%s", - "PACKAGE_PKG_ADD_OK_FMT" : "[PACKAGE] 增加 package '%s' 成功。", - "PACKAGE_PKG_REMOVE_OK_FMT" : "[PACKAGE] 移除 package '%s' 成功。", - "PACKAGE_PKG_UPDATE_OK_FMT" : "[PACKAGE] 升级 '%s' 成功。", - "PACKAGE_PKG_NOT_FOUND_PKG_FMT" : "错误:未找到 package '%s'", - "PACKAGE_PATH_EXISTED_FMT" : "错误:路径 '%s' 已存在!", - "PACKAGE_CREATE_OK_FMT" : "%s 创建成功。", - "PACKAGE_UNABLE_COPY_FMT" : "错误:'%s' 不可拷贝!", - "PACKAGE_MAC_NOT_FOUND" : "工程中未找到 proj.ios_mac 文件夹。", - "PACKAGE_XCODE_PROJ_NOT_FOUND" : "proj.ios_mac 文件夹中未找到 *.xcodeproj。", - "PACKAGE_VS_PROJ_NOT_FOUND" : "proj.win32 文件夹中未找到 *.vcxproj。", - "PACKAGE_ANDROID_PROJ_NOT_FOUND" : "工程中未找到 proj.android 文件夹。", - "PACKAGE_ANDROID_MK_NOT_FOUND" : "proj.android/jni 文件夹中未找到 Android.mk。", - "PACKAGE_APPDELEGATE_NOT_FOUND" : "Classes 文件夹中未找到 AppDelegate.cpp。", - "PACKAGE_BUILD_CFG_NOT_FOUND" : "proj.android 文件夹中未找到 build_cfg.json。", - "PACKAGE_CMD_NOT_FOUND_FMT" : "未找到命令 %s", - "PACKAGE_ERROR_INVALID_PLATFORM_FMT" : "无效的平台 '%s'", - "PACKAGE_TAG_NOT_FOUND_FMT" : "工程文件中未找到 '%s' 标签(平台:'%s')", - "PACKAGE_ENTRY_DECLARE_FAILED" : "声明 entry 失败。", - "PACKAGE_ERROR_IN_FILE_FMT" : "文件 %s 格式错误。", - "PACKAGE_WIN_PROJ_NOT_FOUND" : "未找到 win 平台的工程文件。", - "PACKAGE_NDK_MODULE_NOT_FOUND" : "在 Android 平台的 build_cfg.json 文件中未找到 'ndk_module_path'。", - "PACKAGE_NOT_XCODE_PROJ_FMT" : "'%s' 不是一个 xcode 工程。" - }, - "zh_tr" : { - "COCOS_PARSE_PLUGIN_WARNING_FMT" : "警告:'%s' 不是可用的命令。", - "COCOS_HELP_BRIEF_FMT" : "\n%s %s - cocos console: cocos2d-x 的命令行工具集。", - "COCOS_HELP_AVAILABLE_CMD" : "\n可用的命令:", - "COCOS_HELP_AVAILABLE_ARGS_FMT" : "\n可用的參數:\n\t-h, --help\t\t\t顯示幫助資訊。\n\t-v, --version\t\t\t顯示命令行工具的版本號。\n\t--ol %s\t指定輸出資訊的語言。\n\t--env\t\t\t\t指定環境變量。", - "COCOS_HELP_EXAMPLE" : "\n示例:\n\tcocos new --help\n\tcocos run --help", - "COCOS_HELP_ARG_SRC" : "指定工程路徑。", - "COCOS_HELP_ARG_QUIET" : "較少的輸出。", - "COCOS_HELP_ARG_PLATFORM" : "指定目標平臺。", - "COCOS_HELP_ARG_PROJ_DIR" : "指定目標平臺路徑。", - "COCOS_HELP_ARG_ENV" : "指定環境變量。", - "COCOS_ERROR_OL_NO_VALUE" : "參數 '--ol' 未指定值。", - "COCOS_ERROR_ENV_NO_VALUE" : "參數 '--env' 未指定值。", - "COCOS_WARNING_LANG_NOT_SUPPORT_FMT" : "目前不支持 '%s' 語言。", - "COCOS_PYTHON_VERSION_TIP_FMT" : "當前 python 版本為:%d.%d。要求使用 Python 2.7。\n下載地址:https://www.python.org/", - "COCOS_WARNING_INVALID_DIR_IN_INI_FMT" : "警告:cocos2d.ini 中使用了無效的路徑 %s", - "COCOS_WARNING_INVALID_MODE_FMT" : "警告:cocos2d.ini 中使用了無效的 cocos2d-x 模式'%s'。使用默認模式'source'。", - "COCOS_DEBUG_RUNNING_CMD_FMT" : "正在執行:'%s'\n", - "COCOS_ERROR_RUNNING_CMD" : "執行命令出錯。", - "COCOS_ERROR_RUNNING_CMD_RET_FMT" : "執行命令出錯,返回值:%s。", - "COCOS_ERROR_CHECK_LOG_FMT" : "查看日誌檔案 %s", - "COCOS_WARNING_ENGINE_NOT_FOUND" : "警告:無法找到 cocos2d-x 的路徑。", - "COCOS_INFO_CHECK_TEMPLATE_PATH_FAILED_FMT" : "檢查範本路徑 %s 失敗:", - "COCOS_INFO_RUNNING_PLUGIN_FMT" : "執行命令:%s", - "COCOS_ERROR_CMD_NOT_FOUND_FMT" : "錯誤:無效參數'%s'。\n請使用 cocos -h 查看幫助資訊。", - "COCOS_ERROR_TEMPLATE_NOT_FOUND" : "找不到範本路徑。", - "COCOS_ERROR_PROJECT_NOT_FOUND" : "未指定工程路徑,且當前路徑也不是有效的工程目錄。\n可以通過'-s'或者'--src'指定工程路徑,\n或者進入工程目錄執行命令。\n(更多資訊參考 -h 輸出內容)", - "COCOS_ERROR_UNKNOWN_PLATFORM_FMT" : "未知的平臺:%s", - "COCOS_ERROR_INVALID_DEPENDENCY_FMT" : "'%s'命令依賴了不存在的命令'%s'。", - "COCOS_ERROR_ENV_NOT_DEFINED_FMT" : "環境變數 %s 沒有定義。", - "COCOS_ERROR_XCODE_NOT_INSTALLED" : "未安裝 Xcode。", - "PROJECT_CFG_NOT_FOUND_FMT" : "未找到配置檔案 %s", - "PROJECT_CFG_BROKEN_FMT" : "配置檔案 %s 被損壞!", - "PROJECT_CFG_PARSE_FAILED_FMT" : "解析配置檔案 '%s' 失敗。", - "PROJECT_CFG_GET_VALUE_FAILED_FMT" : "無法獲取配置 '%s'(配置檔案:'%s')", - "PROJECT_CFG_INVALID_LANG_FMT" : "'%s' 的值必須是下列值之一:(%s)", - "PROJECT_INVALID_PLATFORM_FMT" : "當前可用的平臺:%s。'%s' 不可用。", - "PROJECT_NO_AVAILABLE_PLATFORMS" : "沒有可用的平臺。", - "PROJECT_SPECIFY_PLATFORM_FMT" : "未指定平臺。\n請使用 '-p' 或者 '--platform' 來指定。\n可用的平臺有:%s", - "PROJECT_INFO_FOUND_CUSTOM_STEP_FMT" : "找到自定義步驟腳本:%s", - "PROJECT_WARNING_CUSTOM_SCRIPT_NOT_FOUND_FMT" : "找不到自定義步驟腳本:%s", - "PROJECT_WARNING_CUSTOM_STEP_FAILED_FMT" : "調用自定義步驟失敗:%s", - "DEPLOY_BRIEF" : "編譯並在設備或模擬器上部署工程。", - "DEPLOY_ARG_MODE" : "設置部署模式,可選值為 debug/release,默認值為 debug。", - "DEPLOY_ERROR_XAPCMD_NOT_FOUND" : "找不到 XapDeployCmd.exe,無法安裝應用。", - "DEPLOY_INFO_FIND_XAP_FMT" : "在 %s 註冊表中查找 xap 部署工具。", - "DEPLOY_INFO_INSTALLING_APK" : "正在安裝應用程式。", - "DEPLOY_INFO_MODE_FMT" : "部署模式:%s", - "RUN_BRIEF" : "在設備或者模擬器上編譯,部署和運行工程。", - "RUN_ARG_MODE" : "設置運行模式,可選值為 debug/release,默認值為 debug。", - "RUN_ARG_GROUP_WEB" : "web 工程可用參數", - "RUN_ARG_BROWSER" : "設置指定流覽器打開 url。如果未指定使用系統默認流覽器。", - "RUN_ARG_NO_CONSOLE" : "關閉 Windows,Mac 和 Linux 下的模擬器控制檯視窗(傳入命令行參數 '-console no' 给模擬器)。", - "RUN_ARG_WORKING_DIR" : "設定 Windows,Mac 和 Linux 下模擬器運行的工作目錄(傳入命令行參數 '-workdir \"\"' 给模擬器)。", - "RUN_ARG_PARAM" : "在設置指定流覽器打開 url 后并添加特殊參數", - "RUN_ARG_PORT" : "設置本地伺服器的端口,默認值為 8000", - "RUN_ARG_HOST" : "設置本地伺服器的主機地址,默認值為 127.0.0.1", - "RUN_WARNING_IOS_FOR_DEVICE_FMT" : "生成的 app 只適用於 iOS 真機。\napp 和 ipa 存放路徑:%s", - "RUN_INFO_HOST_PORT_FMT" : "嘗試啟動伺服器 %s:%d", - "RUN_WARNING_SERVER_FAILED_FMT" : "啟動伺服器 %s:%d 失敗:%s", - "RUN_INFO_SERVING_FMT" : "HTTP 服務已啟動,主機:%s,端口:%s ...", - "RUN_INFO_START_APP" : "啟動應用。", - "RUN_ERROR_START_SERVER_FAILED" : "啟動伺服器失敗。", - "NEW_BRIEF" : "創建一個新的工程。", - "NEW_ARG_NAME" : "設置工程名稱。", - "NEW_ARG_PACKAGE" : "設置工程的包名。", - "NEW_ARG_LANG" : "設置工程使用的編程語言,可選值:[cpp | lua | js]", - "NEW_ARG_DIR" : "設置工程存放路徑。", - "NEW_ARG_TEMPLATE" : "設置使用的範本名稱。", - "NEW_ARG_IOS_BUNDLEID" : "設置工程的 iOS Bundle ID。", - "NEW_ARG_MAC_BUNDLEID" : "設置工程的 Mac Bundle ID。", - "NEW_ARG_ENGINE_PATH" : "設置引擎路徑。", - "NEW_ARG_PORTRAIT" : "設置工程為豎屏。", - "NEW_ARG_GROUP_SCRIPT" : "lua/js 工程可用參數", - "NEW_ARG_NO_NATIVE" : "設置新建的工程不包含 C++ 代碼與各平臺工程。", - "NEW_TEMPLATE_NOT_FOUND_FMT" : "未找到 '%s' 範本。", - "NEW_SELECT_TEMPLATE_TIP1" : "檢測到多個範本。\n可以通過 -t 參數指定範本。\n或者選擇一個:\n", - "NEW_SELECT_TEMPLATE_TIP2" : "輸入你選擇的數字,然後按回車:", - "NEW_INFO_STEP_COPY_TEMPLATE_FMT" : "> 拷貝範本到 %s", - "NEW_WARNING_STEP_NOT_FOUND_FMT" : "警告:配置檔案中找不到 %s 的定義。", - "NEW_ERROR_STEP_NOT_FOUND_FMT" : "錯誤:配置檔案中找不到 %s 的定義。", - "NEW_INFO_STEP_COPY_H5" : "> 拷貝 cocos2d-html5 ...", - "NEW_INFO_STEP_COPY_X" : "> 拷貝 cocos2d-x ...", - "NEW_INFO_STEP_APPEND_TEMPLATE" : "> 拷貝範本中的檔案夾...", - "NEW_INFO_STEP_APPEND_DIR" : "> 拷貝引擎中的檔案夾...", - "NEW_INFO_STEP_APPEND_FILE" : "> 拷貝引擎中的檔案...", - "NEW_INFO_STEP_RENAME_PROJ_FMT" : "> 替換檔案案名中的工程名稱,'%s' 替換為 '%s'。", - "NEW_WARNING_FILE_NOT_FOUND_FMT" : "找不到 %s", - "NEW_INFO_STEP_REPLACE_PROJ_FMT" : "> 替換檔案中的工程名稱,'%s' 替換為 '%s'。", - "NEW_INFO_STEP_REPLACE_PKG_FMT" : "> 替換工程的包名,'%s' 替換為 '%s'。", - "NEW_INFO_STEP_IOS_BUNDLEID_FMT" : "> 替換 iOS 工程的 Bundle ID,'%s' 替換為 '%s'。", - "NEW_INFO_STEP_MAC_BUNDLEID_FMT" : "> 替換 Mac 工程的 Bundle ID,'%s' 替換為 '%s'。", - "NEW_INFO_STEP_MODIFY_FILE" : "> 使用 re.sub() 修改檔案內容。", - "NEW_WARNING_NOT_A_FILE_FMT" : "%s 不是有效的檔案。", - "NEW_ERROR_FOLDER_EXISTED_FMT" : "錯誤:檔案夾 %s 已經存在", - "NEW_ERROR_ENGINE_TIP_FMT" : "可以使用 -e 參數指定 %s 的路徑。", - "NEW_ERROR_TEMPLATE_NOT_FOUND_FMT" : "錯誤:找不到 <%s> 範本。\n%s", - "NEW_ERROR_DEFAILT_CFG_NOT_FOUND_FMT" : "錯誤:'%s' 沒有配置 'do_default' 數據。", - "NEW_ERROR_CMD_NOT_FOUND_FMT" : "未找到 '%s' 函數。", - "NEW_ERROR_PKG_NAME_NOT_SPECIFIED" : "未指定包名。", - "LUACOMPILE_BRIEF" : "對 lua 檔案進行加密和編譯為位元組碼的處理。", - "LUACOMPILE_ARG_VERBOSE" : "更多輸出資訊。", - "LUACOMPILE_ARG_SRC" : "指定需要編譯的 lua 檔案路徑,支持指定多個路徑。", - "LUACOMPILE_ARG_DST" : "指定輸出檔案的路徑。", - "LUACOMPILE_ARG_ENCRYPT" : "開啟 XXTEA 加密功能。", - "LUACOMPILE_ARG_ENCRYPT_KEY" : "指定 XXTEA 加密功能的 key 字段。", - "LUACOMPILE_ARG_ENCRYPT_SIGN" : "指定 XXTEA 加密功能的 sign 字段。", - "LUACOMPILE_ARG_DISABLE_COMPILE" : "關閉編譯為位元組碼的功能。", - "LUACOMPILE_DEBUG_COMPILE_FILE_FMT" : "正在將 %s 編譯為位元組碼...", - "LUACOMPILE_INFO_PROCESS_FILE" : "正在處理 lua 檔案。", - "LUACOMPILE_WARNING_TIP_MSG" : "通過 luacompile 命令對 lua 檔案進行 XXTEA 加密以及編譯為位元組碼的處理。\n編譯為位元組碼的功能基於 LuaJIT v2.0.3,所以目前編譯成位元組碼的檔案不適用於 iOS 64位設備。", - "LUACOMPILE_INFO_FINISHED" : "編譯完成。", - "LUACOMPILE_ERROR_TOOL_NOT_FOUND" : "無法找到適用於當前系統的 luajit。", - "LUACOMPILE_ERROR_SRCDIR_NAME_NOT_FOUND" : "在檔案路徑中找不到原始目錄。", - "LUACOMPILE_ERROR_MKDIR_FAILED_FMT" : "錯誤:創建檔案夾 %s 失敗。", - "LUACOMPILE_ERROR_SRC_NOT_SPECIFIED" : "錯誤:請通過 '-s' 或者 '--src' 參數設置 lua 檔案路徑。", - "LUACOMPILE_ERROR_DST_NOT_SPECIFIED" : "錯誤:請通過 '-d' 或者 '--dst' 參數設置生成檔案的存放路徑。", - "LUACOMPILE_ERROR_DIR_NOT_EXISTED_FMT" : "錯誤:%s 不存在。", - "JSCOMPILE_BRIEF" : "對 js 檔案進行加密和壓縮處理。", - "JSCOMPILE_ARG_SRC" : "指定需要編譯的 js 檔案路徑,支持指定多個路徑。", - "JSCOMPILE_ARG_DST" : "指定輸出檔案的路徑。", - "JSCOMPILE_ARG_CLOSURE" : "使用 closure 編譯器將所有 js 檔案壓縮為一個大的檔案。", - "JSCOMPILE_ARG_OUT_FILE_NAME" : "指定壓縮為一個大的 js 檔案案名稱。只有當使用了 '-c' 參數時起效。", - "JSCOMPILE_ARG_JSON_FILE" : "指定 json 格式的 closure 編譯器配置,請參考 compiler_config_sample.json。", - "JSCOMPILE_ARG_EXTRA_PARAM" : "傳給 closure 編譯器的擴展參數。會覆蓋 closure 編譯器的已有配置。", - "JSCOMPILE_DEBUG_COMPILE_FILE_FMT" : "正在將 %s 編譯為位元組碼...", - "JSCOMPILE_INFO_COMPRESS_TIP" : "正在將所有 js 檔案壓縮為一個檔案...", - "JSCOMPILE_INFO_COMPILE_TO_BYTECODE" : "正在處理 js 檔案。", - "JSCOMPILE_ERROR_SRC_NOT_SPECIFIED" : "錯誤:請通過 '-s' 或者 '--src' 參數設置 js 檔案路徑。", - "COMPILE_BRIEF" : "編譯並打包工程。", - "COMPILE_ARG_MODE" : "設置編譯模式,可選值為 debug|release,默認值為 debug。", - "COMPILE_ARG_JOBS" : "指定使用幾個 cpu 進行編譯。", - "COMPILE_ARG_OUTPUT" : "指定輸出檔案的路徑。", - "COMPILE_ARG_GROUP_ANDROID" : "Android 相關參數", - "COMPILE_ARG_AP" : "指定編譯 Android 工程所需使用的目標平臺。", - "COMPILE_ARG_NDK_MODE" : "設置 ndk-build 的模式,可選值為 debug|release|none,如果指定為 none,ndk-build 不會被調用。默認值與 '-m' 參數值相同。", - "COMPILE_ARG_APP_ABI" : "設置 ndk-build 的 APP_ABI 屬性。可以使用 ':' 分隔多個值。示例:--app-abi armeabi:x86:mips。默認值為 'armeabi'。", - "COMPILE_ARG_TOOLCHAIN" : "指定 ndk-build 的 NDK_TOOLCHAIN 屬性。", - "COMPILE_ARG_CPPFLAGS" : "指定 ndk-build 的 APP_CPPFLAGS 屬性。", - "COMPILE_ARG_STUDIO" : "使用 Android Studio 工程來編譯 Android 平臺。", - "COMPILE_ARG_NO_APK" : "不生成 apk 檔。", - "COMPILE_ARG_GROUP_WIN" : "Windows 相關參數", - "COMPILE_ARG_VS" : "編譯所使用的 Visual Studio 版本。如:2013。默認自動查找可用版本。", - "COMPILE_ARG_GROUP_WEB" : "Web 相關參數", - "COMPILE_ARG_SOURCE_MAP" : "啟用 source-map", - "COMPILE_ARG_ADVANCE" : "使用 closure 編譯器的高級模式編譯 js 檔案,會獲得更高的壓縮率,但是有出現 bug 的風險。", - "COMPILE_ARG_GROUP_IOS_MAC" : "iOS/Mac 相關參數", - "COMPILE_ARG_TARGET" : "指定需要編譯的 target。", - "COMPILE_ARG_GROUP_IOS" : "iOS 相關參數", - "COMPILE_ARG_IOS_SIGN" : "指定 iOS 的代碼簽名 ID。", - "COMPILE_ARG_GROUP_LUA_JS" : "lua/js 相關參數", - "COMPILE_ARG_NO_RES" : "指定生成的包中不包含工程資源檔案。", - "COMPILE_ARG_COMPILE_SCRIPT" : "開啟/關閉編譯 lua/js 腳本檔案的功能。", - "COMPILE_ARG_GROUP_LUA" : "lua 相關參數", - "COMPILE_ARG_LUA_ENCRYPT" : "開啟 XXTEA 加密功能。", - "COMPILE_ARG_LUA_ENCRYPT_KEY" : "指定 XXTEA 加密功能的 key 字段。", - "COMPILE_ARG_LUA_ENCRYPT_SIGN" : "指定 XXTEA 加密功能的 sign 字段。", - "COMPILE_DETECT_CPU_FAILED" : "檢測機器 cpu 數量失敗,使用 1 個 cpu 進行編譯。", - "COMPILE_INFO_BUILD_NATIVE" : "正在執行 ndk-build...", - "COMPILE_INFO_BUILD_APK" : "正在生成 apk 檔案...", - "COMPILE_INFO_BUILD_SUCCEED" : "編譯成功。", - "COMPILE_INFO_IOS_SIGN_FMT" : "代碼簽名 ID:%s", - "COMPILE_INFO_BUILDING" : "正在編譯...", - "COMPILE_INFO_FIND_IN_REG_FMT" : "在 %s 註冊表中查找 VS 安裝路徑。", - "COMPILE_INFO_REQUIRED_VS_FMT" : "要求的 VS 版本:%s", - "COMPILE_ERROR_WRONG_MODE_FMT" : "'-m' 參數取值範圍:%s。", - "COMPILE_ERROR_WRONG_NDK_MODE_FMT" : "'--ndk-mode' 參數取值範圍:%s。", - "COMPILE_ERROR_WRONG_VS_VER_FMT" : "不支持 VS %d。", - "COMPILE_ERROR_LOW_VS_VER" : "VS 版本過低。", - "COMPILE_ERROR_MSDBUILD_NOT_FOUND" : "未找到 MSBuild 工具。", - "COMPILE_ERROR_UNKNOWN_ANDROID_SDK_TOOLS_VERSION" : "無法識別 Android SDK Tools 版本!", - "COMPILE_INFO_FIND_VS_PATH_FMT" : "找到 VS 安裝路徑:%s", - "COMPILE_INFO_DEVENV_NOT_FOUND" : "未找到 devenv。嘗試使用 msbuild 來代替。", - "COMPILE_INFO_FIND_MSBUILD_FMT" : "找到 msbuild 安裝路徑:%s", - "COMPILE_INFO_COPYING_FMT" : "正在拷貝:%s", - "COMPILE_WARNING_NOT_SUPPORT_COMPILE_SCRIPT" : "警告:linux 系統暫不支持腳本編譯功能。", - "COMPILE_INFO_BUILD_MODE_FMT" : "編譯模式:%s", - "COMPILE_WARNING_NDK_VERSION" : "NDK 版本低於 r10c。\n程式中如果使用了 BMFont 和 HttpClient,在 Android 5.0 的設備上可能出現崩潰或卡死的情況。\n請參考:\nhttps://github.com/cocos2d/cocos2d-x/issues/9114\nhttps://github.com/cocos2d/cocos2d-x/issues/9138\n", - "COMPILE_WARNING_TOOLCHAIN_FMT" : "NDK_TOOLCHAIN_VERSION 為 %s,程式中如果使用了 c++ 11 正則運算式,可能會崩潰。", - "COMPILE_ERROR_NDK_BUILD_FAILED" : "NDK 編譯失敗!", - "COMPILE_ERROR_UPDATE_XCODE" : "請更新 XCode 版本。", - "COMPILE_ERROR_XCODEPROJ_NOT_FOUND" : "未找到 '.xcodeproj' 檔案。", - "COMPILE_ERROR_BUILD_ON_MAC" : "請使用 MacOSX 進行編譯。", - "COMPILE_ERROR_NO_IOS_TARGET" : "未找到 iOS target。", - "COMPILE_ERROR_BUILD_FAILED" : "編譯失敗:請從上面的輸出中查看錯誤細節。", - "COMPILE_ERROR_NO_MAC_TARGET" : "未找到 Mac target。", - "COMPILE_ERROR_NO_MSBUILD" : "未安裝 MSBuild", - "COMPILE_ERROR_PARSE_SLN_FAILED" : "無法通過解析 sln 檔案獲取依賴的 VS 版本。", - "COMPILE_ERROR_VS_NOT_FOUND" : "無法從註冊表中找到可用的 VS 安裝路徑。", - "COMPILE_ERROR_BUILD_ON_WIN" : "請使用 windows 進行編譯。", - "COMPILE_ERROR_CFG_NOT_FOUND_FMT" : "'%s'必須設置,因為 '%s' 在 '%s' 檔案中配置了。", - "COMPILE_ERROR_SLN_NOT_FOUND" : "未找到 '.sln' 檔案。", - "COMPILE_ERROR_BUILD_PATH_NOT_FOUND_FMT" : "未找到 %s", - "COMPILE_ERROR_FILE_NOT_FOUND_FMT" : "未找到 %s", - "COMPILE_ERROR_MANIFEST_PARSE_FAILED_FMT" : "無法解析 manifest 檔案 %s", - "COMPILE_ERROR_NO_VALID_JDK" : "沒有安裝可用的 JDK。", - "COMPILE_WARNING_GET_NDK_VER_FAILED_FMT" : "從 %s 檔案獲取 NDK 版本失敗。", - "COMPILE_WARNING_COMPILE_SDK_FMT" : "build.gradle 檔案中 compileSdkVersion 的值為 %s,但是檔案夾 %s 不存在。", - "COMPILE_WARNING_BUILD_TOOLS_FMT" : "build.gradle 檔案中 buildToolsVersion 的值為 %s,但是檔案夾 %s 不存在。", - "COMPILE_INFO_NDK_TOOLCHAIN_VER_FMT" : "NDK_TOOLCHAIN_VERSION: %s", - "COMPILE_INFO_NDK_MODE" : "NDK 編譯模式:%s", - "COMPILE_INFO_AUTO_SELECT_AP" : "未指定 Android 目標平臺版本,自動查找一個可用版本...", - "COMPILE_INFO_MOVE_APK_FMT" : "正在移動 apk 檔案 %s", - "COMPILE_INFO_NOT_A_FILE" : "輸入的路徑不是一個有效的檔案。", - "COMPILE_INFO_ANDROID_PROJPATH_FMT" : "使用 %s 工程:%s", - "COMPILE_TIP_INPUT_KEYSTORE" : "請輸入 '.keystore' 檔案的絕對路徑(相對路徑):", - "COMPILE_TIP_INPUT_ALIAS" : "請輸入簽名檔案的別名:", - "COMPILE_TIP_INPUT_KEY_PASS" : "請輸入簽名檔案的密碼:", - "COMPILE_TIP_INPUT_ALIAS_PASS" : "請輸入別名的密碼:", - "COMPILE_ERROR_GRALEW_NOT_EXIST_FMT" : "檔案 %s 不存在。", - "COMPILE_ERROR_NOT_VALID_AP_FMT" : "%s 不是一個有效的 Android 目標平臺。", - "COMPILE_ERROR_TARGET_NOT_FOUND_FMT" : "在 '%s' 檔案中未找到 'target'。", - "COMPILE_ERROR_AP_TOO_LOW_FMT" : "'%s' 工程的 Android 目標平臺版本應該大於等於 %d,但是指定的值為 %d。", - "COMPILE_ERROR_AP_NOT_FOUND_FMT" : "未找到工程 '%s' 可用的 Android 目標平臺。 Android 目標平臺版本應該大於或等於 %d。", - "COMPILE_ERROR_NO_AP_IN_SDK_FMT" : "在 Android SDK 中未找到檔案夾 '%s'。", - "COMPILE_ERROR_NOT_SPECIFY_OUTPUT" : "未指定輸出路徑。", - "COMPILE_ERROR_PARSE_CFG_FAILED_FMT" : "配置檔案 '%s' 不存在或者已損壞。", - "GEN_LIBS_BRIEF" : "生成引擎的預編譯庫。生成的庫檔會保存在引擎根目錄的 'prebuilt' 檔夾。", - "GEN_LIBS_ARG_CLEAN" : "生成預編譯庫之前先刪除 'prebuilt' 檔夾。", - "GEN_LIBS_ARG_ENGINE" : "指定引擎檔夾。默認值為當前工具所在的引擎根目錄。", - "GEN_LIBS_ARG_PLATFORM" : "指定需要編譯的目標平臺。可以通過多個 '-p' 參數指定編譯多個目標平臺。\n默認編譯所有可用的目標平臺。", - "GEN_LIBS_ARG_MODE" : "指定使用 debug 或者 release 模式來生成預編譯庫。默認值為 release。", - "GEN_LIBS_ARG_DISABLE_STRIP" : "關閉生成預編譯庫的 strip 功能。", - "GEN_LIBS_GROUP_WIN" : "Windows 相關參數", - "GEN_LIBS_ARG_VS" : "指定使用的 Visual Studio 版本,例如 2013。默認自動查找可用的版本。", - "GEN_LIBS_GROUP_ANDROID" : "Android 相關參數", - "GEN_LIBS_ARG_ABI" : "設置 ndk-build 的 APP_ABI 屬性。可以使用 ':' 分隔多個值。示例:--app-abi armeabi:x86:mips。默認值為 'armeabi'。", - "GEN_LIBS_ERROR_WRONG_PATH_FMT" : "%s 不是有效的路徑。", - "GEN_LIBS_ERROR_WRONG_FILE_FMT" : "%s 不是有效的配置檔。", - "GEN_LIBS_ERROR_PARSE_FILE_FMT" : "%s 檔解析失敗。", - "GEN_LIBS_ERROR_KEY_NOT_FOUND_FMT" : "未找到配置 %s(配置檔 %s)。", - "GEN_LIBS_ERROR_NOT_SUPPORT_VS_FMT" : "目前不支持 VS%d。", - "GEN_LIBS_WARNING_VS_NOT_FOUND_FMT" : "未找到 VS%d。", - "GEN_LIBS_ERROR_VS_NOT_FOUND" : "未找到可用的 Visual Studio。", - "GEN_LIBS_ERROR_LIB_NOT_GEN_FMT" : "庫檔 %s 未生成。", - "GEN_SIM_BRIEF" : "生成 Cocos 模擬器。", - "GEN_SIM_ARG_CLEAN" : "生成之前清除輸出目錄。會完全刪除輸出目錄。", - "GEN_SIM_ARG_ENGINE" : "指定引擎檔夾。默認值為當前工具所在的引擎根目錄。", - "GEN_SIM_ARG_MODE" : "指定使用 debug 或者 release 模式來生成模擬器。默認值為 debug。", - "GEN_SIM_ARG_OUTPUT" : "指定模擬器的輸出目錄。默認值為引擎根目錄下的 'simulator' 檔夾。", - "GEN_SIM_ARG_PLATFORM" : "指定需要編譯的目標平臺。可以通過多個 '-p' 參數指定編譯多個目標平臺。\n默認編譯所有可用的目標平臺。", - "GEN_SIM_ARG_VS" : "指定使用的 Visual Studio 版本,例如 2013。默認自動查找可用的版本。", - "GEN_SIM_ERROR_WRONG_PATH_FMT" : "%s 不是有效的路徑。", - "GEN_SIM_ERROR_FILE_NOT_FOUND_FMT" : "無法找到 %s。", - "GEN_SIM_ROLL_BACK_FAIL_FMT" : "回退檔 %s 失敗。\n請手動將 %s 檔拷貝到 %s。", - "GEN_SIM_BUILD_SUCCESS_FMT" : "生成 %s %s 成功。\n", - "GEN_TEMP_BRIEF" : "生成用於 Cocos Framework 環境的範本。", - "GEN_TEMP_ERROR_VER_NOT_FOUND_FMT" : "無法在 %s 中找到引擎版本資訊。", - "GEN_TEMP_SAVE_XCODE_PROJ_FMT" : "保存 Xcode 工程檔 %s", - "GEN_TEMP_SAVE_VS_PROJ_FMT" : "保存 Visual Studio 工程檔 %s", - "GEN_TEMP_SUCCESS_FMT" : "Cocos Framework 範本已生成在 %s 檔夾。\n生成的範本命名格式為 '[language]-template-binary'。", - "GEN_TEMP_UNKNOWN_LANGUAGE_FMT" : "檔 %s 未檢測出編程語言。", - "FRAMEWORK_BRIEF" : "管理工程使用的 frameworks。", - "FRAMEWORK_ERROR_TOO_FEW_ARGS" : "錯誤:參數過少", - "FRAMEWORK_ERROR_INVALID_CMD_FMT" : "錯誤:無效的命令 'cocos framework %s'", - "FRAMEWORK_ADD_BRIEF" : "為已有工程添加一個 framework。", - "FRAMEWORK_ADD_ARG_NAME" : "指定 framework 的名稱。", - "FRAMEWORK_CREATE_BRIEF" : "為已有工程創建一個 framework。", - "FRAMEWORK_CREATE_ARG_NAME" : "指定 framework 的名稱。", - "FRAMEWORK_REMOVE_BRIEF" : "移除工程中使用的 framework。", - "FRAMEWORK_REMOVE_ARG_NAME" : "指定 framework 的名稱。", - "FRAMEWORK_SET_BRIEF" : "為一個 framework 設置 install.json。", - "FRAMEWORK_SET_ARG_NAME" : "指定 framework 的名稱。", - "FRAMEWORK_UPDATE_BRIEF" : "更新工程中已有的 framework。", - "FRAMEWORK_UPDATE_ARG_NAME" : "指定 framework 的名稱。", - "PACKAGE_BRIEF" : "管理 cocos 中的 package。", - "PACKAGE_HELP" : "cocos package 可以為你提供開發所需的各種資源。\n\n示例:\n\tcocos package search [package_name]\n\tcocos package info [package_name]\n\tcocos package install [package_name]\n\tcocos package list", - "PACKAGE_ERROR_INVALID_CMD_FMT" : "無效的命令 'cocos package %s'\n通過 cocos package -h 查看更多幫助資訊。", - "PACKAGE_SEARCH_BRIEF" : "通過名稱查找 package", - "PACKAGE_SEARCH_ARG_KEY" : "指定 package 名稱", - "PACKAGE_SEARCH_ERROR_NO_KEY_FMT" : "[PACKAGE] 未找到 package '%s'", - "PACKAGE_SEARCH_TIP_FMT" : "[PACKAGE] 匹配 '%s' 的所有 package:", - "PACKAGE_ITEM_FMT" : "[PACKAGE] > %s %s (%s)", - "PACKAGE_LIST_BRIEF" : "列出所有已安裝的 package。", - "PACKAGE_LIST_NOT_FOUND" : "[PACKAGE] 未安裝 package", - "PACKAGE_LIST_TIP" : "[PACKAGE] 安裝的 package:", - "PACKAGE_INSTALL_BRIEF" : "安裝一個 package", - "PACKAGE_INSTALL_ARG_NAME" : "指定 package 名稱", - "PACKAGE_INSTALL_ARG_FORCE" : "忽略已有檔案,強制下載新的 zip 檔案。", - "PACKAGE_INSTALL_ERROR_NO_PKG_FMT" : "錯誤:未找到 package '%s', 版本號'%s'", - "PACKAGE_INFO_BRIEF" : "從伺服器查找 package。", - "PACKAGE_INFO_ARG_NAME" : "指定 package 名稱", - "PACKAGE_INFO_ARG_VERSION" : "指定 package 版本", - "PACKAGE_INFO_ERROR_NO_PKG_FMT" : "[PACKAGE] 未找到 package '%s', 版本號'%s'", - "PACKAGE_INFO_PKG_FMT" : "[PACKAGE] > 獲取 package '%s' 的資訊 ... 成功\n\n名稱:%s\n版本:%s\n更新時間:%s\n作者:%s\n大小:%d KB\n\n%s\n", - "PACKAGE_ERROR_NOT_ZIP_FMT" : "%s 不是 zip 檔案。", - "PACKAGE_EXTRACT_TIP" : "==> 解壓中,請稍候...", - "PACKAGE_EXTRACT_END" : "==> 解壓完成!", - "PACKAGE_READY_DOWNLOAD_FMT" : "==> 準備好下載 '%s'(來源:'%s')", - "PACKAGE_ERROR_URL_FMT" : "==> 錯誤:未找到檔案,出錯的 url:'%s'", - "PACKAGE_ERROR_DOWNLOAD_FAILED_FMT" : "==> Http 請求失敗,錯誤碼:%s,出錯原因:%s", - "PACKAGE_START_DOWNLOAD" : "==> 開始下載,請稍候...", - "PACKAGE_DOWNLOAD_PERCENT_FMT_1" : "已下載:%6dK / 全部:%dK,百分比:%3.2f%%,速度:%6.2f KB/S ", - "PACKAGE_DOWNLOAD_PERCENT_FMT_2" : "已下載:%6dK,速度:%6.2f KB/S ", - "PACKAGE_DOWNLOAD_END" : "==> 下載完成!", - "PACKAGE_EXISTS_FMT" : "==> '%s' 已存在,跳過下載。", - "PACKAGE_ERROR_UNKNOWN_FORMAT_FMT" : "==> 未識別的 zip 格式檔案 '%s'!", - "PACKAGE_ERROR_PATH_NOT_FOUND_FMT" : "錯誤:路徑 '%s' 未找到。", - "PACKAGE_ERROR_READ_SLN" : "錯誤:未找到 win 平臺的 *.sln 檔案。", - "PACKAGE_ERROR_NOT_FOUND_PROJ" : "在 *.sln 檔案中未找到工程 '%s'", - "PACKAGE_ERROR_JSON_READ_FAILED" : "讀取 'install.json' 檔案失敗。", - "PACKAGE_ERROR_JSON_ERROR" : "檔案 'install.json' 格式錯誤。", - "PACKAGE_ERROR_NOT_FOUND_JSON" : "錯誤:未找到 'install.json'", - "PACKAGE_ERROR_WIN32_NOT_FOUND" : "工程中沒有 proj.win32 檔案夾。", - "PACKAGE_ERROR_NO_SLN_IN_WIN32" : "proj.win32 檔案夾中未找到 *.sln 檔案。", - "PACKAGE_ERROR_WRONG_DIR" : "錯誤:必須在工程的根目錄調用 'cocos framework add'。", - "PACKAGE_NOT_FOUND_PKG_FMT" : "[PACKAGE] 在本機未找到支持當前工程所使用的引擎版本的 package '%s'。需要支持的引擎版本為 '%s'。請先運行命令: 'cocos package install %s' 將最新版本的 package 安裝到本地。", - "PACKAGE_PROJ_PATH_FMT" : "[PROJECT] > 工程路徑:%s", - "PACKAGE_PROJ_TYPE_FMT" : "[PROJECT] > 工程類型:%s", - "PACKAGE_PKG_ADDED_WARN_FMT" : "[PROJECT] > Package '%s' 已經被添加。更新其版本請運行命令: 'cocos framework update %s' 。", - "PACKAGE_PROJ_UNKOWN_ENGINE" : "[PROJECT] > 錯誤:無法識別引擎版本", - "PACKAGE_PKG_ADD_FMT" : "[PROJECT] > 增加 '%s %s (%s)' ...", - "PACKAGE_NO_PKG_FOUND" : "[PROJECT] > 未找到任何 package", - "PACKAGE_PKG_NOT_FOUND_FMT" : "[PROJECT] > 未找到 package '%s'.", - "PACKAGE_PKG_REMOVE_FMT" : "[PROJECT] > 移除 '%s' ...", - "PACKAGE_WORKDIR_FMT" : "[PACKAGE] 工作目錄:%s", - "PACKAGE_PKG_REMOVE_OK" : "[PROJECT] > 移除成功", - "PACKAGE_PKG_IS_NEWEST_FMT" : "[PROJECT] > package '%s' 已經是本機的最新版本。如果 PMR 伺服器上有更新版本, 請運行命令: 'cocos package install %s' 更新本機版本後再升級 package。", - "PACKAGE_PROJ_PKG_UPDATE_OK" : "[PROJECT] > 升級成功", - "PACKAGE_ERROR_WITH_CODE_FMT" : "錯誤:%s,錯誤碼:%s", - "PACKAGE_PKG_ADD_OK_FMT" : "[PACKAGE] 增加 package '%s' 成功。", - "PACKAGE_PKG_REMOVE_OK_FMT" : "[PACKAGE] 移除 package '%s' 成功。", - "PACKAGE_PKG_UPDATE_OK_FMT" : "[PACKAGE] 升級 '%s' 成功。", - "PACKAGE_PKG_NOT_FOUND_PKG_FMT" : "錯誤:未找到 package '%s'", - "PACKAGE_PATH_EXISTED_FMT" : "錯誤:路徑 '%s' 已存在!", - "PACKAGE_CREATE_OK_FMT" : "%s 創建成功。", - "PACKAGE_UNABLE_COPY_FMT" : "錯誤:'%s' 不可拷貝!", - "PACKAGE_MAC_NOT_FOUND" : "工程中未找到 proj.ios_mac 檔案夾。", - "PACKAGE_XCODE_PROJ_NOT_FOUND" : "proj.ios_mac 檔案夾中未找到 *.xcodeproj。", - "PACKAGE_VS_PROJ_NOT_FOUND" : "proj.win32 檔案夾中未找到 *.vcxproj。", - "PACKAGE_ANDROID_PROJ_NOT_FOUND" : "工程中未找到 proj.android 檔案夾。", - "PACKAGE_ANDROID_MK_NOT_FOUND" : "proj.android/jni 檔案夾中未找到 Android.mk。", - "PACKAGE_APPDELEGATE_NOT_FOUND" : "Classes 檔案夾中未找到 AppDelegate.cpp。", - "PACKAGE_BUILD_CFG_NOT_FOUND" : "proj.android 檔案夾中未找到 build_cfg.json。", - "PACKAGE_CMD_NOT_FOUND_FMT" : "未找到命令 %s", - "PACKAGE_ERROR_INVALID_PLATFORM_FMT" : "無效的平臺 '%s'", - "PACKAGE_TAG_NOT_FOUND_FMT" : "工程檔案中未找到 '%s' 標籤(平臺:'%s')", - "PACKAGE_ENTRY_DECLARE_FAILED" : "聲明 entry 失敗。", - "PACKAGE_ERROR_IN_FILE_FMT" : "檔案 %s 格式錯誤。", - "PACKAGE_WIN_PROJ_NOT_FOUND" : "未找到 win 平臺的工程檔案。", - "PACKAGE_NDK_MODULE_NOT_FOUND" : "在 Android 平臺的 build_cfg.json 檔案中未找到 'ndk_module_path'。", - "PACKAGE_NOT_XCODE_PROJ_FMT" : "'%s' 不是一個 xcode 工程。" - } -} diff --git a/native/tools/cocos-console/tsconfig.json b/native/tools/cocos-console/tsconfig.json deleted file mode 100644 index 82b1338ca8..0000000000 --- a/native/tools/cocos-console/tsconfig.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "compilerOptions": { - /* Basic Options */ - // "incremental": true, /* Enable incremental compilation */ - "target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */ - // "lib": [], /* Specify library files to be included in the compilation. */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ - // "declaration": true, /* Generates corresponding '.d.ts' file. */ - // "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - // "outDir": "./", /* Redirect output structure to the directory. */ - // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "composite": true, /* Enable project compilation */ - // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ - // "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - "strictNullChecks": true, /* Enable strict null checks. */ - // "strictFunctionTypes": true, /* Enable strict checking of function types. */ - "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ - // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - "resolveJsonModule":true, - /* Additional Checks */ - // "noUnusedLocals": true, /* Report errors on unused locals. */ - // "noUnusedParameters": true, /* Report errors on unused parameters. */ - // "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - - /* Module Resolution Options */ - "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - // "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - // "typeRoots": [], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - // "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - - /* Source Map Options */ - // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - - /* Experimental Options */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ - - /* Advanced Options */ - "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */ - } -} diff --git a/native/tools/cocos2d-console b/native/tools/cocos2d-console deleted file mode 160000 index 36c1480f5b..0000000000 --- a/native/tools/cocos2d-console +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 36c1480f5bce1bed723756af04341cacb5f7a20b