macrome-js / macrome

The in-tree build system
MIT License
7 stars 1 forks source link

Support non-checked-in files #25

Open conartist6 opened 3 years ago

conartist6 commented 3 years ago

Currently macrome assumes that all generated files are under version control. It should also be possible to do in-place building of files that are not under VCS. To implement this we will need to subscribe to some set of non-vcs changes and subscribe to them with defer instead of drop when the vsc_lock_held state is present. The main question is how we'll target each subscription. Currently watchman isn't given the targeting criteria which means there's no way to make the distinction at that level.

It seems to me that it will be appropriate to make the distinction between VCS and non-VCS generated assets at the generator level, i.e. allow generators to specify whether to drop or defer with regard to the vcs lock. The problem with this is that we currently only have one subscription, so we can't take advantage of that kind of power at a more granular level.

conartist6 commented 3 years ago

So let's game this out: is it possible for each generator to have its own subscription?

Let's imagine a ts-generator that turns *.ts into *.js. Let's say we have a second generator, index-generator which generates certain index.js files. In general the inputs to the ts generator may or may not be generated files, and we wish to avoid bouncing behavior, as in this example:

[routes/index.ts] => routes/index.js
[routes/foo.ts] => routes/index.ts => routes/index.js

Note that routes/index.js must be generated twice here. It should be possible to use changeset logic to avoid this though, simply by choosing not to treat routes/index.ts as a changeset root since it has the @generated header.

conartist6 commented 3 years ago

I think this can be supported using just two subscriptions: the current subscription to all files that drops vcs changes, and a new subscription to files which match paths defined by non-vcs generators which will defer changes made with a vcs lock present and drop everything else.