mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
* Use fixed time for vfs so baselining is consistent * Baseline buildinfos * Write new file text in baseline even if the file wasnt read on the shadow * Remove unnecessary debugger statement * Make sure that incremental correctness is checked with correct writeFile so we know buildInfo was written Also baseline these so its easy to verify the changes * More baselines for the tsbuildinfo * If we are writing dts file and have used file text as version, we can update the signature when doing actual emit * Make WriteFileCallback Api ready for future * Assert that there is only single source file when emitting d.ts file * Add test * Renames * More refactoring * If we are updating dts of any of the file and it affects global scope, everything needs update in signature and dts emit Fixes #42769 * Stacktrace optimization for getModified time in anticipation of using it more than fileExists wherever possible * Baseline getModifiedTime, setModifiedTime, fileExits and directoryExits for experiment * Remove unnecessary write file finger print code since its not used at all * Use modified time instead of file existence check * Remove unnecessary getModifiedTime * No need to check for file existence before reading the d.ts file * Do project reference errors before doing input/output file checks * Dont call getModifiedTimes if dts change * Passdown modified time if queried * Use modified time passed through the file watching in tsbuild * Handle force build as separate upto date status * uptodate status worker to read buildinfo and use it to determine upto date ness * No need to update output timestamps if buildinfo will determine uptodateness * Store change file set instead of hasPendingChange to be able to reuse the information * Add test that shows input file is not present * No need to check input time stamp before buildinfo * Keep buildinfos for lifetime of the solution builder and project * Store modified time along with text of buildinfo * Non composite projects dont need to track declaration change time * Pass through buildInfo so we dont have to parse it back * Save dts change time in buildinfo itself * Store dts time for --out in the buildInfo * Store hash of text in the bundle info so it can be verified before manipulating text for fast updates during prepend This helps when text changes during incremental build toggling and we determine we can just manipulate text * Since buildinfo is cached no need to maintain version check state * Store output time stamps for non incremental builds * Revert "Baseline getModifiedTime, setModifiedTime, fileExits and directoryExits for experiment" This reverts commit7e65cd3315. * Change verbose messages for upto date status * Reconcile reusable builder state and builder state so there are not two different types that are almost similar looking * Cleanup impliedFormat * Cleanup * Cleanup noEmit option * BuildInfo options emit as a flag * Factor out types for program written in buildinfo with and without bundle emit * No need to store output file stamps if not in watch mode * Cleanup * Test for single watch per file * Fix emit and error update baselines that were duplicate * More refactoring * Only copy emit state fields when backing up to restore if emit fails * Instead of maintaining delta of changes, maintain old state for those changes * Add test to verify build when input file does not change * If version of the input file does not change, dont mark as out of date * Disable lint warning as build fails without the assert * Report aggregate statistics for solution as well as some solution perf numbers * Options solutionDiagnostics instead so that its not too verbose when printing diagnostics * When tsc --build --clean, only remove tsbuildinfo if its incremental build * Revert "Options solutionDiagnostics instead so that its not too verbose when printing diagnostics" This reverts commit0cf9e30103. * Revert "Report aggregate statistics for solution as well as some solution perf numbers" This reverts commit405d8e9197. * Revert "When tsc --build --clean, only remove tsbuildinfo if its incremental build" This reverts commite4e6672609. * Comments in the code * Feedback
167 lines
5.7 KiB
TypeScript
167 lines
5.7 KiB
TypeScript
/*@internal*/
|
|
namespace ts {
|
|
export enum UpToDateStatusType {
|
|
Unbuildable,
|
|
UpToDate,
|
|
/**
|
|
* The project appears out of date because its upstream inputs are newer than its outputs,
|
|
* but all of its outputs are actually newer than the previous identical outputs of its (.d.ts) inputs.
|
|
* This means we can Pseudo-build (just touch timestamps), as if we had actually built this project.
|
|
*/
|
|
UpToDateWithUpstreamTypes,
|
|
/**
|
|
* The project appears out of date because its upstream inputs are newer than its outputs,
|
|
* but all of its outputs are actually newer than the previous identical outputs of its (.d.ts) inputs.
|
|
* This means we can Pseudo-build (just manipulate outputs), as if we had actually built this project.
|
|
*/
|
|
OutOfDateWithPrepend,
|
|
OutputMissing,
|
|
OutOfDateWithSelf,
|
|
OutOfDateWithUpstream,
|
|
OutOfDateBuildInfo,
|
|
UpstreamOutOfDate,
|
|
UpstreamBlocked,
|
|
ComputingUpstream,
|
|
TsVersionOutputOfDate,
|
|
UpToDateWithInputFileText,
|
|
|
|
/**
|
|
* Projects with no outputs (i.e. "solution" files)
|
|
*/
|
|
ContainerOnly,
|
|
ForceBuild,
|
|
}
|
|
|
|
export type UpToDateStatus =
|
|
| Status.Unbuildable
|
|
| Status.UpToDate
|
|
| Status.OutOfDateWithPrepend
|
|
| Status.OutputMissing
|
|
| Status.OutOfDateWithSelf
|
|
| Status.OutOfDateWithUpstream
|
|
| Status.OutOfDateBuildInfo
|
|
| Status.UpstreamOutOfDate
|
|
| Status.UpstreamBlocked
|
|
| Status.ComputingUpstream
|
|
| Status.TsVersionOutOfDate
|
|
| Status.ContainerOnly
|
|
| Status.ForceBuild;
|
|
|
|
export namespace Status {
|
|
/**
|
|
* The project can't be built at all in its current state. For example,
|
|
* its config file cannot be parsed, or it has a syntax error or missing file
|
|
*/
|
|
export interface Unbuildable {
|
|
type: UpToDateStatusType.Unbuildable;
|
|
reason: string;
|
|
}
|
|
|
|
/**
|
|
* This project doesn't have any outputs, so "is it up to date" is a meaningless question.
|
|
*/
|
|
export interface ContainerOnly {
|
|
type: UpToDateStatusType.ContainerOnly;
|
|
}
|
|
|
|
/**
|
|
* The project is up to date with respect to its inputs.
|
|
* We track what the newest input file is.
|
|
*/
|
|
export interface UpToDate {
|
|
type: UpToDateStatusType.UpToDate | UpToDateStatusType.UpToDateWithUpstreamTypes | UpToDateStatusType.UpToDateWithInputFileText;
|
|
newestInputFileTime?: Date;
|
|
newestInputFileName?: string;
|
|
newestDeclarationFileContentChangedTime: Date | undefined;
|
|
oldestOutputFileName: string;
|
|
}
|
|
|
|
/**
|
|
* The project is up to date with respect to its inputs except for prepend output changed (no declaration file change in prepend).
|
|
*/
|
|
export interface OutOfDateWithPrepend {
|
|
type: UpToDateStatusType.OutOfDateWithPrepend;
|
|
outOfDateOutputFileName: string;
|
|
newerProjectName: string;
|
|
}
|
|
|
|
/**
|
|
* One or more of the outputs of the project does not exist.
|
|
*/
|
|
export interface OutputMissing {
|
|
type: UpToDateStatusType.OutputMissing;
|
|
/**
|
|
* The name of the first output file that didn't exist
|
|
*/
|
|
missingOutputFileName: string;
|
|
}
|
|
|
|
/**
|
|
* One or more of the project's outputs is older than its newest input.
|
|
*/
|
|
export interface OutOfDateWithSelf {
|
|
type: UpToDateStatusType.OutOfDateWithSelf;
|
|
outOfDateOutputFileName: string;
|
|
newerInputFileName: string;
|
|
}
|
|
|
|
/**
|
|
* Buildinfo indicates that build is out of date
|
|
*/
|
|
export interface OutOfDateBuildInfo {
|
|
type: UpToDateStatusType.OutOfDateBuildInfo,
|
|
buildInfoFile: string;
|
|
}
|
|
|
|
/**
|
|
* This project depends on an out-of-date project, so shouldn't be built yet
|
|
*/
|
|
export interface UpstreamOutOfDate {
|
|
type: UpToDateStatusType.UpstreamOutOfDate;
|
|
upstreamProjectName: string;
|
|
}
|
|
|
|
/**
|
|
* This project depends an upstream project with build errors
|
|
*/
|
|
export interface UpstreamBlocked {
|
|
type: UpToDateStatusType.UpstreamBlocked;
|
|
upstreamProjectName: string;
|
|
upstreamProjectBlocked: boolean;
|
|
}
|
|
|
|
/**
|
|
* Computing status of upstream projects referenced
|
|
*/
|
|
export interface ComputingUpstream {
|
|
type: UpToDateStatusType.ComputingUpstream;
|
|
}
|
|
|
|
export interface TsVersionOutOfDate {
|
|
type: UpToDateStatusType.TsVersionOutputOfDate;
|
|
version: string;
|
|
}
|
|
|
|
/**
|
|
* One or more of the project's outputs is older than the newest output of
|
|
* an upstream project.
|
|
*/
|
|
export interface OutOfDateWithUpstream {
|
|
type: UpToDateStatusType.OutOfDateWithUpstream;
|
|
outOfDateOutputFileName: string;
|
|
newerProjectName: string;
|
|
}
|
|
|
|
export interface ForceBuild {
|
|
type: UpToDateStatusType.ForceBuild;
|
|
}
|
|
}
|
|
|
|
export function resolveConfigFileProjectName(project: string): ResolvedConfigFileName {
|
|
if (fileExtensionIs(project, Extension.Json)) {
|
|
return project as ResolvedConfigFileName;
|
|
}
|
|
|
|
return combinePaths(project, "tsconfig.json") as ResolvedConfigFileName;
|
|
}
|
|
} |