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

One InputTracker per build #3881

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

davidmorgan
Copy link
Contributor

For #3811, review and merge #3876 first.

Unify test and non-test input tracking by having one input tracker per build, using the current primary input ID as a key.

Copy link

PR Health

Changelog Entry
Package Changed Files
package:build_resolvers build_resolvers/lib/src/analysis_driver_model.dart

Changes to files need to be accounted for in their respective changelogs.

This check can be disabled by tagging the PR with skip-changelog-check.

class InputTracker {
final assetsRead = HashSet<AssetId>();
final _inputs = HashMap<AssetId, HashSet<AssetId>>();
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't believe this is safe to do this way, if I understand it correctly. The keys in this map would need to be the output ids, instead of the primary input id.

The reason being that an asset can be a primary input to any number of different actions.

I would try adding a test where there are two builders with the same input extension, but which read different additional files during the build, and make sure they don't pick up each other's dependencies.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks.

That was my suspicion too ... I'll look at adding test coverage as you suggest.

It might make sense to just number the build actions incrementally :)

Copy link
Contributor

Choose a reason for hiding this comment

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

There are numbered phases, and each phase only applies a single builder, so this would be safe if they were per phase and not per entire build.

Copy link
Contributor

@jakemac53 jakemac53 Feb 25, 2025

Choose a reason for hiding this comment

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

Another consideration here is this will retain these sets much longer in memory (for an entire build), instead of releasing them as soon as a build step completes.

Doing this per phase will have the same problem because phases don't actually execute sequentially.

@davidmorgan davidmorgan mentioned this pull request Feb 25, 2025
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

Successfully merging this pull request may close these issues.

2 participants