From e5b6bfbc4636e347eadf66658b78e78736ce29e4 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Tue, 7 Oct 2014 20:51:23 -0700 Subject: [PATCH] add declaration target to generate declarations for compiler and services --- Jakefile | 22 ++++++++++++++++------ src/services/shims.ts | 2 +- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Jakefile b/Jakefile index 74f950be9e0..da91239d7a5 100644 --- a/Jakefile +++ b/Jakefile @@ -128,6 +128,7 @@ function concatenateFiles(destinationFile, sourceFiles) { } var useDebugMode = false; +var generateDeclarations = false; var host = (process.env.host || process.env.TYPESCRIPT_HOST || "node"); var compilerFilename = "tsc.js"; /* Compiles a file from a list of sources @@ -142,6 +143,9 @@ function compileFile(outFile, sources, prereqs, prefixes, useBuiltCompiler, noOu file(outFile, prereqs, function() { var dir = useBuiltCompiler ? builtLocalDirectory : LKGDirectory; var options = "-removeComments --module commonjs -noImplicitAny "; //" -propagateEnumConstants " + if (generateDeclarations) { + options += "--declaration "; + } var cmd = host + " " + dir + compilerFilename + " " + options + " "; if (useDebugMode) { @@ -250,7 +254,7 @@ task("local", ["generate-diagnostics", "lib", tscFile, servicesFile]); // Local target to build the compiler and services desc("Emit debug mode files with sourcemaps"); task("debug", function() { - useDebugMode = true; + useDebugMode = true; }); @@ -264,6 +268,12 @@ task("clean", function() { jake.rmRf(builtDirectory); }); +// generate declarations for compiler and services +desc("Generate declarations for compiler and services"); +task("declaration", function() { + generateDeclarations = true; +}); + // Generate Markdown spec var word2mdJs = path.join(scriptsDirectory, "word2md.js"); var word2mdTs = path.join(scriptsDirectory, "word2md.ts"); @@ -283,12 +293,12 @@ compileFile(word2mdJs, // The generated spec.md; built for the 'generate-spec' task file(specMd, [word2mdJs, specWord], function () { jake.cpR(headerMd, specMd, {silent: true}); - var specWordFullPath = path.resolve(specWord); + var specWordFullPath = path.resolve(specWord); var cmd = "cscript //nologo " + word2mdJs + ' "' + specWordFullPath + '" >>' + specMd; - console.log(cmd); - child_process.exec(cmd, function () { - complete(); - }); + console.log(cmd); + child_process.exec(cmd, function () { + complete(); + }); }, {async: true}) diff --git a/src/services/shims.ts b/src/services/shims.ts index c7d293794ca..bab9b98a983 100644 --- a/src/services/shims.ts +++ b/src/services/shims.ts @@ -174,7 +174,7 @@ module ts { } /// TODO: delete this, it is only needed until the VS interface is updated - enum LanguageVersion { + export enum LanguageVersion { EcmaScript3 = 0, EcmaScript5 = 1, }