Zone bazel#1232
Conversation
|
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the ℹ️ Googlers: Go here for more info. |
1 similar comment
|
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the ℹ️ Googlers: Go here for more info. |
|
A Googler has manually verified that the CLAs look good. (Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.) ℹ️ Googlers: Go here for more info. |
1 similar comment
|
A Googler has manually verified that the CLAs look good. (Googler, please make sure the reason for overriding the CLA status is clearly documented in these comments.) ℹ️ Googlers: Go here for more info. |
| "@bazel/bazel", | ||
| "@bazel/ibazel", | ||
| "@bazel/buildifier", | ||
| # TODO: fails because it tries to install itself elsewhere on disk: |
There was a problem hiding this comment.
done, thanks!
| * found in the LICENSE file at https://angular.io/license | ||
| */ | ||
| !function(t){"function"==typeof define&&define.amd?define(t):t()}(function(){"use strict"; | ||
| /** |
There was a problem hiding this comment.
seems like we should figure out how to avoid having the license duplicated? I suppose it compresses well...
There was a problem hiding this comment.
The current zone.js bundles have the same issues, because inside the source code, we also have the license header, so I think we can resolve this issue later.
| package(default_visibility = ["//:__pkg__"]) | ||
|
|
||
| exports_files([ | ||
| "zone.ts", |
There was a problem hiding this comment.
exposing sources outside the package is a smell, usually any rules using them should be declared here too. At least add a comment explaining why another package needs to be able to use these sources?
(the .ts files in particular seem wrong here, they should be compiled by a rule in this package)
There was a problem hiding this comment.
This for test, I have removed it and will re-design when we figure out how to make karma for zone.js work.
| @@ -0,0 +1,12 @@ | |||
| load("//lib:rollup.bzl", "rollup_bundle") | |||
| def rollup(bundles): | |||
There was a problem hiding this comment.
I don't think the extra indirection to this file is useful, just inline this into the BUILD.bazel ?
There was a problem hiding this comment.
Sure, you are right, I have removed all separated rollup.bzl and move the definition into BUILD.bazel.
| ], | ||
| srcs = glob([ | ||
| "**/*.spec.ts", | ||
| "browser_entry_point.ts", |
There was a problem hiding this comment.
Once we move this to angular/angular, buildifier will warn that entries in a glob with no wildcard should be outside the glob
glob(["**/*.spec.ts"]) + ["browser-zone-setup.ts"]
There was a problem hiding this comment.
Got it, I will modify this later, because currently this settings not work... I will delete all bazel settings of test for now. So this PR is only about npm_package.
| "test/main", | ||
| ] | ||
|
|
||
| def get_web_test_deps(): |
There was a problem hiding this comment.
this isn't called anywhere yet?
We generally prefer to just expand this out into the BUILD file. It's a bit repetitive to have 5 ts_library targets with similar setup, however tooling like ts_auto_deps makes it manageable. By having this in a macro, tooling like buildozer will no longer be able to machine-edit the rules
There was a problem hiding this comment.
Got it, I will modify this later, because currently this settings not work... I will delete all bazel settings of test for now. So this PR is only about npm_package.
| cmd = "cp $< $(@D)/zone_externs.js", | ||
| ) | ||
|
|
||
| npm_package( |
There was a problem hiding this comment.
we should add an e2e test for the structure and content of the package so that the genrule spaghetti above can be safely refactored out.
something like https://github.com/angular/angular/blob/master/packages/bazel/test/ng_package/core_package.spec.ts maybe?
There was a problem hiding this comment.
Sure, got it, I have added test cases.
| for b in ES2015_BUNDLES | ||
| ] | ||
|
|
||
| # Extract and rename each es5 bundle to a .js and .min.js in the dist/ dir |
There was a problem hiding this comment.
this seems wrong. If we want the artifacts to appear in the dist/ subfolder in the output tree (and therefore in the npm package) then we should probably have a BUILD file in dist/ in the source tree which declares them. then we don't have to move things around. I can do some refactoring to help with that.
There was a problem hiding this comment.
Got it, I made it work, and testing it now.
|
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the ℹ️ Googlers: Go here for more info. |
1 similar comment
|
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the ℹ️ Googlers: Go here for more info. |
b363288 to
525ad67
Compare
|
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
1 similar comment
|
CLAs look good, thanks! ℹ️ Googlers: Go here for more info. |
alexeagle
left a comment
There was a problem hiding this comment.
Yay! this looks really good
| "closure/zone_externs.js", | ||
| ]) | ||
|
|
||
| filegroup( |
There was a problem hiding this comment.
I don't think we need both the exports_files and the filegroup to expose the zone_externs.js file
| * Use of this source code is governed by an MIT-style license that can be | ||
| * found in the LICENSE file at https://angular.io/license | ||
| */ | ||
| /// <amd-module name="__main__/lib/zone" /> |
There was a problem hiding this comment.
this is a bit gross, users don't want to see main - in angular we do something to trim these lines from published .d.ts
There was a problem hiding this comment.
Got it, could you show me the source that how angular trim those lines? Thanks
| "package.json", | ||
| ], | ||
| replacements = { | ||
| # Since the bazel package is experimental, patch the version number |
There was a problem hiding this comment.
this seems like copy-paste - this isn't the bazel package
There was a problem hiding this comment.
You are right, I removed this replacements.
|
|
||
| genrule( | ||
| name = "zone_d_ts", | ||
| srcs = ["//lib"], |
There was a problem hiding this comment.
is this concatenating multiple .d.ts inputs into a single output? maybe we should use the api-extractor like we do in the angular repo.
There was a problem hiding this comment.
This rule just copy the zone.d.ts from lib to dist/zone.js.d.ts, we only have one d.ts file here.
|
|
||
| # Extract and rename each es5 bundle to a .js and .min.js in the dist/ dir | ||
| [ | ||
| genrule( |
There was a problem hiding this comment.
this is pretty gross... maybe I can find a way to refactor it later
There was a problem hiding this comment.
You are right, thanks!
| srcs = [":npm_package_spec_lib"], | ||
| data = [ | ||
| ":npm_package", | ||
| "@npm//@types/shelljs", |
There was a problem hiding this comment.
I don't think the typings are needed by the test, these would only be useful for a rule that does type-checking
There was a problem hiding this comment.
Got it, typings removed. thanks!
|
angular/angular#30615 passed, so this PR should work fine at least in |
Bazel rule for zone.js