GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Build .tsbuildinfo file when building using tsc --b by sheetalkamat · Pull Request #29813 · microsoft/TypeScript

Conversation

@sheetalkamat

@sheetalkamat Sheetal Nandi (sheetalkamat) commented Feb 7, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member
  • When tsconfig specifies compiler options incremental file with .tsbuildinfo extension is emitted.
  • Composite projects indirectly specify incremental as true and its error to specify incremental as false in the composite project
  • If project specifies tsBuildInfoFile options, it uses the path specified by that to write the build information.
  • If project specifies out or outFile option, the outFileWithoutExtension.tsbuildinfo file is written next to output js file.
  • If project specified outDir, config files base file name with extension as .tsbuildinfo is written in outDir
  • Otherswise config files base file name with extension as .tsbuildinfo is written next to the config file
  • Generated file is json with type as BuildInfo shown below.
    export interface SourceFileInfo {
        // List of helpers in own source files emitted if no prepend is present
        helpers?: string[];
        prologues?: SourceFilePrologueInfo[];
    }

    export interface BundleFileInfo {
        sections: BundleFileSection[];
        sources?: SourceFileInfo;
    }

    export interface BundleBuildInfo {
        js?: BundleFileInfo;
        dts?: BundleFileInfo;
        commonSourceDirectory: string;
        sourceFiles: ReadonlyArray<string>;
    }

    export interface ProgramBuildInfo {
        fileInfos: MapLike<BuilderState.FileInfo>;
        options: CompilerOptions;
        referencedMap?: MapLike<string[]>;
        exportedModulesMap?: MapLike<string[]>;
        semanticDiagnosticsPerFile?: string[];
    }

    export interface BuildInfo {
        bundle?: BundleBuildInfo;
        program?: ProgramBuildInfo;
        version: string;
    }
  • Field program in buildInfo is Builder information so we can track the file changes since that version and build incrementally even without watch (that is emitting only affected files or getting errors only from changed/affected files). This should help us get perf similar to --w incremental builds even on subsequent invokes of build (In short we are serializing information of builder program that we keep in memory during incremental builds in --w mode). Also pulled 6c5ae93 to store semantic diagnostics though in --b scenario it will always be just file name as emit happens only if there are no errors.
  • Field bundle stores information to be able to emit into single file. This consists of different sections in file, eg. prologues, prepended file contents and their range's. When having project that references another project with prepend as true, this helps in faster emit when the referenced project changes but it doesn't change declaration file. Previously we would have to create program for project referencing changed output to generate new output, but this just uses section information from buildinfo file and emit new output without having to create program. This saves us time for creating program and checking errors (since the errors are not cached with --out as we cant tell change in declaration emit) and emitting all files. Having section also fixes issues like Duplicate "use strict" prologue in the generated output.  #25550 to generate better output.
  • if version of compiler does not match with version in the buildInfo file, it starts fresh build
  • The bundle information also contains internal declaration sections, so if project has stripInternal instead of concatenating whole string it skips out portions of internal and generates correct .d.ts
  • Currently the build info is generated and emitted in emitter but the information comes from two places, emitter itself (about --out) and the other from the program itself which is actually builder program (so one level of abstraction outside of the program). Open to suggestion if there is different way to write this information. Goal was to not write files multiple time (eg once by builder and once by emitter). Also another thought is that builder doesn't do anything or change much if the scenario is --out since any change means new emit and new diagnostics, so its ok to not store program information in this case and in other scenario there is nothing of importance in those other section than program so may be separating these two (reading and writing only modified field) might not be a bad decision. But will need to see how that goes.

Measured perf with updating LKG from master to build this branch using gulp local and then with this branch's build as LKG and using gulp local

Build With Master With this branch
After clean Finished 'local' after 52 s Finished 'local' after 36 s
Local change without --d change Finished 'local' after 44 s Finished 'local' after 25 s
Local change revert Finished 'local' after 44 s Finished 'local' after 21 s

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

RyanCavanaugh, DanielRosenwasser, timocov, mihailik, maxmilton, and sdwvit reacted with hooray emoji DanielRosenwasser, BoruiGu, timocov, mihailik, bradleyayers, and sdwvit reacted with heart emoji DanielRosenwasser, BoruiGu, timocov, mihailik, sdwvit, anri-asaturov, and c69 reacted with rocket emoji
All reactions
  • 🎉 6 reactions
  • ❤️ 6 reactions
  • 🚀 7 reactions
