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: update to google-closure-compiler@20171023.0.1 #20321

Closed

Conversation

thelgevold
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

Upgrading Closure compiler to the latest version

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

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

Copy link
Contributor

@alexeagle alexeagle left a comment

Choose a reason for hiding this comment

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

Let's see if it's green - do we need to change closure.conf?

@thelgevold
Copy link
Contributor Author

@alexeagle It went green after I added externs for some of Angular's internal dependencies.

I have noticed that these externs are sometimes needed, but not always. I guess it depends on whether or not CC encounters these symbols in the source during compilation.

Externs:

/**
* @fileoverview This is an externs file.
* @externs
*/

var System;
var Hammer;
var global;
var COMPILED;

@thelgevold
Copy link
Contributor Author

The alternative is --jscomp_off=checkVars, but my thinking is that this may mask issues from undeclared variables?

@steveblue
Copy link

@thelgevold Hammer is only needed for @angular/animations packages I believe, but System and global are required externs by even the most basic of projects. COMPILED just cropped up prior to 5.0.0 launch in platform-browser.

@Toxicable
Copy link

Toxicable commented Nov 10, 2017

System is used by SystemJsNgModuleLoader.
In other words it's used by the router

@alexeagle
Copy link
Contributor

@thelgevold can you think of a case where we want Closure Compiler to find "issues from undeclared variables", that the earlier TS tooling would not have found?
If there is such a case, maybe we should improve something in the dev roundtrip to find that issue sooner, like a new tslint check.
I think generally the dev mode tooling should include everything needed to say whether or not your program is "valid" in whatever sense TS and Angular agree is per the spec.
The only reason I'd want Closure to output anything at all is in cases where the app works in dev mode but will be broken after optimization, and closure says "hey, if I optimize this app, I'll break it, here's why".
In (all?) the cases I've seen, closure doesn't warn about breaking your app, it's just warning because it expects to be the first tool in the chain that processes your sources.

Given that, my guess is that --jscomp_off=checkVars is the right solution.

/cc @evmar @rkirov

@@ -0,0 +1,9 @@
/**
* @fileoverview This is an externs file.
Copy link
Contributor

Choose a reason for hiding this comment

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

We definitely don't want users to have to own such a file. If we decide to pass externs, they should ship with Angular.

Copy link
Contributor

@alexeagle alexeagle left a comment

Choose a reason for hiding this comment

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

Need to resolve the externs question...

@thelgevold
Copy link
Contributor Author

@alexeagle Since TS will always run before this, I agree that --jscomp_off=checkVars is an appropriate solution here. I have updated the PR.

@@ -9,6 +9,7 @@
--warning_level=QUIET
--dependency_mode=STRICT
--rewrite_polyfills=false
--jscomp_off=checkVars
Copy link
Contributor

Choose a reason for hiding this comment

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

FYI, we really should add comments here, but I don't know of a syntax to do so.
If you feel like tackling google/closure-compiler#2413 it would be a nice enhancement

Copy link
Contributor

@alexeagle alexeagle left a comment

Choose a reason for hiding this comment

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

thanks!

@alexeagle alexeagle added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Nov 10, 2017
jasonaden pushed a commit that referenced this pull request Nov 10, 2017
@jasonaden jasonaden closed this in 161f88f Nov 10, 2017
@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 12, 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 cla: yes 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

5 participants