Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 28 additions & 10 deletions Jakefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ var definitionsRoots = [
"services/services.d.ts",
];

var internalDefinitionsRoots = [
"compiler/core.d.ts",
"compiler/sys.d.ts",
"compiler/utilities.d.ts",
"services/utilities.d.ts",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not 100% sure about utilities, but I guess it couldn't hurt.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah.. if we are adding some, we might just add them all.

];

var harnessSources = [
"harness.ts",
"sourceMapRecorder.ts",
Expand Down Expand Up @@ -322,6 +329,8 @@ compileFile(servicesFile, servicesSources,[builtLocalDirectory, copyright].conca

var nodeDefinitionsFile = path.join(builtLocalDirectory, "typescript.d.ts");
var standaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices.d.ts");
var internalNodeDefinitionsFile = path.join(builtLocalDirectory, "typescript_internal.d.ts");
var internalStandaloneDefinitionsFile = path.join(builtLocalDirectory, "typescriptServices_internal.d.ts");
var tempDirPath = path.join(builtLocalDirectory, "temptempdir");
compileFile(nodeDefinitionsFile, servicesSources,[builtLocalDirectory, copyright].concat(servicesSources),
/*prefixes*/ undefined,
Expand All @@ -333,16 +342,25 @@ compileFile(nodeDefinitionsFile, servicesSources,[builtLocalDirectory, copyright
/*keepComments*/ true,
/*noResolve*/ true,
/*callback*/ function () {
concatenateFiles(standaloneDefinitionsFile, definitionsRoots.map(function (f) {
return path.join(tempDirPath, f);
}));
prependFile(copyright, standaloneDefinitionsFile);
function makeDefinitionFiles(definitionsRoots, standaloneDefinitionsFile, nodeDefinitionsFile) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the idea of compileFile to be general purpose-ish? makeDefinitionFiles seems very tied to these use cases

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure i understand the issue here.

// Create the standalone definition file
concatenateFiles(standaloneDefinitionsFile, definitionsRoots.map(function (f) {
return path.join(tempDirPath, f);
}));
prependFile(copyright, standaloneDefinitionsFile);

// Create the node definition file by replacing 'ts' module with '"typescript"' as a module.
jake.cpR(standaloneDefinitionsFile, nodeDefinitionsFile, {silent: true});
var definitionFileContents = fs.readFileSync(nodeDefinitionsFile).toString();
definitionFileContents = definitionFileContents.replace(/declare module ts/g, 'declare module "typescript"');
fs.writeFileSync(nodeDefinitionsFile, definitionFileContents);
}

// Create the node definition file by replacing 'ts' module with '"typescript"' as a module.
jake.cpR(standaloneDefinitionsFile, nodeDefinitionsFile, {silent: true});
var definitionFileContents = fs.readFileSync(nodeDefinitionsFile).toString();
definitionFileContents = definitionFileContents.replace(/declare module ts/g, 'declare module "typescript"');
fs.writeFileSync(nodeDefinitionsFile, definitionFileContents);
// Create the public definition files
makeDefinitionFiles(definitionsRoots, standaloneDefinitionsFile, nodeDefinitionsFile);

// Create the internal definition files
makeDefinitionFiles(internalDefinitionsRoots, internalStandaloneDefinitionsFile, internalNodeDefinitionsFile);

// Delete the temp dir
jake.rmRf(tempDirPath, {silent: true});
Expand Down Expand Up @@ -401,7 +419,7 @@ task("generate-spec", [specMd])
// Makes a new LKG. This target does not build anything, but errors if not all the outputs are present in the built/local directory
desc("Makes a new LKG out of the built js files");
task("LKG", ["clean", "release", "local"].concat(libraryTargets), function() {
var expectedFiles = [tscFile, servicesFile, nodeDefinitionsFile, standaloneDefinitionsFile].concat(libraryTargets);
var expectedFiles = [tscFile, servicesFile, nodeDefinitionsFile, standaloneDefinitionsFile, internalNodeDefinitionsFile, internalStandaloneDefinitionsFile].concat(libraryTargets);
var missingFiles = expectedFiles.filter(function (f) {
return !fs.existsSync(f);
});
Expand Down