-
Notifications
You must be signed in to change notification settings - Fork 6.8k
build: ensure all entry-points are included in release package #17186
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
build: ensure all entry-points are included in release package #17186
Conversation
5543644
to
894a6d9
Compare
src/a11y-demo/BUILD.bazel
Outdated
@@ -21,5 +22,5 @@ ng_module( | |||
"@npm//@angular/animations", | |||
"@npm//@angular/forms", | |||
"@npm//@angular/router", | |||
] + CDK_TARGETS + MATERIAL_TARGETS, | |||
] + CDK_TARGETS + MATERIAL_NO_TEST_TARGETS, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about the naming here. We basically have two types of entry-points:
- Public non-test entry-points.
- Test entry-points.
Since we are lazy here and not want to manually list specific entry-points used by the a11y-app
, I figured I'd add a NO_TEST_TARGETS
variable as well. We don't want to build the testing entry-points unnecessarily.
Also we need some kind of variable for non-testing entry-points as only those have an overview (as of right now) and a scss_lib
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An option would be, instead of creating two exports, export an object that has ALL_TARGETS
and WITHOUT_TEST_TARGETS
e.g. MATERIAL.ALL_TARGETS
and MATERIAL.WITHOUT_TEST_TARGETS
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds like an option, but I'm not sure if we benefit from it. Especially since it would be not consistent with the SCSS
export variable for example.
Regardless of whether we use one or two exports, I guess we'll always use something like NO_TESTS
or WITHOUT_TESTS
. And this is the part where I look for an alternative 😞 (it feels somehow dirty but it's actually the most clear name; and will avoid confusion)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer something like material_component_entrypoints
and material_testing_entrypoints
, and anywhere you wanted both you explicitly concat them, which I think would prevent anyone from accidentally including something they didn't mean to.
(side note: I looked up the bzl style guide for this change, and they do recommend lower_snake_case, which we could do at a later date)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like the idea of just having non-testing and testing. Concatenating both should be straightforward enough 👍
Slightly unsure about component
though. Not all entry-points expose a component. If we can improve that somehow, then I think we have a good naming convention. Can't think of anything else than no_test
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
component
isn't perfect, but I think it's preferable to something like without_tests
. I also considered words like primary
, main
, root
, top
lib
, browser
, but I didn't think of any of these work as well.
894a6d9
to
ca59b3c
Compare
ca59b3c
to
5942fbd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall I like the direction of it
src/a11y-demo/BUILD.bazel
Outdated
@@ -21,5 +22,5 @@ ng_module( | |||
"@npm//@angular/animations", | |||
"@npm//@angular/forms", | |||
"@npm//@angular/router", | |||
] + CDK_TARGETS + MATERIAL_TARGETS, | |||
] + CDK_TARGETS + MATERIAL_NO_TEST_TARGETS, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An option would be, instead of creating two exports, export an object that has ALL_TARGETS
and WITHOUT_TEST_TARGETS
e.g. MATERIAL.ALL_TARGETS
and MATERIAL.WITHOUT_TEST_TARGETS
src/a11y-demo/BUILD.bazel
Outdated
@@ -21,5 +22,5 @@ ng_module( | |||
"@npm//@angular/animations", | |||
"@npm//@angular/forms", | |||
"@npm//@angular/router", | |||
] + CDK_TARGETS + MATERIAL_TARGETS, | |||
] + CDK_TARGETS + MATERIAL_NO_TEST_TARGETS, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer something like material_component_entrypoints
and material_testing_entrypoints
, and anywhere you wanted both you explicitly concat them, which I think would prevent anyone from accidentally including something they didn't mean to.
(side note: I looked up the bzl style guide for this change, and they do recommend lower_snake_case, which we could do at a later date)
(1) Overhauls the whole release packaging structure in Bazel. Since it is very verbose to put everything into a single `.bzl` file in the project root, information for each release package will be stored in the actual package folder in a file called `config.bzl`. (2) We no longer use the term `PACKAGE` for entry-points of packages. It's not correct and easy to confuse with the actual package. (3) We group entry-points in nested arrays. This has no effect for now, but it gives us a nicer way of configurating (nested) entry-points. It might become useful in the future as well as we have information about nested entry-points of an entry-point. (4) Revisits the list of all entry-points so that we now include all `*/testing` entry-points in the release output. Also a few MDC prototypes were not included in the Bazel material-experimental release output. Same as clipboard in cdk-experimental. (5) Simplifies the logic to generate the rollup globals (through functions). Also we move the rollup globals into a separate `.bzl` file. Also rollup globals are now automatically passed into the `ng_package` rule.. so we don't need to re-declare them for each package.
5942fbd
to
2b9ff05
Compare
2b9ff05
to
141d82e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
(1) Overhauls the whole release packaging structure in Bazel. Since it is
very verbose to put everything into a single
.bzl
file in the project root,information for each release package will be stored in the actual package
folder in a file called
config.bzl
.(2) We no longer use the term
PACKAGE
for entry-points ofpackages. It's not correct and easy to confuse with the actual package.
(3) We group entry-points in nested arrays. This has no effect for now, but
it gives us a nicer way of configurating (nested) entry-points. It might become
useful in the future as well as we have information about nested entry-points of
an entry-point.
(4) Revisits the list of all entry-points so that we now include all
*/testing
entry-points in the release output. Also a few MDC prototypes were not included
in the Bazel material-experimental release output. Same as clipboard in cdk-experimental.
(5) Simplifies the logic to generate the rollup globals (through functions). Also we move the
rollup globals into a separate
.bzl
file. Also rollup globals are now automatically passedinto the
ng_package
rule.. so we don't need to re-declare them for each package.In follow-ups/future: we should work on validating somehow that all entry-points are listed in these files. To avoid that we accidentally forget some.