Skip to content

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

Conversation

devversion
Copy link
Member

@devversion devversion commented Sep 24, 2019

(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.

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.

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Sep 24, 2019
@devversion devversion force-pushed the build/ensure-entry-points-in-release-package branch 2 times, most recently from 5543644 to 894a6d9 Compare September 24, 2019 11:51
@@ -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,
Copy link
Member Author

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.

Copy link
Member

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

Copy link
Member Author

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 SCSSexport 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)

Copy link
Member

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)

Copy link
Member Author

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.

Copy link
Member

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.

@devversion devversion marked this pull request as ready for review September 24, 2019 11:59
@devversion devversion requested review from jelbourn, mmalerba and a team as code owners September 24, 2019 11:59
@devversion devversion added this to the 9.0.0 milestone Sep 24, 2019
@devversion devversion force-pushed the build/ensure-entry-points-in-release-package branch from 894a6d9 to ca59b3c Compare September 24, 2019 12:16
@devversion devversion added the target: patch This PR is targeted for the next patch release label Sep 24, 2019
@devversion devversion force-pushed the build/ensure-entry-points-in-release-package branch from ca59b3c to 5942fbd Compare September 24, 2019 12:37
Copy link
Member

@josephperrott josephperrott left a 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

@@ -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,
Copy link
Member

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

@@ -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,
Copy link
Member

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.
@devversion devversion force-pushed the build/ensure-entry-points-in-release-package branch from 5942fbd to 2b9ff05 Compare September 25, 2019 20:17
@devversion devversion force-pushed the build/ensure-entry-points-in-release-package branch from 2b9ff05 to 141d82e Compare September 25, 2019 20:21
Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

LGTM

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker labels Sep 25, 2019
@andrewseguin andrewseguin merged commit 1e74db9 into angular:master Sep 27, 2019
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Oct 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants