Skip to content
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: reference zone.js directly from source instead of npm #33046

Closed
wants to merge 1 commit into from

Conversation

JiaLiPassion
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Issue Number: #32482

What is the new behavior?

reference zone.js directly from source instead of npm

Does this PR introduce a breaking change?

  • Yes
  • No

@JiaLiPassion JiaLiPassion requested review from a team as code owners October 9, 2019 04:38
@JiaLiPassion JiaLiPassion force-pushed the zone-bazel-ref branch 4 times, most recently from 9e03a8d to e931f22 Compare October 9, 2019 14:07
@JiaLiPassion JiaLiPassion changed the title WIP: reference zone.js directly from source instead of npm build: reference zone.js directly from source instead of npm Oct 9, 2019
@ngbot ngbot bot added this to the needsTriage milestone Oct 9, 2019
@JiaLiPassion JiaLiPassion force-pushed the zone-bazel-ref branch 2 times, most recently from bdb03f8 to 411bf9d Compare October 9, 2019 15:30
@@ -9,23 +9,23 @@
'use strict';

const glob = require('glob');
require('zone.js/dist/zone-node.js');
import '@angular/zone.js/lib/node/rollup-main';
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 these imports should change - the package is zone.js not @angular/zone.js

something needs to make the mapping available to type-checker and runtime

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it, so it should be import 'zone.js/lib/node/rollup-main' or you mean keep it like require('zone.js/dist/zone-node.js');? Because currently we only have the source not the built npm_package. So in this PR.

  1. for packages/* (such as packages/core), I updated the reference to zone.js source code, just like this one, import '@angular/zone.js/lib/node/rollup-main';
  2. for modules/*, I updated the reference to zone.js dist bazel rule.
  3. for integrations/*, I added build zone.js npm_package first, and add zone.js built folder to package.json.

Copy link
Contributor

Choose a reason for hiding this comment

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

we should never import '@angular/zone.js/... - why is that needed? Bazel should understand a zone.js import

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it, I have updated all @angular/zone.js to zone.js.

@@ -7,11 +7,10 @@
*/

// Needed to run animation tests
require('zone.js/dist/zone-node.js');

import '@angular/zone.js/lib/node/rollup-main';
Copy link
Contributor

Choose a reason for hiding this comment

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

this doesn't look right. what do we need to fix so the 'zone.js/...' import works?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do you mean import zone.js/lib/node/rollup-main? or import zone.js/dist/zone-node.js.

  1. to support import zone.js/lib/node/rollup-main? We just need to update the path mapping in tsconfig and some other mapping, I will make a list.
  2. to support import zone.js/dist/zone-node.js., we need to build //packages/zone.js:npm_package first and then update the `path mapping to "zone.js": "dist/bin/packages/zone.js/npm_package"

Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally Angular would depend directly on the TS outputs of zone, not on the bundled rollup distribution, because the latter is a longer re-build. So ideally I think you want 1.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@alexeagle , thank you, and I have updated the reference to zone.js. Please review, thanks!

@JiaLiPassion JiaLiPassion force-pushed the zone-bazel-ref branch 2 times, most recently from c90feea to a2e9082 Compare October 24, 2019 15:38
outs = ["zone.js.d.ts"],
cmd = "find $(SRCS) -name \"zone.d.ts\" -exec cp {} $(@D)/zone.js.d.ts \;",
cmd = "cp $< $@",
Copy link
Contributor

Choose a reason for hiding this comment

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

nice fix

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks!

@@ -0,0 +1,30 @@
{
Copy link
Contributor

Choose a reason for hiding this comment

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

this file is surprising - do you mean to add it? bad merge maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, thanks, I have deleted it.

@JiaLiPassion JiaLiPassion removed the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Oct 28, 2019
@mhevery
Copy link
Contributor

mhevery commented Nov 5, 2019

presubmit

@mhevery mhevery added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note and removed target: major This PR is targeted for the next major release labels Nov 5, 2019
@mhevery
Copy link
Contributor

mhevery commented Nov 5, 2019

MERGE_ASSISTANCE: Global Approval

@atscott
Copy link
Contributor

atscott commented Nov 5, 2019

The expanding_rows benchmark test appears to be failing with error http://<server>/angular/packages/zone.js/dist/zone.test.min.js - Failed to load resource: the server responded with a status of 404 (Not Found) @mhevery @JiaLiPassion Can one of you take a look?

@atscott atscott added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Nov 5, 2019
@JiaLiPassion JiaLiPassion force-pushed the zone-bazel-ref branch 2 times, most recently from 934eb84 to ae92649 Compare November 5, 2019 22:37
@JiaLiPassion JiaLiPassion removed the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Nov 5, 2019
@JiaLiPassion JiaLiPassion force-pushed the zone-bazel-ref branch 2 times, most recently from 7692c80 to 42dcb7e Compare November 5, 2019 22:51
@JiaLiPassion
Copy link
Contributor Author

@atscott, thanks and I just updated the PR, please review.

@atscott
Copy link
Contributor

atscott commented Nov 6, 2019

presubmit

@atscott atscott closed this in 8c6fb17 Nov 6, 2019
mohaxspb pushed a commit to mohaxspb/angular that referenced this pull request Nov 7, 2019
mohaxspb pushed a commit to mohaxspb/angular that referenced this pull request Nov 7, 2019
gkalpak added a commit to gkalpak/angular that referenced this pull request Nov 11, 2019
…st.sh`

In angular#33046, internal uses of `zone.js` were switched to reference it
directly from source (built with Bazel) instead of npm. As a result, the
necessary scripts were updated to build `zone.js` as necessary. However,
the `integration/ngcc/debug-test.sh` script was missed (probably because
it is not used on CI, but only locally as a helper for debugging the
ngcc integration project).

This commit updates the `debug-test.sh` script to also build `zone.js`
as needed.
gkalpak added a commit to gkalpak/angular that referenced this pull request Nov 11, 2019
…st.sh`

In angular#33046, internal uses of `zone.js` were switched to reference it
directly from source (built with Bazel) instead of npm. As a result, the
necessary scripts were updated to build `zone.js` as necessary. However,
the `integration/ngcc/debug-test.sh` script was missed (probably because
it is not used on CI, but only locally as a helper for debugging the
ngcc integration project).

This commit updates the `debug-test.sh` script to also build `zone.js`
as needed.
gkalpak added a commit to gkalpak/angular that referenced this pull request Nov 11, 2019
…st.sh`

In angular#33046, internal uses of `zone.js` were switched to reference it
directly from source (built with Bazel) instead of npm. As a result, the
necessary scripts were updated to build `zone.js` as necessary. However,
some `integration/**/debug-test.sh` scripts were missed (apparently
because they are not used on CI, but only locally as helpers for
debugging the integration projects).

This commit updates the `scripts/build-packages-dist.sh` script to also
build `zone.js`, so that other scripts (such as the various
`debug-test.sh` scripts) can use it.
gkalpak added a commit to gkalpak/angular that referenced this pull request Nov 11, 2019
…st.sh`

In angular#33046, internal uses of `zone.js` were switched to reference it
directly from source (built with Bazel) instead of npm. As a result, the
necessary scripts were updated to build `zone.js` as necessary. However,
some `integration/**/debug-test.sh` scripts were missed (apparently
because they are not used on CI, but only locally as helpers for
debugging the integration projects).

This commit updates the `scripts/build-packages-dist.sh` script to also
build `zone.js`, so that other scripts (such as the various
`debug-test.sh` scripts) can use it.
kara pushed a commit that referenced this pull request Nov 12, 2019
…st.sh` (#33733)

In #33046, internal uses of `zone.js` were switched to reference it
directly from source (built with Bazel) instead of npm. As a result, the
necessary scripts were updated to build `zone.js` as necessary. However,
some `integration/**/debug-test.sh` scripts were missed (apparently
because they are not used on CI, but only locally as helpers for
debugging the integration projects).

This commit updates the `scripts/build-packages-dist.sh` script to also
build `zone.js`, so that other scripts (such as the various
`debug-test.sh` scripts) can use it.

PR Close #33733
kara pushed a commit that referenced this pull request Nov 12, 2019
…st.sh` (#33733)

In #33046, internal uses of `zone.js` were switched to reference it
directly from source (built with Bazel) instead of npm. As a result, the
necessary scripts were updated to build `zone.js` as necessary. However,
some `integration/**/debug-test.sh` scripts were missed (apparently
because they are not used on CI, but only locally as helpers for
debugging the integration projects).

This commit updates the `scripts/build-packages-dist.sh` script to also
build `zone.js`, so that other scripts (such as the various
`debug-test.sh` scripts) can use it.

PR Close #33733
@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 Dec 7, 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: zones cla: yes merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants