Skip to content

Commit 6a9e077

Browse files
authored
Merge pull request microsoft#25203 from Microsoft/gulpUpToDate
Ensure upToDate also handles referenced project outputs
2 parents 0b5b7ef + a9b4763 commit 6a9e077

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

scripts/build/project.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,21 @@ function getOrCreateProjectGraph(projectSpec, paths) {
401401
return projectGraph;
402402
}
403403

404+
/**
405+
* @param {ResolvedPathOptions} paths
406+
*/
407+
function createParseProject(paths) {
408+
/**
409+
* @param {string} configFilePath
410+
*/
411+
function getProject(configFilePath) {
412+
const projectSpec = resolveProjectSpec(configFilePath, paths, /*referrer*/ undefined);
413+
const projectGraph = getOrCreateProjectGraph(projectSpec, defaultPaths);
414+
return projectGraph && projectGraph.project;
415+
}
416+
return getProject;
417+
}
418+
404419
/**
405420
* @param {ProjectGraph} projectGraph
406421
* @param {ResolvedProjectOptions} resolvedOptions
@@ -473,7 +488,7 @@ function ensureCompileTask(projectGraph, options) {
473488
? tsc.createProject(configFilePath, { typescript: require(options.typescript.typescript) })
474489
: tsc_oop.createProject(configFilePath, {}, { typescript: options.typescript.typescript });
475490
const stream = project.src()
476-
.pipe(gulpif(!options.force, upToDate(projectGraph.project, { verbose: options.verbose })))
491+
.pipe(gulpif(!options.force, upToDate(projectGraph.project, { verbose: options.verbose, parseProject: createParseProject(options.paths) })))
477492
.pipe(gulpif(sourceMap || inlineSourceMap, sourcemaps.init()))
478493
.pipe(project());
479494
const js = (options.js ? options.js(stream.js) : stream.js)

scripts/build/upToDate.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ const Vinyl = require("vinyl");
1515
*
1616
* @typedef UpToDateOptions
1717
* @property {boolean} [verbose]
18+
* @property {(configFilePath: string) => ParsedCommandLine | undefined} [parseProject]
1819
*/
1920
function upToDate(parsedProject, options) {
2021
/** @type {File[]} */
@@ -31,7 +32,8 @@ function upToDate(parsedProject, options) {
3132
},
3233
getModifiedTime(fileName) {
3334
return getStat(fileName).mtime;
34-
}
35+
},
36+
parseConfigFile: options && options.parseProject
3537
};
3638
const duplex = new Duplex({
3739
objectMode: true,
@@ -77,7 +79,6 @@ function upToDate(parsedProject, options) {
7779
module.exports = exports = upToDate;
7880

7981
/**
80-
*
8182
* @param {DiagnosticMessage} message
8283
* @param {...string} args
8384
*/

0 commit comments

Comments
 (0)