Skip to content

Remove packageGraph from TemplateData. #2379

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

Merged
merged 1 commit into from
Oct 8, 2020

Conversation

srawlins
Copy link
Member

@srawlins srawlins commented Oct 7, 2020

Fixes #2377

Breaking change for any custom templates which reference packageGraph.

This opens up too many possibilities for templates, and requires knowledge of
the PackageGraph class's interface.

Instead, offer localPackages iterator and defaultPackage field on
TemplateData.

**Breaking change** for any custom templates which reference `packageGraph`.

This opens up too many possibilities for templates, and requires knowledge of
the PackageGraph class's interface.

Instead, offer `localPackages` iterator and `defaultPackage` field on
TemplateData.
@google-cla google-cla bot added the cla: yes Google CLA check succeeded. label Oct 7, 2020
@srawlins srawlins requested a review from jcollins-g October 8, 2020 16:20
@srawlins
Copy link
Member Author

srawlins commented Oct 8, 2020

@jcollins-g what do you think of this change? Maybe #2377 is just an opinion of mine, and referencing packageGraph in templates is fine... Like narrowing the API of what you can access in templates is an unending can of worms, but I dunno. What do you think?

Copy link
Contributor

@jcollins-g jcollins-g left a comment

Choose a reason for hiding this comment

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

I agree with the general idea of restricting the surface in this way, constraining to getters on Template classes where possible. Does this work with the markdown templates included with Dartdoc? They too reference packageGraph.

@srawlins
Copy link
Member Author

srawlins commented Oct 8, 2020

For some reason only the index.md template referenced packageGraph.

Copy link
Contributor

@jcollins-g jcollins-g left a comment

Choose a reason for hiding this comment

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

OK. As long as what's referenced here works, the breaking change notice we'll drop in the changelog seems good enough.

@srawlins srawlins merged commit 611f5a9 into dart-lang:master Oct 8, 2020
@srawlins srawlins deleted the no-more-graph-in-templates branch October 8, 2020 18:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Google CLA check succeeded.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide more getter helpers for templates; use fewer extraneous objects
2 participants