/**
 * 将TypeScript编译为JavaScript
 */
var path = require("path");
var fs = require("fs");
var async = require('../core/async');
var libs = require("../core/normal_libs");
var param = require("../core/params_analyze.js");
var compiler = require("./compile.js")
var currDir_global;
function run(currDir, args, opts) {
    currDir_global = currDir;
    var needCompileEngine = opts["-e"];

    var projectName = args[0];
    if (!projectName) {
        libs.exit(1101);
    }
    var egret_file = path.join(currDir, projectName, "bin-debug/lib/egret_file_list.js");
    var task = [];
    if (needCompileEngine) {
        task.push(
            function (callback) {

                compiler.generateEgretFileList(callback,egret_file);

            },
            function (callback) {
                compiler.compile(callback,
                    path.join(param.getEgretPath(), "src"),
                    path.join(currDir, projectName, "bin-debug/lib"),
                    egret_file
                );
            }
        );
    }

    task.push(
        function (callback) {
            compiler.compile(callback,
                path.join(currDir, projectName, "src"),
                path.join(currDir, projectName, "bin-debug/src"),
                path.join(currDir, projectName, "src/game_file_list.js")
            );
        }
    )

    async.series(task, function (err) {
        console.log("编译成功");
    })
}


function help_title() {
    return "编译指定项目";
}


function help_example() {
    return "egret build [project_name]";
}

exports.run = run;
exports.help_title = help_title;
exports.help_example = help_example;
@@ -990,32 +990,315 @@
              );%0A
+            %7D,%0A%0A            function (callback) %7B%0A                compiler.exportHeader(callback,%0A                    path.join(param.getEgretPath(), %22src%22),%0A                    path.join(currDir, projectName, %22src%22, %22egret.d.ts%22),%0A                    egret_file%0A                );%0A%0A
             %7D%0A  

执行build命令会生成.d.ts