-
Notifications
You must be signed in to change notification settings - Fork 232
Can we remove "placeholder" files? #864
Comments
What are the downsides to having it? Are we OK keeping the file as part of the build if we can remove it from the deployed output? dart-lang/build#189 |
Confusing our engineers when we remember it exists every 3-6 months 😆
This is certainly better, but not perfect. |
@natebosch I don't understand why the builder can't tell us that file (will) exists? Aren't all the outputs declared ahead of time? |
@leonsenft we can know that it might exist, but not that it will exist. Also exposing an api for this would be tricky, because your builder now has to have a dependency on the fact that there is a declared output for that node, but right now you are only allowed to have inputs from phases earlier than your own. We would have to add some sort of special node type or something to represent this type of dependency, but it should be doable. |
In bazel we could know that it will exist. (since we have default content for it). We'd still need some brand new config to express our desire to pretend it exists without actually writing it. |
@jacob314 Why is that? Excuse my complete lack of knowledge of the package:build* family implementation, but don't you declare your inputs/outputs in the So if I declare that for each Or can a builder opt not to generate the corresponding output? Or do we not walk the project tree to collect all inputs before running the builders? |
@leonsenft Yes a builder can opt to not output a file it declares in build_runner, so we can avoid creating a bunch of empty files like we do in bazel. That builder still "owns" that file though, so nobody else can output it even if they decide not to. |
Understood, thanks! |
@jakemac53 How would you feel about at least removing these files in Bazel-mode? |
@matanlurey We could potentially remove it in both modes if we gave the builder access to the Angular could know what it was asked to build, and from that make safe assumptions about what it will output. Same thing could work in bazel and build_runner. We also already support proper invalidation based on the BuilderOptions. |
I'll leave the details up to you, but if you're OK with it would be nice to remove this complexity. |
@jakemac53 What is the distinction with that and what I asked? From your last reply I got the impression the builder could still potentially not produce that file? |
tl;dr; - synced with Jake offline and letting you read longer replies:
In
This, unfortunately, isn't sufficient to make the decision. In If we did work out these problems we end up with a lot of code to support properly invalidating outputs when files are added or removed, and could end up calling builds more often than necessary - we can prune more intelligently with the placeholder file. |
Thanks! I'm going to mark this as "not planned" for now. |
Uh oh!
There was an error while loading. Please reload this page.
We have the concept of a
.ng_placeholder
file, which means, roughly:For
{file}.ng_placeholder
a{file}.template.dart
will exist in a future phase.This is because while we can check the file system for dependencies, our own current "target" (terminology varies based on
bazel
orbuild_runner
) may not have wrote certain files yet. Imagine the following:... and imagine
a.dart
looks like this:We need to be able to generate, in
a.template.dart
:Ideas
In
bazel
, passgenerate_for
/ inpus as a command-line argument:$ generator --input-list="a.dart,b.darrt"
In
build_runner
...I'm not sure. Maybe we have to continue to use placeholder files here.
/cc @jakemac53 @natebosch @leonsenft
The text was updated successfully, but these errors were encountered: