Skip to content

build(bazel): create script to run on top of ng_package output #10776

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 2 commits into from
Apr 10, 2018

Conversation

jelbourn
Copy link
Member

@jelbourn jelbourn commented Apr 9, 2018

No description provided.

@jelbourn jelbourn requested review from alexeagle and crisbeto April 9, 2018 19:54
@jelbourn jelbourn requested a review from devversion as a code owner April 9, 2018 19:54
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Apr 9, 2018
./scripts/bazel/update-material-metadata-reexports.js

# Update the Angular version used as a peerDependency for all of the packages.
ng_version=$(echo "console.log(require('./build-config').angularVersion)" | node)
Copy link
Member

Choose a reason for hiding this comment

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

Would it be better to use the replacements rule in ng_package for this?

See here and here

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 that's what it's for

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, didn't know that was there. I don't like that our gulp and bazel setups use a different constant, but it's tolerable.

./scripts/bazel/update-material-metadata-reexports.js

# Update the Angular version used as a peerDependency for all of the packages.
ng_version=$(echo "console.log(require('./build-config').angularVersion)" | node)
Copy link
Contributor

Choose a reason for hiding this comment

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

+1 that's what it's for

set -e

# Source directories for packages to build with bazel and copy into dist/
packages=(cdk lib cdk-experimental material-experimental material-moment-adapter)
Copy link
Contributor

Choose a reason for hiding this comment

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

you could consider doing a bazel query here like we do in Angular.
Then the configuration is more local (eg. use a tag on each package you want to pick up)

Copy link
Member Author

Choose a reason for hiding this comment

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

Done, I think. Not sure if it's exactly what you had in mind.

# The dist/ directory where we want to copy the final result. Clear it out to avoid
# any artifacts from earlier builds being retained.
packages_dist="./dist/bazel-packages"
rm -rf ${packages_dist}
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this actually do what you want? you want bazel clean but I think you'll just create another symlink into the output directory which is read-only

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 don't follow what you mean. I'm copying the the output from bazel-bin, copying it to ./dist and then modifying it (no symlink). I wipe out the directory in ./dist to make sure something from an earlier bazel build doesn't stick around.

Copy link
Contributor

Choose a reason for hiding this comment

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

resolved inperson

@jelbourn jelbourn requested a review from mmalerba as a code owner April 9, 2018 21:36

# Source directories for packages to build with bazel and copy into dist/
# We use the bazel tag "publish" as a marker for rules we care about here.
packages=$(bazel query --output=package 'attr(tags, publish, ...)' | xargs -n1 basename)
Copy link
Contributor

Choose a reason for hiding this comment

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

did you test this? I'm surprised you don't need to deal with tags being array-valued

Copy link
Member Author

Choose a reason for hiding this comment

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

Yep, works great. Copied this pattern from a bunch of similar examples via codesearch

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker and removed pr: needs review labels Apr 9, 2018
@tinayuangao tinayuangao merged commit 4211b39 into angular:master Apr 10, 2018
@mmalerba mmalerba removed the action: merge The PR is ready for merge by the caretaker label Apr 16, 2018
@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 Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes PR author has agreed to Google's Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants