Skip to content

🚮 Remove closure compiler logic from build-system.#37296

Merged
samouri merged 3 commits intoampproject:mainfrom
samouri:rm-closure
Jan 5, 2022
Merged

🚮 Remove closure compiler logic from build-system.#37296
samouri merged 3 commits intoampproject:mainfrom
samouri:rm-closure

Conversation

@samouri
Copy link
Copy Markdown
Member

@samouri samouri commented Jan 4, 2022

summary
Deletes a files directly related to closure compilation from build-system.

Future related changes:

  • Remove dep on closure from validator task, s.t. we can remove the dep from package.json
  • Remove externs.
  • Remove rrule hack / dep patches.
  • Remove jsdoc-isms that only applied to closure and have no value outside of that (closurePrimitive)
  • Remove babel passes that only applied to closure

@samouri samouri changed the title 🚮 Remove most traces of closure from build-system. 🚮 Remove closure compiler logic from build-system. Jan 4, 2022
@samouri samouri self-assigned this Jan 5, 2022
@samouri samouri requested a review from rsimha January 5, 2022 16:54
@samouri samouri marked this pull request as ready for review January 5, 2022 16:54
@amp-owners-bot
Copy link
Copy Markdown

amp-owners-bot bot commented Jan 5, 2022

Hey @rsimha! These files were changed:

build-system/compile/closure-compile.js
build-system/compile/compile.js

Hey @rcebulko! These files were changed:

build-system/tasks/check-types.js

@samouri samouri requested a review from jridgewell January 5, 2022 16:54
@samouri
Copy link
Copy Markdown
Member Author

samouri commented Jan 5, 2022

@rcebulko: requesting a review of just the check-types.js file

Copy link
Copy Markdown
Contributor

@rcebulko rcebulko left a comment

Choose a reason for hiding this comment

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

🥳 🎉 🎂
This is awesome!
One thing to add to the description to-do list: Possibly clean up some babel transforms that existed to satisfy something Closure needed, such as #37233

Copy link
Copy Markdown
Contributor

@rsimha rsimha left a comment

Choose a reason for hiding this comment

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

Yay!

Comment on lines -147 to -151
if (minify) {
log('Minifying multi-pass JS with', cyan('closure-compiler') + '...');
} else {
log('Compiling JS with', cyan('esbuild'), 'and', cyan('babel') + '...');
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the distinction between minified and non-minified ("compiled", for lack of a better word) ought to remain in the logs. Perhaps change the first word of the sentence to minify ? 'Minifying' : 'Compiling'?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a distinction between the two with esbuild?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sure. I'll put that distinction back in via Compiling minified vs. Compiling unminified, which I think reads clearer.
WDYT of removing the details around esbuild/babel? I think those might be too much detail for this log (why are we excluding the other dozen tools...where do we draw the line..)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sure. I'll put that distinction back in via Compiling minified vs. Compiling unminified, which I think reads clearer.

SGTM. 👍

WDYT of removing the details around esbuild/babel? I think those might be too much detail for this log (why are we excluding the other dozen tools...where do we draw the line..)

Fair point. The logging was originally added back when there was a substantial difference between minified (only closure) and unminified (only babel). It's less accurate / useful today given all the recent tooling changes.

@@ -6,7 +6,6 @@ const {
const {
displayLifecycleDebugging,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does displayLifecycleDebugging do anything here?

// Prepare build environment
process.env.NODE_ENV = 'production';
cleanupBuildDir();
typecheckNewServer();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

AFAICT the debug flag no longer has meaning in this file

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Should I remove? I don't know what debug/displayLifecycleDebugging are for.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A quick inspection suggestions displayLifecycleDebugging should only matter if the debug method in that same file is called, and I don't see where it would be called here, but it's possible somewhere in the dependency chain it does get called. Not certain without testing it out

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

displayLifecycleDebugging was added in #27700 as a way to print the output at various stages of compilation: babel, closure, more babel, etc. It's triggered by the --debug flag, and was previously used by dist and check-types (both of which used closure).

It's probably far less useful without closure and the pre- and post- babel steps. Okay to remove IMO. Might be worth checking in with someone like @jridgewell to make sure.

@samouri samouri merged commit 6bfa3ac into ampproject:main Jan 5, 2022
@samouri samouri deleted the rm-closure branch January 5, 2022 21:04
westonruter added a commit that referenced this pull request Jan 10, 2022
…nce-attr-to-hero-img

* 'main' of github.com:ampproject/amphtml: (525 commits)
  mathml storybook: supply missing component definition. (#37326)
  storybook: Iframe --> BentoIframe (#37327)
  🖍  [Story system layer] New ad badge (#37311)
  🐛 [amp story] Replay/next page button bug fix (#37316)
  🚀  [Story performance] Remove affiliate links (#37280)
  Compiler: Add amp-carousel-0.1 to the builder map (#37308)
  ⏪  [Story system layer] Audio icon disappears when story has background audio (#37314)
  🚀  [Story performance] Remove story access (#37281)
  Fix remapping esbuild output on Windows (#37312)
  🐛 adds in correct weight for amp-story-product-tag text (#37188)
  typechecking carousel: remove shame files (#37213)
  Use remapping to remap minified sourcemap into source code (#37238)
  SwG Release 0.1.22.199 (#37310)
  🐛 Adds microsoft-edge protocol (#34168)
  Sync for validator cpp engine and cpp htmlparser (#37292)
  ✨ amp-story-shopping Updated currency with product price and correct Localized currency (#37249)
  ✨[Smartadserver ad extension] Implement support for Fast Fetch (#36991)
  Remove client-side-experiments-config.json from this repo (#37304)
  🚮  Remove closure compiler logic from build-system. (#37296)
  🌐 Added RTL ordering i18n for amp story shopping tag (#37252)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants