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

Deprecate --templates-dir option. #3667

Merged
merged 2 commits into from
Feb 23, 2024
Merged

Deprecate --templates-dir option. #3667

merged 2 commits into from
Feb 23, 2024

Conversation

kallentu
Copy link
Member

Related to #3480.

Deprecate the option. (Which I'm actually not sure what more there is to do besides writing it in the command help. Let me know.)
Added an entry to the changelog for this change.


  • I’ve reviewed the contributor guide and applied the relevant portions to this PR.
Contribution guidelines:

Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.

@srawlins
Copy link
Member

In documentation_comment.dart, you can see how we warn( if the examplePathPrefix value is non-null. The same can be done in templates.dart, when templatesDir is non-null.

@kallentu
Copy link
Member Author

In documentation_comment.dart, you can see how we warn( if the examplePathPrefix value is non-null. The same can be done in templates.dart, when templatesDir is non-null.

Oh, happy to do that!
I looked around for a bit and couldn't find a Warnable that I could "warn" on. I think at that point in templates.dart, we haven't even built the package graph. Hmm, am I missing something?

@srawlins
Copy link
Member

Ah good catch. No I can't find anything easy to hang the warning on there. But the RuntimeTemplates there is used in a GeneratorBackend, so we could just delay the warning until it is used by the GeneratorFrontEnd (*grumble* inconsistent camel casing 😠), and trigger it based on is RuntimeTemplates, which is a little hacky.

A good spot might be at the beginning of GeneratorFrontEnd._generateDocs, something like if ((_generatorBackend as GeneratorBackendBase).templates is RuntimeTemplates) { packageGraph.defaultPackage.warn(...); }.

I don't like that cast, so maybe GeneratorFrontEnd._generatorBackend can be made a GeneratorBackendBase, or maybe one of the types in the hierarchy can be removed. A spoonful of tech debt helps the simple feature deprecation go down. 😁

@kallentu kallentu mentioned this pull request Feb 22, 2024
1 task
@kallentu
Copy link
Member Author

Added the warning for this, PTAL again :)

@kallentu kallentu merged commit 5a1700f into main Feb 23, 2024
11 checks passed
@kallentu kallentu deleted the deprecate-template-dir branch February 23, 2024 16:36
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