Sheetal Nandi (sheetalkamat) added 30 commits January 25, 2019 14:31
@sheetalkamat
Write testcase to baseline with strict, prologues, shebangs
edfc91a
@sheetalkamat
Generate readable source map baselines for -b --out scenario
607891b
@sheetalkamat
Handle shebang when using prepend nodes
6e57709
@sheetalkamat
Tests for multiple prologues
a90ff10
@sheetalkamat
Handle prologues in prepend outputs
c739def
@sheetalkamat
Handle emit helpers in --out scenario
36eae04
@sheetalkamat
Handle triple slash refs
ff027d4
@sheetalkamat
Use bundle info to store info about prologues, emit Helpers, referenc…
0aaa880
…es etc
@sheetalkamat
Handle --clean with .tsbuildinfo
d5b5f8d
@sheetalkamat
Dont assert but verify sourceMapGenerator
9dabe69
@sheetalkamat
Create tests when bundleInfo file is not present
36ae7be
@sheetalkamat
Dont use tsbundleInfo to determine if bundle needs to be rebuilt
717dad9
@sheetalkamat
Merge branch 'master' into prependWithBundleInfo
c8ff9ac
@sheetalkamat
Make file generic to be .tsbuildinfo
00873f6
@sheetalkamat
Make the bundle info into buildInfo
0d9cf96
@sheetalkamat
Merge branch 'master' into prependWithBundleInfo
315a4dd
@sheetalkamat
More logs verification
bb76259
@sheetalkamat
Test case when final project isnt composite project
d1f3aca
@sheetalkamat
Fix UnparsedPrologue kind
aa74fa1
@sheetalkamat
If the project only needs prepend output to be changed, prepare to ju…
bd76940
…st manipulate output

Step 1: Update the verbose log to reflect it
@sheetalkamat
Generate .tsbuildInfo if bundle uses references with prepend
39e37a2
@sheetalkamat
Create prepend text sections in .buildInfo
362c78e
@sheetalkamat
Create nodes for unparsed text, prepend text
b15cb6b
@sheetalkamat
Add SourceMapUrl to section
38e0d4d
@sheetalkamat
Use same property name for BundleFileSection and UnparsedNode for eas…
f7281e3
…y node creation
@sheetalkamat
Separate out the tests for tsbuild into its own folder
db3a4fe
@sheetalkamat
Baseline incremental build baselines
4205eaf
@sheetalkamat
Dont diff with only sources in incremental compilation, diff with the…
3cf46f1
… base build
@sheetalkamat
Some more reorg in test
b7defb3
@sheetalkamat
Dont do base build again for each incremental scenario
10f0131
@sheetalkamat Sheetal Nandi (sheetalkamat) mentioned this pull request Mar 6, 2019
[WIP] buildInfo to manipulate and update output of --out when .d.ts of reference doesnt change #29738
Closed
RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh) reviewed Mar 8, 2019
View reviewed changes
Comment thread src/compiler/emitter.ts Outdated
if (declarationMapText === text) return;
break;
default:
Debug.assertNever(name as never);

@RyanCavanaugh Ryan Cavanaugh (RyanCavanaugh) Mar 8, 2019 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Asserting to never here defeats the purpose of the assertNever function

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@RyanCavanaugh Ryan Cavanaugh (RyanCavanaugh) Mar 8, 2019

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

i.e. this should just be Debug.fail

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh) approved these changes Mar 8, 2019
View reviewed changes
Sheetal Nandi (sheetalkamat) added 3 commits March 8, 2019 10:22
@sheetalkamat
Change to debug fail instead of assert never
fbfd349
@sheetalkamat
Merge branch 'master' into incrementalBuildInfo
990b199
@sheetalkamat
To test platform independent buildInfo baselines, move the logic to w…
d4cfa41
…riteFile of SolutionBuilderHost
@DanielRosenwasser Daniel Rosenwasser (DanielRosenwasser) mentioned this pull request Mar 8, 2019
Design Meeting Notes, 3/8/2019 #30279
Closed
Sheetal Nandi (sheetalkamat) added 2 commits March 8, 2019 13:32
@sheetalkamat
Add compiler version to buildInfo
409d6c9
@sheetalkamat
Add tests that will verify that all rebuilding with new compiler vers…
ecb2ce4
…ion builds again
@DanielRosenwasser Daniel Rosenwasser (DanielRosenwasser) mentioned this pull request Mar 8, 2019
TypeScript 3.4 Iteration Plan #30281
Closed
Sheetal Nandi (sheetalkamat) added 2 commits March 8, 2019 15:14
@sheetalkamat
Build project if existing project was built with different compiler v…
68e28da
…ersion
@sheetalkamat
Update LKG
b2cda16
@sheetalkamat

