Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
a3b5207
Use fixed time for vfs so baselining is consistent
sheetalkamat Apr 13, 2022
c20613f
Baseline buildinfos
sheetalkamat Apr 13, 2022
c79af2c
Write new file text in baseline even if the file wasnt read on the sh…
sheetalkamat Apr 14, 2022
40a8c7f
Remove unnecessary debugger statement
sheetalkamat Apr 15, 2022
7377470
Make sure that incremental correctness is checked with correct writeF…
sheetalkamat Apr 15, 2022
c206ff0
More baselines for the tsbuildinfo
sheetalkamat Apr 19, 2022
fc91aff
If we are writing dts file and have used file text as version, we can…
sheetalkamat Apr 13, 2022
396e6c8
Make WriteFileCallback Api ready for future
sheetalkamat Apr 14, 2022
7084221
Assert that there is only single source file when emitting d.ts file
sheetalkamat Apr 15, 2022
5f02cf3
Add test
sheetalkamat Apr 5, 2022
c984298
Renames
sheetalkamat Apr 6, 2022
e4bf58a
More refactoring
sheetalkamat Apr 6, 2022
87a7112
If we are updating dts of any of the file and it affects global scope…
sheetalkamat Apr 6, 2022
16cef4a
Stacktrace optimization for getModified time in anticipation of using…
sheetalkamat Mar 16, 2022
7e65cd3
Baseline getModifiedTime, setModifiedTime, fileExits and directoryExi…
sheetalkamat Apr 5, 2022
0ff8cb3
Remove unnecessary write file finger print code since its not used at…
sheetalkamat Mar 16, 2022
59ad6ef
Use modified time instead of file existence check
sheetalkamat Apr 11, 2022
c8327da
Remove unnecessary getModifiedTime
sheetalkamat Mar 17, 2022
7817fbf
No need to check for file existence before reading the d.ts file
sheetalkamat Mar 17, 2022
cb7aca3
Do project reference errors before doing input/output file checks
sheetalkamat Mar 21, 2022
dd96e33
Dont call getModifiedTimes if dts change
sheetalkamat Mar 28, 2022
89d2d4c
Passdown modified time if queried
sheetalkamat Mar 15, 2022
6e0c916
Use modified time passed through the file watching in tsbuild
sheetalkamat Mar 18, 2022
e6a3ee8
Handle force build as separate upto date status
sheetalkamat Mar 29, 2022
7cb0f40
uptodate status worker to read buildinfo and use it to determine upto…
sheetalkamat Apr 7, 2022
1a8abac
No need to update output timestamps if buildinfo will determine uptod…
sheetalkamat Apr 11, 2022
59f2b5c
Store change file set instead of hasPendingChange to be able to reuse…
sheetalkamat Apr 5, 2022
5c12067
Add test that shows input file is not present
sheetalkamat Apr 7, 2022
7734528
No need to check input time stamp before buildinfo
sheetalkamat Apr 7, 2022
6198fa3
Keep buildinfos for lifetime of the solution builder and project
sheetalkamat Apr 8, 2022
fcf07f8
Store modified time along with text of buildinfo
sheetalkamat Apr 8, 2022
2f2e370
Non composite projects dont need to track declaration change time
sheetalkamat Apr 12, 2022
15fe24e
Pass through buildInfo so we dont have to parse it back
sheetalkamat Apr 14, 2022
dc21283
Save dts change time in buildinfo itself
sheetalkamat Apr 12, 2022
5bccee8
Store dts time for --out in the buildInfo
sheetalkamat Apr 15, 2022
62c687b
Store hash of text in the bundle info so it can be verified before ma…
sheetalkamat Apr 19, 2022
128008a
Since buildinfo is cached no need to maintain version check state
sheetalkamat Apr 19, 2022
4fb6773
Store output time stamps for non incremental builds
sheetalkamat Apr 19, 2022
7e1e9d7
Revert "Baseline getModifiedTime, setModifiedTime, fileExits and dire…
sheetalkamat Apr 5, 2022
cb73874
Change verbose messages for upto date status
sheetalkamat Apr 19, 2022
d8d8609
Merge branch 'main' into timestamps
sheetalkamat Apr 20, 2022
0f7903d
Reconcile reusable builder state and builder state so there are not t…
sheetalkamat Apr 20, 2022
82fb56b
Cleanup impliedFormat
sheetalkamat Apr 20, 2022
7785a87
Cleanup
sheetalkamat Apr 20, 2022
a95d3cc
Cleanup noEmit option
sheetalkamat Apr 20, 2022
437619e
BuildInfo options emit as a flag
sheetalkamat Apr 20, 2022
b568d7e
Factor out types for program written in buildinfo with and without bu…
sheetalkamat Apr 20, 2022
78ba778
No need to store output file stamps if not in watch mode
sheetalkamat Apr 20, 2022
10728b4
Cleanup
sheetalkamat Apr 20, 2022
5492949
Test for single watch per file
sheetalkamat Apr 20, 2022
70069d2
Fix emit and error update baselines that were duplicate
sheetalkamat Apr 21, 2022
21a6806
More refactoring
sheetalkamat Apr 21, 2022
b32d2eb
Only copy emit state fields when backing up to restore if emit fails
sheetalkamat Apr 21, 2022
26e7cb6
Merge branch 'main' into timestamps
sheetalkamat Apr 22, 2022
303824e
Instead of maintaining delta of changes, maintain old state for those…
sheetalkamat Apr 26, 2022
643576c
Merge branch 'main' into timestamps
sheetalkamat Apr 27, 2022
7810c56
Add test to verify build when input file does not change
sheetalkamat Apr 29, 2022
28a9ff3
If version of the input file does not change, dont mark as out of date
sheetalkamat Apr 29, 2022
929ddad
Merge branch 'main' into timestamps
sheetalkamat Apr 29, 2022
5d31847
Disable lint warning as build fails without the assert
sheetalkamat Apr 29, 2022
fa1068e
Merge branch 'main' into timestamps
sheetalkamat May 6, 2022
94e7e43
Merge branch 'main' into timestamps
sheetalkamat May 24, 2022
7593eee
Merge branch 'main' into timestamps
sheetalkamat May 27, 2022
405d8e9
Report aggregate statistics for solution as well as some solution per…
sheetalkamat May 27, 2022
fe69264
Merge branch 'main' into timestamps
sheetalkamat Jun 1, 2022
0cf9e30
Options solutionDiagnostics instead so that its not too verbose when …
sheetalkamat Jun 1, 2022
e4e6672
When tsc --build --clean, only remove tsbuildinfo if its incremental …
sheetalkamat Jun 2, 2022
842de49
Merge branch 'main' into timestamps
sheetalkamat Jun 6, 2022
5c07c77
Revert "Options solutionDiagnostics instead so that its not too verbo…
sheetalkamat Jun 7, 2022
31427f6
Revert "Report aggregate statistics for solution as well as some solu…
sheetalkamat Jun 7, 2022
0f898f2
Merge branch 'main' into timestamps
sheetalkamat Jun 7, 2022
5cd883a
Revert "When tsc --build --clean, only remove tsbuildinfo if its incr…
sheetalkamat Jun 7, 2022
5cd5d57
Comments in the code
sheetalkamat Jun 7, 2022
624c182
Feedback
sheetalkamat Jun 8, 2022
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
Prev Previous commit
Next Next commit
Options solutionDiagnostics instead so that its not too verbose when …
…printing diagnostics
  • Loading branch information
