mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Merge pull request #30344 from Microsoft/uptoDate
Set oldestOutputFileName in uptodate status when updating just timestamps of output
This commit is contained in:
commit
b762d6205e
@ -1199,7 +1199,7 @@ namespace ts {
|
||||
// Update time stamps for rest of the outputs
|
||||
newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(configFile, newestDeclarationFileContentChangedTime, Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
|
||||
|
||||
const status: UpToDateStatus = {
|
||||
const status: Status.UpToDate = {
|
||||
type: UpToDateStatusType.UpToDate,
|
||||
newestDeclarationFileContentChangedTime: anyDtsChanged ? maximumDate : newestDeclarationFileContentChangedTime,
|
||||
oldestOutputFileName: outputFiles.length ? outputFiles[0].name : getFirstProjectOutput(configFile)
|
||||
@ -1275,7 +1275,7 @@ namespace ts {
|
||||
// Update timestamps for dts
|
||||
const newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(config, minimumDate, Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
|
||||
|
||||
const status: UpToDateStatus = {
|
||||
const status: Status.UpToDate = {
|
||||
type: UpToDateStatusType.UpToDate,
|
||||
newestDeclarationFileContentChangedTime,
|
||||
oldestOutputFileName: outputFiles[0].name
|
||||
@ -1292,7 +1292,12 @@ namespace ts {
|
||||
return reportStatus(Diagnostics.A_non_dry_build_would_update_timestamps_for_output_of_project_0, proj.options.configFilePath!);
|
||||
}
|
||||
const priorNewestUpdateTime = updateOutputTimestampsWorker(proj, minimumDate, Diagnostics.Updating_output_timestamps_of_project_0);
|
||||
projectStatus.setValue(proj.options.configFilePath as ResolvedConfigFilePath, { type: UpToDateStatusType.UpToDate, newestDeclarationFileContentChangedTime: priorNewestUpdateTime } as UpToDateStatus);
|
||||
const status: Status.UpToDate = {
|
||||
type: UpToDateStatusType.UpToDate,
|
||||
newestDeclarationFileContentChangedTime: priorNewestUpdateTime,
|
||||
oldestOutputFileName: getFirstProjectOutput(proj)
|
||||
};
|
||||
projectStatus.setValue(proj.options.configFilePath as ResolvedConfigFilePath, status);
|
||||
}
|
||||
|
||||
function updateOutputTimestampsWorker(proj: ParsedCommandLine, priorNewestUpdateTime: Date, verboseMessage: DiagnosticMessage, skipOutputs?: FileMap<true>) {
|
||||
|
||||
@ -1137,5 +1137,46 @@ export function gfoo() {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it("incremental updates in verbose mode", () => {
|
||||
const host = createTsBuildWatchSystem(allFiles, { currentDirectory: projectsLocation });
|
||||
const solutionBuilder = createSolutionBuilder(host, [`${project}/${SubProject.tests}`], { verbose: true, watch: true });
|
||||
solutionBuilder.buildAllProjects();
|
||||
solutionBuilder.startWatching();
|
||||
checkOutputErrorsInitial(host, emptyArray, /*disableConsoleClears*/ undefined, [
|
||||
`Projects in this build: \r\n * sample1/core/tsconfig.json\r\n * sample1/logic/tsconfig.json\r\n * sample1/tests/tsconfig.json\n\n`,
|
||||
`Project 'sample1/core/tsconfig.json' is out of date because output file 'sample1/core/anotherModule.js' does not exist\n\n`,
|
||||
`Building project '/user/username/projects/sample1/core/tsconfig.json'...\n\n`,
|
||||
`Project 'sample1/logic/tsconfig.json' is out of date because output file 'sample1/logic/index.js' does not exist\n\n`,
|
||||
`Building project '/user/username/projects/sample1/logic/tsconfig.json'...\n\n`,
|
||||
`Project 'sample1/tests/tsconfig.json' is out of date because output file 'sample1/tests/index.js' does not exist\n\n`,
|
||||
`Building project '/user/username/projects/sample1/tests/tsconfig.json'...\n\n`
|
||||
]);
|
||||
verifyWatches(host);
|
||||
|
||||
// Make non dts change
|
||||
host.writeFile(logic[1].path, `${logic[1].content}
|
||||
function someFn() { }`);
|
||||
host.checkTimeoutQueueLengthAndRun(1); // build logic
|
||||
host.checkTimeoutQueueLengthAndRun(1); // build tests
|
||||
checkOutputErrorsIncremental(host, emptyArray, /*disableConsoleClears*/ undefined, /*logsBeforeWatchDiagnostics*/ undefined, [
|
||||
`Project 'sample1/logic/tsconfig.json' is out of date because oldest output 'sample1/logic/index.js' is older than newest input 'sample1/core'\n\n`,
|
||||
`Building project '/user/username/projects/sample1/logic/tsconfig.json'...\n\n`,
|
||||
`Project 'sample1/tests/tsconfig.json' is up to date with .d.ts files from its dependencies\n\n`,
|
||||
`Updating output timestamps of project '/user/username/projects/sample1/tests/tsconfig.json'...\n\n`,
|
||||
]);
|
||||
|
||||
// Make dts change
|
||||
host.writeFile(logic[1].path, `${logic[1].content}
|
||||
export function someFn() { }`);
|
||||
host.checkTimeoutQueueLengthAndRun(1); // build logic
|
||||
host.checkTimeoutQueueLengthAndRun(1); // build tests
|
||||
checkOutputErrorsIncremental(host, emptyArray, /*disableConsoleClears*/ undefined, /*logsBeforeWatchDiagnostics*/ undefined, [
|
||||
`Project 'sample1/logic/tsconfig.json' is out of date because oldest output 'sample1/logic/index.js' is older than newest input 'sample1/core'\n\n`,
|
||||
`Building project '/user/username/projects/sample1/logic/tsconfig.json'...\n\n`,
|
||||
`Project 'sample1/tests/tsconfig.json' is out of date because oldest output 'sample1/tests/index.js' is older than newest input 'sample1/logic/tsconfig.json'\n\n`,
|
||||
`Building project '/user/username/projects/sample1/tests/tsconfig.json'...\n\n`,
|
||||
]);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -53,6 +53,7 @@ namespace ts.tscWatch {
|
||||
}
|
||||
|
||||
const elapsedRegex = /^Elapsed:: [0-9]+ms/;
|
||||
const buildVerboseLogRegEx = /^.+ \- /;
|
||||
function checkOutputErrors(
|
||||
host: WatchedSystem,
|
||||
logsBeforeWatchDiagnostic: string[] | undefined,
|
||||
@ -87,9 +88,13 @@ namespace ts.tscWatch {
|
||||
index++;
|
||||
}
|
||||
|
||||
function getCleanLogString(log: string) {
|
||||
return log.replace(elapsedRegex, "").replace(buildVerboseLogRegEx, "");
|
||||
}
|
||||
|
||||
function assertLog(caption: string, expected: string) {
|
||||
const actual = outputs[index];
|
||||
assert.equal(actual.replace(elapsedRegex, ""), expected.replace(elapsedRegex, ""), getOutputAtFailedMessage(caption, expected));
|
||||
assert.equal(getCleanLogString(actual), getCleanLogString(expected), getOutputAtFailedMessage(caption, expected));
|
||||
index++;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user