Skip to content

build(cdk): add bazel ng_module rules #8370

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 1 commit into from
Nov 15, 2017
Merged

Conversation

jelbourn
Copy link
Member

Part of #8369

This is setup for eventually switching everything to bazel. It does not affect our real build yet.

cc @devversion

@jelbourn jelbourn added area: dev-infra Issue related to internal project infrastructure pr: needs review labels Nov 11, 2017
@jelbourn jelbourn requested a review from alexeagle November 11, 2017 00:46
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Nov 11, 2017
@jelbourn jelbourn force-pushed the bazel branch 3 times, most recently from fef0808 to f705b63 Compare November 14, 2017 17:51
@@ -0,0 +1,35 @@
package(default_visibility = ["//visibility:public"])
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe we should use //:__subpackages__ as the default visibility everywhere, to avoid external repos depending on our rules

Copy link
Member Author

Choose a reason for hiding this comment

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

If I try to use that here I get:

ERROR: /usr/local/google/home/jelbourn/.cache/bazel/_bazel_jelbourn/2010aad45cf3f55bb7127948064a6254/external/build_bazel_rules_typescript/internal/tsc_wrapped/BUILD.bazel:19:1: Target '//:node_modules' is not visible from target '@build_bazel_rules_typescript//internal/tsc_wrapped:tsc_bin'. Check the visibility declaration of the former target if you think the dependency is legitimate
ERROR: /usr/local/google/home/jelbourn/.cache/bazel/_bazel_jelbourn/2010aad45cf3f55bb7127948064a6254/external/build_bazel_rules_typescript/internal/tsc_wrapped/BUILD.bazel:19:1: Target '//:node_modules' is not visible from target '@build_bazel_rules_typescript//internal/tsc_wrapped:tsc_bin'. Check the visibility declaration of the former target if you think the dependency is legitimate
ERROR: Analysis of target '//src/cdk/observers:observers' failed; build aborted: Analysis of target '@build_bazel_rules_typescript//internal/tsc_wrapped:tsc_bin' failed; build aborted
INFO: Elapsed time: 0.833s
FAILED: Build did NOT complete successfully (1 packages loaded)

For the rest of the rules I'm not too concerned about it right now

# Reduces the number of files as inputs to nodejs_binary:
# bazel query "deps(:node_modules)" | wc -l
# This won't scale in the general case.
# TODO(alexeagle): figure out what to do
Copy link
Contributor

Choose a reason for hiding this comment

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

sorry, I have an idea how to fix this if anyone has some time to investigate...

Copy link
Member Author

Choose a reason for hiding this comment

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

Doesn't strike me as that bad- you want to be explicit about your dependencies anyway

WORKSPACE Outdated
@@ -0,0 +1,38 @@
workspace(name = "angular_material_src")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we should do this anymore, you can use the built-in git_repository.
This one is the jgit version which supports sso:// git schemes, not needed here

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 a thing.

"exclude": [
"node_modules/@angular/bazel/**",
"node_modules/@angular/compiler-cli/**",
// Workaround bug introduced by 079d884
Copy link
Contributor

Choose a reason for hiding this comment

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

don't need this workaround now, see alexeagle/angular-bazel-example at head

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed

"@angular/compiler-cli": "^5.0.0",
"@angular/http": "^5.0.0",
"@angular/platform-browser-dynamic": "^5.0.0",
"@angular/platform-server": "^5.0.0",
"@angular/router": "^5.0.0",
"@angular/upgrade": "^5.0.1",
Copy link
Contributor

Choose a reason for hiding this comment

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

any particular reason you added upgrade?

Copy link
Member Author

Choose a reason for hiding this comment

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

Without it the router fails the postinstall ngc:

> ngc -p angular.tsconfig.json

node_modules/@angular/router/upgrade/src/upgrade.d.ts(9,31): error TS2307: Cannot find module '@angular/upgrade/static'.

"//src/cdk/keycodes",
"//src/cdk/platform",
],
tsconfig = ":tsconfig-build.json",
Copy link
Contributor

Choose a reason for hiding this comment

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

note, you might want to try using the same tsconfig for all the rules, and have it be the one the editor uses too

Copy link
Member Author

Choose a reason for hiding this comment

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

Impossible presently because we need to specify a different flatModuleId for each package, but would be nice long term.

# Add TypeScript rules
local_repository(
name = "build_bazel_rules_typescript",
path = "node_modules/@bazel/typescript",
Copy link
Member

@devversion devversion Nov 15, 2017

Choose a reason for hiding this comment

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

We should explicitly specify this as a dependency: https://www.npmjs.com/package/@bazel/typescript

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker and removed pr: needs review labels Nov 15, 2017
@jelbourn jelbourn merged commit cf39a41 into angular:master Nov 15, 2017
@jelbourn jelbourn mentioned this pull request Nov 15, 2017
17 tasks
@jelbourn jelbourn deleted the bazel branch April 2, 2018 22:31
@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
action: merge The PR is ready for merge by the caretaker area: dev-infra Issue related to internal project infrastructure 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.

4 participants