sheetalkamat committed Jun 1, 2022
commit 0cf9e301038267bc1d9439c15d279940809b0c00
9 changes: 8 additions & 1 deletion src/compiler/commandLineParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,14 @@ namespace ts {
description: Diagnostics.Delete_the_outputs_of_all_projects,
type: "boolean",
defaultValueDescription: false,
}
},
{
name: "solutionDiagnostics",
type: "boolean",
category: Diagnostics.Compiler_Diagnostics,
description: Diagnostics.Output_more_detailed_solution_performance_information_after_building,
defaultValueDescription: false,
},
];

/* @internal */
Expand Down
6 changes: 5 additions & 1 deletion src/compiler/diagnosticMessages.json
Original file line number Diff line number Diff line change
Expand Up @@ -5261,7 +5261,7 @@
"code": 6385,
"reportsDeprecated": true
},
"Performance timings for '--diagnostics' or '--extendedDiagnostics' are not available in this session. A native implementation of the Web Performance API could not be found.": {
"Performance timings for '--diagnostics' or '--extendedDiagnostics' or '--solutionDiagnostics' are not available in this session. A native implementation of the Web Performance API could not be found.": {
"category": "Message",
"code": 6386
},
Expand Down Expand Up @@ -5807,6 +5807,10 @@
"category": "Message",
"code": 6718
},
"Output more detailed solution performance information after building.": {
"category": "Message",
"code": 6719
},
"Default catch clause variables as 'unknown' instead of 'any'.": {
"category": "Message",
"code": 6803
Expand Down
6 changes: 3 additions & 3 deletions src/compiler/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ namespace ts {
sourceMap: compilerOptions.sourceMap,
inlineSourceMap: compilerOptions.inlineSourceMap,
inlineSources: compilerOptions.inlineSources,
extendedDiagnostics: compilerOptions.extendedDiagnostics,
extendedDiagnostics: compilerOptions.extendedDiagnostics || compilerOptions.solutionDiagnostics,
writeBundleFileInfo: !!bundleBuildInfo,
relativeToBuildInfo
};
Expand Down Expand Up @@ -454,7 +454,7 @@ namespace ts {
target: compilerOptions.target,
sourceMap: compilerOptions.sourceMap,
inlineSourceMap: compilerOptions.inlineSourceMap,
extendedDiagnostics: compilerOptions.extendedDiagnostics,
extendedDiagnostics: compilerOptions.extendedDiagnostics || compilerOptions.solutionDiagnostics,
onlyPrintJsDocStyle: true,
writeBundleFileInfo: !!bundleBuildInfo,
recordInternalSection: !!bundleBuildInfo,
Expand Down Expand Up @@ -483,7 +483,7 @@ namespace ts {
sourceMap: !forceDtsEmit && compilerOptions.declarationMap,
sourceRoot: compilerOptions.sourceRoot,
mapRoot: compilerOptions.mapRoot,
extendedDiagnostics: compilerOptions.extendedDiagnostics,
extendedDiagnostics: compilerOptions.extendedDiagnostics || compilerOptions.solutionDiagnostics,
// Explicitly do not passthru either `inline` option
}
);
Expand Down
12 changes: 12 additions & 0 deletions src/compiler/performance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace ts {
const marks = new Map<string, number>();
const counts = new Map<string, number>();
const durations = new Map<string, number>();
const durationMarks = new Set<string>();

return {
createTimerIf,
Expand All @@ -29,6 +30,7 @@ namespace ts {
getCount,
getDuration,
forEachMeasure,
forEachCount,
isEnabled,
enable,
disable,
Expand Down Expand Up @@ -87,6 +89,7 @@ namespace ts {
*/
function measure(measureName: string, startMarkName: string, endMarkName: string) {
if (enabled) {
durationMarks.add(startMarkName).add(endMarkName);
const end = marks.get(endMarkName) ?? timestamp();
const start = marks.get(startMarkName) ?? timeorigin;
const previousDuration = durations.get(measureName) || 0;
Expand Down Expand Up @@ -122,6 +125,15 @@ namespace ts {
durations.forEach((duration, measureName) => cb(measureName, duration));
}

/**
* Iterate over each count which is not duration mark, performing some action
*
* @param cb The action to perform for each measure
*/
function forEachCount(cb: (countName: string, count: number) => void) {
counts.forEach((count, countName) => !durationMarks.has(countName) && cb(countName, count));
}

/**
* Indicates whether the performance API is enabled.
*/
Expand Down
12 changes: 11 additions & 1 deletion src/compiler/tsbuildPublic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ namespace ts {
traceResolution?: boolean;
/* @internal */ diagnostics?: boolean;
/* @internal */ extendedDiagnostics?: boolean;
/* @internal */ solutionDiagnostics?: boolean;
/* @internal */ locale?: string;
/* @internal */ generateCpuProfile?: string;
/* @internal */ generateTrace?: string;
Expand Down Expand Up @@ -189,6 +190,7 @@ namespace ts {
commonOptionsWithBuild.forEach(option => {
if (hasProperty(buildOptions, option.name)) result[option.name] = buildOptions[option.name];
});
if (buildOptions.solutionDiagnostics) result.solutionDiagnostics = true;
return result;
}

Expand Down Expand Up @@ -2004,7 +2006,15 @@ namespace ts {
: ExitStatus.DiagnosticsPresent_OutputsSkipped;
}

function clean(state: SolutionBuilderState, project?: string, onlyReferences?: boolean) {
function clean(state: SolutionBuilderState, project?: string, onlyReferences?: boolean): ExitStatus {
solutionPerformance.mark("beforeClean");
const result = cleanWorker(state, project, onlyReferences);
solutionPerformance.mark("afterClean");
solutionPerformance.measure("Clean", "beforeClean", "afterClean");
return result;
}

function cleanWorker(state: SolutionBuilderState, project?: string, onlyReferences?: boolean) {
const buildOrder = getBuildOrderFor(state, project, onlyReferences);
if (!buildOrder) return ExitStatus.InvalidProject_OutputsSkipped;

Expand Down
1 change: 1 addition & 0 deletions src/compiler/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6149,6 +6149,7 @@ namespace ts {
declarationDir?: string;
/* @internal */ diagnostics?: boolean;
/* @internal */ extendedDiagnostics?: boolean;
/* @internal */ solutionDiagnostics?: boolean;
disableSizeLimit?: boolean;
disableSourceOfProjectReferenceRedirect?: boolean;
disableSolutionSearching?: boolean;
Expand Down
1 change: 1 addition & 0 deletions src/compiler/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ namespace ts {
if (system.clearScreen &&
!options.preserveWatchOutput &&
!options.extendedDiagnostics &&
!options.solutionDiagnostics &&
!options.diagnostics &&
contains(screenStartingMessageCodes, diagnostic.code)) {
system.clearScreen();
Expand Down
40 changes: 21 additions & 19 deletions src/executeCommandLine/executeCommandLine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -769,14 +769,14 @@ namespace ts {
if (!reportWatchStatistics) return;
if (d.code === Diagnostics.Found_0_errors_Watching_for_file_changes.code ||
d.code === Diagnostics.Found_1_error_Watching_for_file_changes.code) {
reportSolutionBuilderTimes(sys, builder, buildHost);
reportSolutionBuilderTimes(sys, buildOptions, builder, buildHost);
}
};
updateSolutionBuilderHost(sys, cb, buildHost);
enableSolutionPerformance(sys, buildOptions);
const builder = createSolutionBuilderWithWatch(buildHost, projects, buildOptions, watchOptions);
builder.build();
reportSolutionBuilderTimes(sys, builder, buildHost);
reportSolutionBuilderTimes(sys, buildOptions, builder, buildHost);
reportWatchStatistics = true;
return builder;
}
Expand All @@ -792,31 +792,33 @@ namespace ts {
enableSolutionPerformance(sys, buildOptions);
const builder = createSolutionBuilder(buildHost, projects, buildOptions);
const exitStatus = buildOptions.clean ? builder.clean() : builder.build();
reportSolutionBuilderTimes(sys, builder, buildHost);
reportSolutionBuilderTimes(sys, buildOptions, builder, buildHost);
dumpTracingLegend(); // Will no-op if there hasn't been any tracing
return sys.exit(exitStatus);
}

function enableSolutionPerformance(system: System, options: BuildOptions) {
if (system === sys && (options.diagnostics || options.extendedDiagnostics)) solutionPerformance.enable();
if (system === sys && options.solutionDiagnostics) solutionPerformance.enable();
}

function reportSolutionBuilderTimes(system: System, builder: SolutionBuilder<BuilderProgram>, buildHost: SolutionBuilderHost<BuilderProgram>) {
if (system !== sys) return;
function reportSolutionBuilderTimes(system: System, buildOptions: BuildOptions, builder: SolutionBuilder<BuilderProgram>, buildHost: SolutionBuilderHost<BuilderProgram>) {
if (system !== sys || !buildOptions.solutionDiagnostics) return;


if (solutionPerformance.isEnabled()) {
const solutionStatistics: Statistic[] = [];
solutionPerformance.forEachMeasure((name, duration) => solutionStatistics.push({ name: `${name} time`, value: duration, type: StatisticType.time }));
solutionStatistics.push(
{ name: "projectsBuilt", value: solutionPerformance.getCount("projectsBuilt"), type: StatisticType.count },
{ name: "timestampUpdated", value: solutionPerformance.getCount("timestampUpdated"), type: StatisticType.count },
{ name: "bundlesUpdated", value: solutionPerformance.getCount("bundlesUpdated"), type: StatisticType.count },
{ name: "projects", value: getBuildOrderFromAnyBuildOrder(builder.getBuildOrder()).length, type: StatisticType.count },
{ name: "Projects", value: getBuildOrderFromAnyBuildOrder(builder.getBuildOrder()).length, type: StatisticType.count },
);
solutionPerformance.forEachCount((name, count) => solutionStatistics.push({ name, value: count, type: StatisticType.count }));
solutionPerformance.forEachMeasure((name, duration) => solutionStatistics.push({ name: `${name} time`, value: duration, type: StatisticType.time }));
buildHost.statistics = append(buildHost.statistics, solutionStatistics);
solutionPerformance.disable();
solutionPerformance.enable();
}
else {
sys.write(Diagnostics.Performance_timings_for_diagnostics_or_extendedDiagnostics_or_solutionDiagnostics_are_not_available_in_this_session_A_native_implementation_of_the_Web_Performance_API_could_not_be_found.message + "\n");
}

if (!buildHost.statistics) return;
const statistics: Statistic[] = [];
Expand Down Expand Up @@ -990,16 +992,16 @@ namespace ts {
return createWatchProgram(watchCompilerHost);
}

function canReportDiagnostics(system: System, compilerOptions: CompilerOptions) {
return system === sys && (compilerOptions.diagnostics || compilerOptions.extendedDiagnostics);
function canGenerateStatistics(system: System, compilerOptions: CompilerOptions) {
return system === sys && (compilerOptions.diagnostics || compilerOptions.extendedDiagnostics || compilerOptions.solutionDiagnostics);
}

function canTrace(system: System, compilerOptions: CompilerOptions) {
return system === sys && compilerOptions.generateTrace;
}

function enableStatisticsAndTracing(system: System, compilerOptions: CompilerOptions, isBuildMode: boolean) {
if (canReportDiagnostics(system, compilerOptions)) {
if (canGenerateStatistics(system, compilerOptions)) {
performance.enable(system);
}

Expand All @@ -1022,15 +1024,15 @@ namespace ts {
}

let statistics: Statistic[];
if (canReportDiagnostics(sys, compilerOptions)) {
if (canGenerateStatistics(sys, compilerOptions)) {
statistics = [];
const memoryUsed = sys.getMemoryUsage ? sys.getMemoryUsage() : -1;
if (program) {
reportCountStatistic("Files", program.getSourceFiles().length);

const lineCounts = countLines(program);
const nodeCounts = countNodes(program);
if (compilerOptions.extendedDiagnostics) {
if (compilerOptions.extendedDiagnostics || compilerOptions.solutionDiagnostics) {
for (const key of arrayFrom(lineCounts.keys())) {
reportCountStatistic("Lines of " + key, lineCounts.get(key)!);
}
Expand Down Expand Up @@ -1058,7 +1060,7 @@ namespace ts {
const bindTime = isPerformanceEnabled ? performance.getDuration("Bind") : 0;
const checkTime = isPerformanceEnabled ? performance.getDuration("Check") : 0;
const emitTime = isPerformanceEnabled ? performance.getDuration("Emit") : 0;
if (compilerOptions.extendedDiagnostics) {
if (compilerOptions.extendedDiagnostics || compilerOptions.solutionDiagnostics) {
if (program) {
const caches = program.getRelationCacheSizes();
reportCountStatistic("Assignability cache size", caches.assignable);
Expand All @@ -1085,9 +1087,9 @@ namespace ts {
if (isPerformanceEnabled) {
reportTimeStatistic("Total time", programTime + bindTime + checkTime + emitTime);
}
reportAllStatistics(sys, statistics);
if (compilerOptions.diagnostics || compilerOptions.extendedDiagnostics) reportAllStatistics(sys, statistics);
if (!isPerformanceEnabled) {
sys.write(Diagnostics.Performance_timings_for_diagnostics_or_extendedDiagnostics_are_not_available_in_this_session_A_native_implementation_of_the_Web_Performance_API_could_not_be_found.message + "\n");
sys.write(Diagnostics.Performance_timings_for_diagnostics_or_extendedDiagnostics_or_solutionDiagnostics_are_not_available_in_this_session_A_native_implementation_of_the_Web_Performance_API_could_not_be_found.message + "\n");
}
else {
performance.disable();
Expand Down