Bug 163785 - [Modern Media Controls] Concatenate JS and CSS files into a single JS and CSS resources
Summary: [Modern Media Controls] Concatenate JS and CSS files into a single JS and CSS...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Media (show other bugs)
Version: Safari 10
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Antoine Quint
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-10-21 08:55 PDT by Antoine Quint
Modified: 2017-02-07 04:43 PST (History)
6 users (show)

See Also:


Attachments
Patch (7.32 KB, patch)
2016-10-21 08:56 PDT, Antoine Quint
no flags Details | Formatted Diff | Diff
Patch (7.36 KB, patch)
2016-10-21 08:58 PDT, Antoine Quint
no flags Details | Formatted Diff | Diff
Patch for landing (7.61 KB, patch)
2016-10-24 05:35 PDT, Antoine Quint
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Antoine Quint 2016-10-21 08:55:18 PDT
As part of review feedback for https://bugs.webkit.org/show_bug.cgi?id=163726, Dean suggested using a build phase to concatenate all JS resources into a single file rather than doing a series of stringWithContentsOfFile calls on the WebCore bundle at runtime. We should also do this for CSS.
Comment 1 Radar WebKit Bug Importer 2016-10-21 08:56:42 PDT
<rdar://problem/28890058>
Comment 2 Antoine Quint 2016-10-21 08:56:43 PDT
Created attachment 292350 [details]
Patch
Comment 3 Antoine Quint 2016-10-21 08:58:34 PDT
Created attachment 292351 [details]
Patch
Comment 4 Dean Jackson 2016-10-21 11:06:54 PDT
Comment on attachment 292351 [details]
Patch

This looks good to me, but I think you should get someone who knows more about the build system to check this.

Two concerns:
- what will happen with localization? at some point you'll need a file with all the strings that need to be localized.
- does this run on every build? Previously the rsync would only change files if necessary. Is that bad?
Comment 5 Darin Adler 2016-10-21 11:39:28 PDT
Comment on attachment 292351 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=292351&action=review

> Source/WebCore/WebCore.xcodeproj/project.pbxproj:27979
> +			shellScript = "rsync -aq --exclude \".svn\" --exclude \".DS_Store\" \"$SRCROOT/Modules/modern-media-controls/images\" \"$BUILT_PRODUCTS_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/modern-media-controls\"\ncd \"$SRCROOT/Modules/modern-media-controls\"\ncat controls/*.css > \"$BUILT_PRODUCTS_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/modern-media-controls/modern-media-controls.css\"\n             cat \"controls/scheduler.js\" \"controls/layout-node.js\" \"controls/layout-item.js\" \"controls/icon-service.js\" \"controls/time-control.js\" \"controls/time-label.js\" \"controls/slider.js\" \"controls/volume-slider.js\" \"controls/scrubber.js\" \"controls/button.js\" \"controls/start-button.js\" \"controls/icon-button.js\" \"controls/play-pause-button.js\" \"controls/skip-back-button.js\" \"controls/mute-button.js\" \"controls/airplay-button.js\" \"controls/pip-button.js\" \"controls/tracks-button.js\" \"controls/fullscreen-button.js\" \"controls/aspect-ratio-button.js\" \"controls/rewind-button.js\" \"controls/forward-button.js\" \"controls/media-controls.js\" \"controls/macos-media-controls.js\" \"controls/macos-inline-media-controls.js\" \"controls/buttons-container.js\" \"controls/placard.js\" \"controls/airplay-placard.js\" \"controls/pip-placard.js\" \"media/media-controller-support.js\" \"media/start-support.js\" \"media/mute-support.js\" \"media/media-controller.js\" \"main.js\" > \"$BUILT_PRODUCTS_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/modern-media-controls/modern-media-controls.js\"\n";

There are too many quotation marks here. There is no reason to write "main.js" instead of just main.js in the command line.

But can we put the list of files somewhere easier to read and inspect than inside the build rule? Maybe put the names into a file? Then it would be more like this:

    cat `cat JavaScript-filenames` > \"$BUILT_PRODUCTS_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/modern-media-controls/modern-media-controls.js\"

Or rearrange them so we can pick them up with *.js like you are picking up the CSS with *.css?
Comment 6 Antoine Quint 2016-10-21 12:20:36 PDT
(In reply to comment #5)
> Comment on attachment 292351 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=292351&action=review
> 
> > Source/WebCore/WebCore.xcodeproj/project.pbxproj:27979
> But can we put the list of files somewhere easier to read and inspect than
> inside the build rule? Maybe put the names into a file? Then it would be
> more like this:
> 
>     cat `cat JavaScript-filenames` >
> \"$BUILT_PRODUCTS_DIR/$UNLOCALIZED_RESOURCES_FOLDER_PATH/modern-media-
> controls/modern-media-controls.js\"

I like that!

> Or rearrange them so we can pick them up with *.js like you are picking up
> the CSS with *.css?

Alas, we can't do that with JS, the order in which the classes appear matters.
Comment 7 Antoine Quint 2016-10-24 05:35:05 PDT
Created attachment 292603 [details]
Patch for landing
Comment 8 Antoine Quint 2016-10-24 05:42:25 PDT
Sorry, I forgot about your comments after reading Darin's.

(In reply to comment #4)
> Comment on attachment 292351 [details]
> 
> - what will happen with localization? at some point you'll need a file with
> all the strings that need to be localized.

Yes, I will follow the same approach used for current media controls, where the strings are in a separate JS file that gets injected on top of the media controls logic.

> - does this run on every build? Previously the rsync would only change files
> if necessary. Is that bad?

It does run on every build, I hope it's not bad.
Comment 9 Antoine Quint 2016-10-24 08:02:00 PDT
Comment on attachment 292603 [details]
Patch for landing

https://trac.webkit.org/changeset/207758