Sheetal Nandi (sheetalkamat) commented Mar 8, 2019

Copy link
Copy Markdown
Member Author

Ryan Cavanaugh (@RyanCavanaugh) Added logic to start from scratch if not same compiler version as discussed in design meeting.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sheetalkamat
Sheetal Nandi (sheetalkamat) merged commit 97fbc87 into master Mar 8, 2019
@sheetalkamat
Sheetal Nandi (sheetalkamat) deleted the incrementalBuildInfo branch March 8, 2019 23:52
@mohsen1 Mohsen Azimi (mohsen1) mentioned this pull request Mar 9, 2019
Massive performance penalty when shouldProvideParserServices is true typescript-eslint/typescript-eslint#243
Closed
@Jojoshua Josh Harris (Jojoshua) mentioned this pull request Mar 17, 2019
types.ts files do not trigger rebuild in webpack-dev-server TypeStrong/fork-ts-checker-webpack-plugin#36
Closed
@sdwvit

Victor Musienko (sdwvit) commented Mar 23, 2019

Copy link
Copy Markdown

Best feature of 3.4!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@tommedema

Tom Medema (tommedema) commented Mar 29, 2019

Copy link
Copy Markdown

Should we commit .tsbuildinfo files to version control?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sheetalkamat

Sheetal Nandi (sheetalkamat) commented Mar 29, 2019

Copy link
Copy Markdown
Member Author

Tom Medema (@tommedema) They are like the output .js files and shouldn't be committed to version control.

sdwvit and tommedema reacted with thumbs up emoji
All reactions
  • 👍 2 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sdwvit

Victor Musienko (sdwvit) commented Mar 29, 2019

Copy link
Copy Markdown

Tom Medema (@tommedema) don't think so, it is a cache which will be overridden by next tsc launch if code changes

tommedema reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bradzacher Brad Zacher (bradzacher) mentioned this pull request Apr 6, 2019
Poor performance on some projects typescript-eslint/typescript-eslint#389
Closed
@TheSpyder

Andrew Herron (TheSpyder) commented Apr 6, 2019

Copy link
Copy Markdown
  • If project specified outDir, config files base file name with extension as .tsbuildinfo is written in outDir
  • Otherswise config files base file name with extension as .tsbuildinfo is written next to the config file

This isn't the behaviour I'm seeing using 3.4.2, it's falling through to the last path option for the build info file. I'm working on a composite project in a yarn workspace, with a config that begins with

{
  "compilerOptions": {
    "outDir": "lib",
    "rootDir": "src",
    "composite": true,
    "baseUrl": "."
  }
}

When using tsc -b it's generating the tsconfig.tsbuildinfo file next to the config file instead of in the lib folder. I have to specify "tsBuildInfoFile": "lib/tsconfig.tsbuildinfo" manually.

Should I log a new issue for this? It seems easy to repro but I can work on one if needed.

intelliot reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@glen-84

Glen (glen-84) commented Apr 26, 2019

Copy link
Copy Markdown

Andrew Herron (@TheSpyder) #30925.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@TheSpyder

Andrew Herron (TheSpyder) commented Apr 29, 2019

Copy link
Copy Markdown

Ah, thank you!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@TheSpyder Andrew Herron (TheSpyder) mentioned this pull request Apr 29, 2019
Incorrect place of tsbuildinfo file when rootDir option is specified #30925
Closed
@bajtos Miroslav Bajtoš (bajtos) mentioned this pull request May 23, 2019
feat(build): enable incremental compilation loopbackio/loopback-next#2928
Merged
2 tasks done
@henry-filosa Henry Filosa (henry-filosa) mentioned this pull request May 24, 2022
Incomplete description of tsBuildInfoFile config default behavior microsoft/TypeScript-Website#2393
Closed
@jakebailey Jake Bailey (jakebailey) mentioned this pull request Mar 23, 2024
Remove sys.bufferFrom, duplicate Buffer declarations, etc #57916
Merged
@microsoft Microsoft (microsoft) locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

@RyanCavanaugh Ryan Cavanaugh (RyanCavanaugh) RyanCavanaugh approved these changes
@rbuckton Ron Buckton (rbuckton) Awaiting requested review from rbuckton

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@RyanCavanaugh Ryan Cavanaugh (RyanCavanaugh)

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

7 participants

@sheetalkamat @DanielRosenwasser @RyanCavanaugh @sdwvit @tommedema @TheSpyder @glen-84
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.