Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support --incremental builds by emitting .buildinfo #611

Open
michaelaird opened this issue Mar 17, 2019 · 19 comments
Open

Support --incremental builds by emitting .buildinfo #611

michaelaird opened this issue Mar 17, 2019 · 19 comments

Comments

@michaelaird
Copy link
Contributor

Typescript 3.4 introduces emitting .tsbuildinfo files that are used for --incremental builds outside of --watch: https://devblogs.microsoft.com/typescript/announcing-typescript-3-4-rc/

gulp-typescript should emit the appropriate .tsbuildinfo files.

@jeffrson
Copy link

jeffrson commented Apr 2, 2019

NB: unfortunately, setting "incremental", either in tsconfig.json or in the call to gulp-typescript, doesn't work.

@adriangodong
Copy link

This may need to wait for typescript to provide an API
microsoft/TypeScript#29978

@nealeu
Copy link

nealeu commented Apr 10, 2019

If you want to use typescript 3.4 with gulp-typescript on composite builds, then you can trick typescript into not tripping up by explicitly setting tsBuildInfoFile:

        "tsBuildInfoFile": "./buildcache/tsBuildInfo",

I needed to find a way for us as we'd like to keep in step on language features and we can now use incremental in our dev build.

@mzyil
Copy link

mzyil commented Apr 11, 2019

If you want to use typescript 3.4 with gulp-typescript on composite builds, then you can trick typescript into not tripping up by explicitly setting tsBuildInfoFile:

        "tsBuildInfoFile": "./buildcache/tsBuildInfo",

I needed to find a way for us as we'd like to keep in step on language features and we can now use incremental in our dev build.

Unfotunately this didn't work for us. There is still no ".tsBuildInfo"

@nealeu
Copy link

nealeu commented Apr 12, 2019

@mzyil

You won't be able to get that until this issue is resolve which depends on API support.

We're using tsc --build for our developer build and then gulp-typescript for our production bundle.

@mzyil
Copy link

mzyil commented Jun 6, 2019

The Typescript issue is now closed: microsoft/TypeScript#29978
Any plans to work on this?

@arieldf
Copy link

arieldf commented Jun 7, 2019

Having support for the --incremental flag would be great.

@ivogabe
Copy link
Owner

ivogabe commented Jun 8, 2019

Great news that TypeScript now exposes this in an API. I personally won't have time to work on this in the following weeks. If someone wants to work on this, let me know and I'd be happy to give some guidance.

I'm not that familiar with the tsc --build option. For incremental compilation, it seems like we must use createIncrementalProgram instead of createProgram. For the first compilation we need to pass that function the build information from the .buildinfo file which we get using readBuilderProgram. For further incremental compilations, we just need to pass it the old Program just like we're already doing.

@michaelaird
Copy link
Contributor Author

I took a first crack at emitting .buildinfo files (#618) . This might be enough?

@mzyil
Copy link

mzyil commented Jun 16, 2019

@michaelaird does your PR enable the incremental builds only if the option in tsconfig.json is set?

 "tsBuildInfoFile": "./buildcache/tsBuildInfo",

or do we need to change something else in the stream?

@michaelaird
Copy link
Contributor Author

michaelaird commented Jun 16, 2019 via email

@pronebird
Copy link

Any workaround available? It takes like 5 seconds to build all my scripts, and it takes milliseconds when in incremental mode.

@michaelaird
Copy link
Contributor Author

It's entirely possible that my changes targeting 3.4/3.5 are entirely useless with 3.6 and the correct approach is to tie into the the new apis to support incremental builds (microsoft/TypeScript#31849) , ie createIncrementalCompilerHost and createIncrementalProgram.

@ivogabe
Copy link
Owner

ivogabe commented Sep 13, 2019

That’s a good point, I’ll try to make some time for it this weekend

@mzyil
Copy link

mzyil commented Sep 20, 2019

any updates on this?

@ivogabe
Copy link
Owner

ivogabe commented Sep 20, 2019

There were some issues with the tests, after upgrading TypeScript. I don’t get them locally, so it may be OS related.

The tsbuildinfo file can currently crash the compiler, so I was preparing a temporary fix which would just ignore the tsbuildinfo file, and then later implement the new incremental apis. I’ll continue with it in this weekend

@michaelaird
Copy link
Contributor Author

@ivogabe Thank you! Please let me know if i can help.

@bgedik
Copy link

bgedik commented Oct 4, 2019

Any updates on this?

@ivogabe
Copy link
Owner

ivogabe commented Nov 17, 2019

Work-in-progress PR in #635. Some functionalities of the new API are not clear to me yet, I hope to get more information on that soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants