-
Notifications
You must be signed in to change notification settings - Fork 6.8k
build: switch to release output from bazel #17046
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: switch to release output from bazel #17046
Conversation
faf5d9d
to
75180f5
Compare
I can squash all other commits together, or we just preserve all. Either way, we should preserve the commit that removes the re-exports for the Material primary entry-point 🤷♂ @jelbourn @josephperrott This should be ready for review. Note that it looks like we don't have real integration tests that ensure that the package output works properly in CLI applications. I'd strongly advocate that this is something we should do next. Should be fairly simple to get an initial integration test. |
Needs rebase now and I need to apply the workaround for angular/angular#32610 to the Also two things missing (which I just noticed):
|
scripts/build-packages-dist.sh
Outdated
echo "> Copying package output to \"${targetDir}\".." | ||
rm -rf ${targetDir} | ||
cp -R ${pkgDir} ${targetDir} | ||
chmod -R u+w ${targetDir} |
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.
Can you also npm pack
the copied packages? That makes them easier to work with for some scenarios
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.
Good idea. We can do that, but let's do this as a follow-up.
we need to move the npm pack
-ed output to a different folder to not accidentally publish them within the release packages.
75180f5
to
e406972
Compare
fcb08e9
to
c8632ba
Compare
cbc9ed6
to
624c6ca
Compare
Addressed initial comments. Also I was able to work around the last big blocker in a reasonable way. I'll document the details of the workaround in the This should be ready for another review. I also manually tested the release output in the docs app and everything worked as expected. |
Removes the re-exports to all secondary entry-points from the Angular Material primary entry-point. BREAKING CHANGE: Components can no longer be imported through "@angular/material". Use the individual secondary entry-points.
The CDK contains stylesheet files which are re-rooted at the NPM package root. This needs to be done for the bazel package as well as it would otherwise break a lot of consumers.
We can't use "ts_library" for entry-points which should be part of a "ng_package". This is because "ng_package" currently only partially includes "ts_library" targets in the package (i.e. missing `package.json` file for secondary entry-points). Until we figure out what best practice is, or if angular/angular#32610 is merged, we just use "ng_module" to work around this issue.
…output The primary entry-point `package.json` files are not generated by the `ng_package` bazel rule. This is by intention because it does not try to overwrite existing `package.json` files in the release output (i.e. to preserve placeholders; dependencies etc.) We need to update the `package.json` fields to match the new release output that is generated by Bazel. Also adds a new release output validation that ensures that those fields in the `package.json` files are resolving to existing files.
Currently with Gulp we have a **hacky** script that fixes up relative imports in sass files. This is something we cannot easily do with Bazel when we assemble the release package. Primarily because of that limitation/complexity with Bazel and the general preference to avoid such hacky rewrites, we now ship all individual "scss_lib" files to the release output. This way all relative style references remain *correct* when the release packages are assembled. This means that we no longer need a hacky script to rewrite the imports. For backwards compatibility, the `_theming.scss` entry-point at the root of the Material package is still created. It just isn't a sass bundle anymore, but the functionality remains the same (making it a bundle means we repeat a *lot* of code; also there no real big benefit as we don't have too deep dependencies) Same has been done for the CDK sass files (overlay, a11y, text-field), where we still expose the prebuilt css and sass files at the top-level of the release output. In the future, we can consider removing these backwards-compatibility changes in favor of a less convoluted bazel setup.
Fixes the missing metadata for example modules. This happens because we built the individual example modules without a flat module bundle. Not building with a flat module bundle means that metadata will not be generated in the `ng_module` bazel rule.
Applies a workaround for the invalid imports generation issue in the Bazel `ng_module` rule. Read more about this here: https://hackmd.io/@devversion/ryCOwIKIS.
Apparently the `google-maps` package has the same problem as the `material-examples` package where the metadata for the Bazel sub-packages is not incldued in the entry-point of the `@angular/google-maps` entry-point. There are two solutions to make it work with Angular package format: * Making the packages generate flat module bundles and including them as secondary entry-points * Only having one Bazel package so that metadata will be included in the flat module bundle. I chose the latter as the `google-maps` package is still very small and doesn't have a lot of dependencies, so in terms of speed it is even faster to have on package. Also it seems like there were never plans to have secondary entry-points for that package.
624c6ca
to
3c938b0
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. |
No description provided.