Skip to content

Mustachio: Add getProperty(), and end-to-end Renderer test #2442

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 6 commits into from
Dec 2, 2020

Conversation

srawlins
Copy link
Member

@srawlins srawlins commented Nov 30, 2020

The generated code now always references the library that generated it, on the
assumption that it needs types from that file. This is not necessarily correct,
but is a decent approximation until we start using code_builder.

RendererBase now needs to know about the renderer of the parent context type,
so it gets a new field.

Property and each renderer's propertyMap gets corrected code; the runtime tests
revealed some runtime type bugs.

…test

This includes some unorthodox tests: I've added a package in
`testing/mustachio`, complete with a pubspec.yaml and a build.yaml. These are
required in order to test the runtime behavior of generated code; in order to
make assertions on the generated code (not its String content, but its runtime
properties), it must be generated with public classes (the default is private).
In order to pass a configuration to the Builder, I need a build.yaml separate
from dartdoc's.

In order to import `testing/mustachio/lib/foo.renderers.dart`, and resolve that
library's reference to `package:testing_mustachio/foo.dart`, I need to add
`testing_mustachio` to `dev_dependencies`.

In order to reference the builders from the testing package, the builder code
needed to move from `tool/mustachio/` to `lib/src/mustachio/`.

The generated code now always references the library that generated it, on the
assumption that it needs types from that file. This is not necessarily correct,
but is a decent approximation until we start using code_builder.

RendererBase now needs to know about the renderer of the parent context type,
so it gets a new field.

Property and each renderer's propertyMap gets corrected code; the runtime tests
revealed some runtime type bugs.
@google-cla google-cla bot added the cla: yes Google CLA check succeeded. label Nov 30, 2020
@srawlins srawlins requested a review from jcollins-g November 30, 2020 21:48
@srawlins
Copy link
Member Author

@jcollins-g what do you think about the try-publish failure? Moving the builder to lib/ would necessitate (?) that package:build move to be a proper dep. Yuck. Is this ignorable?

@srawlins
Copy link
Member Author

srawlins commented Dec 1, 2020

@jcollins-g OK I think I've got this working; I've added a second build target in build.yaml which builds testing code. build_runner refused to generate any files in testing/ (I still don't get that), so my test file is at test/mustachio/foo.dart.

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.

Approved assuming that a rebuilding check for foo.dart is added.

@srawlins srawlins merged commit a8d14b0 into dart-lang:master Dec 2, 2020
@srawlins srawlins deleted the mustachio-6 branch December 2, 2020 14:44
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.

2 participants