shaka-player 4.0.1 → 4.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AUTHORS +1 -0
- package/CHANGELOG.md +37 -0
- package/CONTRIBUTORS +3 -0
- package/README.md +20 -6
- package/demo/common/assets.js +1 -1
- package/demo/demo.less +0 -1
- package/demo/index.html +0 -2
- package/demo/main.js +3 -3
- package/dist/controls.css +3 -3
- package/dist/controls.css.map +1 -1
- package/dist/demo.compiled.debug.js +3 -3
- package/dist/demo.compiled.debug.map +2 -2
- package/dist/demo.compiled.js +3 -3
- package/dist/demo.compiled.map +2 -2
- package/dist/demo.css +1 -1
- package/dist/demo.css.map +1 -1
- package/dist/deps.js +4 -4
- package/dist/locales.js +34 -34
- package/dist/receiver.compiled.debug.js +1 -1
- package/dist/receiver.compiled.debug.map +1 -1
- package/dist/receiver.compiled.js +1 -1
- package/dist/receiver.compiled.map +1 -1
- package/dist/shaka-player.compiled.d.ts +11 -0
- package/dist/shaka-player.compiled.debug.d.ts +11 -0
- package/dist/shaka-player.compiled.debug.externs.js +51 -39
- package/dist/shaka-player.compiled.debug.js +247 -237
- package/dist/shaka-player.compiled.debug.map +4 -4
- package/dist/shaka-player.compiled.externs.js +51 -39
- package/dist/shaka-player.compiled.js +799 -792
- package/dist/shaka-player.compiled.map +4 -4
- package/dist/shaka-player.ui.d.ts +11 -0
- package/dist/shaka-player.ui.debug.d.ts +11 -0
- package/dist/shaka-player.ui.debug.externs.js +51 -39
- package/dist/shaka-player.ui.debug.js +273 -262
- package/dist/shaka-player.ui.debug.map +4 -4
- package/dist/shaka-player.ui.externs.js +51 -39
- package/dist/shaka-player.ui.js +957 -952
- package/dist/shaka-player.ui.map +4 -4
- package/docs/tutorials/upgrade.md +1 -0
- package/docs/tutorials/welcome.md +6 -3
- package/externs/shaka/player.js +4 -2
- package/lib/abr/simple_abr_manager.js +2 -1
- package/lib/dash/dash_parser.js +5 -0
- package/lib/hls/hls_parser.js +197 -73
- package/lib/media/drm_engine.js +3 -0
- package/lib/media/media_source_engine.js +57 -24
- package/lib/media/presentation_timeline.js +24 -1
- package/lib/media/segment_index.js +26 -1
- package/lib/media/segment_reference.js +10 -3
- package/lib/media/streaming_engine.js +3 -4
- package/lib/media/time_ranges_utils.js +46 -0
- package/lib/player.js +1 -1
- package/lib/polyfill/media_capabilities.js +3 -0
- package/lib/polyfill/videoplaybackquality.js +3 -1
- package/lib/util/mime_utils.js +14 -5
- package/lib/util/platform.js +19 -1
- package/lib/util/stream_utils.js +1 -0
- package/lib/util/string_utils.js +56 -14
- package/maintained-branches.md +15 -0
- package/package.json +3 -5
- package/test/hls/hls_live_unit.js +57 -7
- package/test/hls/hls_parser_unit.js +102 -8
- package/test/media/drm_engine_integration.js +24 -8
- package/test/media/media_source_engine_integration.js +24 -10
- package/test/media/media_source_engine_unit.js +53 -38
- package/test/media/streaming_engine_unit.js +28 -27
- package/test/test/util/fake_media_source_engine.js +10 -9
- package/ui/less/containers.less +1 -1
- package/ui/less/general.less +1 -1
- package/ui/less/range_elements.less +1 -0
- package/.github/pull_request_template.md +0 -10
- package/app-engine/README.md +0 -9
- package/app-engine/demo-version-index/README.md +0 -14
- package/app-engine/demo-version-index/app.yaml +0 -28
- package/app-engine/demo-version-index/generate.py +0 -164
- package/app-engine/demo-version-index/main.py +0 -11
- package/app-engine/demo-version-index/requirements.txt +0 -5
- package/app-engine/demo-version-index/templates/index.html +0 -114
- package/app-engine/shaka-player-demo/README.md +0 -18
- package/app-engine/shaka-player-demo/app.yaml +0 -61
- package/app-engine/shaka-player-demo/main.py +0 -95
- package/app-engine/shaka-player-demo/posters/10yo.png +0 -0
- package/app-engine/shaka-player-demo/posters/10yo.xcf +0 -0
- package/app-engine/shaka-player-demo/posters/1yo.jpg +0 -0
- package/app-engine/shaka-player-demo/posters/2yo.png +0 -0
- package/app-engine/shaka-player-demo/posters/2yo.xcf +0 -0
- package/app-engine/shaka-player-demo/posters/3yo.png +0 -0
- package/app-engine/shaka-player-demo/posters/3yo.xcf +0 -0
- package/app-engine/shaka-player-demo/posters/4yo.png +0 -0
- package/app-engine/shaka-player-demo/posters/4yo.xcf +0 -0
- package/app-engine/shaka-player-demo/posters/5yo.png +0 -0
- package/app-engine/shaka-player-demo/posters/5yo.xcf +0 -0
- package/app-engine/shaka-player-demo/posters/6yo.png +0 -0
- package/app-engine/shaka-player-demo/posters/6yo.xcf +0 -0
- package/app-engine/shaka-player-demo/posters/7yo.png +0 -0
- package/app-engine/shaka-player-demo/posters/7yo.xcf +0 -0
- package/app-engine/shaka-player-demo/posters/8yo.png +0 -0
- package/app-engine/shaka-player-demo/posters/8yo.xcf +0 -0
- package/app-engine/shaka-player-demo/posters/9yo.png +0 -0
- package/app-engine/shaka-player-demo/posters/9yo.xcf +0 -0
- package/app-engine/shaka-player-demo/posters/audioOnly.gif +0 -0
- package/app-engine/shaka-player-demo/posters/audioRickRoll.gif +0 -0
- package/app-engine/shaka-player-demo/posters/colorbars.gif +0 -0
- package/app-engine/shaka-player-demo/posters/fireworks.jpg +0 -0
- package/app-engine/shaka-player-demo/posters/party-hat.png +0 -0
- package/app-engine/shaka-player-demo/posters/sources.txt +0 -46
- package/app-engine/shaka-player-demo/posters/standard.png +0 -0
- package/app-engine/shaka-player-demo/posters/trek.jpg +0 -0
- package/app-engine/shaka-player-demo/posters/valentines.png +0 -0
- package/app-engine/shaka-player-demo/posters/zombie.jpg +0 -0
- package/app-engine/shaka-player-demo/posters.py +0 -110
- package/app-engine/shaka-player-demo/requirements.txt +0 -5
- package/app-engine/shaka-player-demo/time.txt +0 -1
- package/build/README.md +0 -127
- package/build/__init__.py +0 -0
- package/build/all.py +0 -150
- package/build/apps.py +0 -186
- package/build/build.py +0 -392
- package/build/check.py +0 -354
- package/build/checkversion.py +0 -84
- package/build/compiler.py +0 -513
- package/build/conformance.textproto +0 -335
- package/build/docker/Dockerfile +0 -20
- package/build/docker/docker-compose.yml +0 -10
- package/build/docs.py +0 -54
- package/build/eslint-plugin-shaka-rules/arg-comment-spacing.js +0 -72
- package/build/eslint-plugin-shaka-rules/index.js +0 -24
- package/build/eslint-plugin-shaka-rules/package.json +0 -7
- package/build/eslint-plugin-shaka-rules/private.js +0 -109
- package/build/gendeps.py +0 -71
- package/build/generateExterns.js +0 -867
- package/build/generateLocalizations.py +0 -262
- package/build/generateTsDefs.py +0 -137
- package/build/install-linux-prereqs.sh +0 -136
- package/build/license-header +0 -5
- package/build/misspellings.txt +0 -39
- package/build/pixelsChanged.js +0 -35
- package/build/shaka-lab.yaml +0 -161
- package/build/shakaBuildHelpers.py +0 -356
- package/build/stats.py +0 -816
- package/build/subprocessWindowsPatch.py +0 -103
- package/build/test.py +0 -541
- package/build/types/ads +0 -8
- package/build/types/cast +0 -6
- package/build/types/cea +0 -13
- package/build/types/complete +0 -9
- package/build/types/core +0 -108
- package/build/types/dash +0 -8
- package/build/types/hls +0 -9
- package/build/types/manifests +0 -5
- package/build/types/networking +0 -6
- package/build/types/offline +0 -22
- package/build/types/polyfill +0 -18
- package/build/types/text +0 -11
- package/build/types/ui +0 -39
- package/build/updateScreenshots.py +0 -85
- package/build/wrapper.template.js +0 -52
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
# Shaka Player Demo - Poster Definitions
|
|
2
|
-
# Copyright 2022 Google LLC
|
|
3
|
-
# SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
|
|
5
|
-
# A Doodle-like service to change the poster on certain days.
|
|
6
|
-
# All posters are chosen based on the current date in PST.
|
|
7
|
-
|
|
8
|
-
# Month constants to make specific dates easier to read.
|
|
9
|
-
JANUARY = 1
|
|
10
|
-
FEBRUARY = 2
|
|
11
|
-
MARCH = 3
|
|
12
|
-
APRIL = 4
|
|
13
|
-
MAY = 5
|
|
14
|
-
JUNE = 6
|
|
15
|
-
JULY = 7
|
|
16
|
-
AUGUST = 8
|
|
17
|
-
SEPTEMBER = 9
|
|
18
|
-
OCTOBER = 10
|
|
19
|
-
NOVEMBER = 11
|
|
20
|
-
DECEMBER = 12
|
|
21
|
-
|
|
22
|
-
# Special posters for certain days.
|
|
23
|
-
VIDEO_POSTERS = {
|
|
24
|
-
# These are the same every year:
|
|
25
|
-
# =====
|
|
26
|
-
(FEBRUARY, 14): 'valentines.png',
|
|
27
|
-
(APRIL, 1): 'colorbars.gif',
|
|
28
|
-
(APRIL, 5): 'trek.jpg', # "First Contact Day": https://bit.ly/2CSXbxw
|
|
29
|
-
(OCTOBER, 31): 'zombie.jpg',
|
|
30
|
-
# =====
|
|
31
|
-
|
|
32
|
-
# These birthday posters changed each year:
|
|
33
|
-
(DECEMBER, 19, 2015): '1yo.jpg',
|
|
34
|
-
(DECEMBER, 19, 2016): '2yo.png',
|
|
35
|
-
(DECEMBER, 19, 2017): '3yo.png',
|
|
36
|
-
|
|
37
|
-
# After this, the birthday poster shows for a whole week:
|
|
38
|
-
(DECEMBER, 17, 2018): '4yo.png',
|
|
39
|
-
(DECEMBER, 18, 2018): '4yo.png',
|
|
40
|
-
(DECEMBER, 19, 2018): '4yo.png',
|
|
41
|
-
(DECEMBER, 20, 2018): '4yo.png',
|
|
42
|
-
|
|
43
|
-
(DECEMBER, 19, 2019): '5yo.png',
|
|
44
|
-
(DECEMBER, 20, 2019): '5yo.png',
|
|
45
|
-
(DECEMBER, 21, 2019): '5yo.png',
|
|
46
|
-
(DECEMBER, 22, 2019): '5yo.png',
|
|
47
|
-
(DECEMBER, 23, 2019): '5yo.png',
|
|
48
|
-
(DECEMBER, 24, 2019): '5yo.png',
|
|
49
|
-
(DECEMBER, 25, 2019): '5yo.png',
|
|
50
|
-
|
|
51
|
-
(DECEMBER, 19, 2020): '6yo.png',
|
|
52
|
-
(DECEMBER, 20, 2020): '6yo.png',
|
|
53
|
-
(DECEMBER, 21, 2020): '6yo.png',
|
|
54
|
-
(DECEMBER, 22, 2020): '6yo.png',
|
|
55
|
-
(DECEMBER, 23, 2020): '6yo.png',
|
|
56
|
-
(DECEMBER, 24, 2020): '6yo.png',
|
|
57
|
-
(DECEMBER, 25, 2020): '6yo.png',
|
|
58
|
-
|
|
59
|
-
(DECEMBER, 19, 2021): '7yo.png',
|
|
60
|
-
(DECEMBER, 20, 2021): '7yo.png',
|
|
61
|
-
(DECEMBER, 21, 2021): '7yo.png',
|
|
62
|
-
(DECEMBER, 22, 2021): '7yo.png',
|
|
63
|
-
(DECEMBER, 23, 2021): '7yo.png',
|
|
64
|
-
(DECEMBER, 24, 2021): '7yo.png',
|
|
65
|
-
(DECEMBER, 25, 2021): '7yo.png',
|
|
66
|
-
|
|
67
|
-
(DECEMBER, 19, 2022): '8yo.png',
|
|
68
|
-
(DECEMBER, 20, 2022): '8yo.png',
|
|
69
|
-
(DECEMBER, 21, 2022): '8yo.png',
|
|
70
|
-
(DECEMBER, 22, 2022): '8yo.png',
|
|
71
|
-
(DECEMBER, 23, 2022): '8yo.png',
|
|
72
|
-
(DECEMBER, 24, 2022): '8yo.png',
|
|
73
|
-
(DECEMBER, 25, 2022): '8yo.png',
|
|
74
|
-
|
|
75
|
-
(DECEMBER, 19, 2023): '9yo.png',
|
|
76
|
-
(DECEMBER, 20, 2023): '9yo.png',
|
|
77
|
-
(DECEMBER, 21, 2023): '9yo.png',
|
|
78
|
-
(DECEMBER, 22, 2023): '9yo.png',
|
|
79
|
-
(DECEMBER, 23, 2023): '9yo.png',
|
|
80
|
-
(DECEMBER, 24, 2023): '9yo.png',
|
|
81
|
-
(DECEMBER, 25, 2023): '9yo.png',
|
|
82
|
-
|
|
83
|
-
(DECEMBER, 19, 2024): '10yo.png',
|
|
84
|
-
(DECEMBER, 20, 2024): '10yo.png',
|
|
85
|
-
(DECEMBER, 21, 2024): '10yo.png',
|
|
86
|
-
(DECEMBER, 22, 2024): '10yo.png',
|
|
87
|
-
(DECEMBER, 23, 2024): '10yo.png',
|
|
88
|
-
(DECEMBER, 24, 2024): '10yo.png',
|
|
89
|
-
(DECEMBER, 25, 2024): '10yo.png',
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
# The default poster.
|
|
93
|
-
VIDEO_DEFAULT = 'standard.png'
|
|
94
|
-
|
|
95
|
-
# Special audio-only posters.
|
|
96
|
-
AUDIO_POSTERS = {
|
|
97
|
-
# http://discordia.wikia.com/wiki/Chaoflux
|
|
98
|
-
(FEBRUARY, 19): 'audioRickRoll.gif',
|
|
99
|
-
# http://discordia.wikia.com/wiki/Discoflux
|
|
100
|
-
(MAY, 3): 'audioRickRoll.gif',
|
|
101
|
-
# http://discordia.wikia.com/wiki/Confuflux
|
|
102
|
-
(JULY, 15): 'audioRickRoll.gif',
|
|
103
|
-
# http://discordia.wikia.com/wiki/Bureflux
|
|
104
|
-
(SEPTEMBER, 26): 'audioRickRoll.gif',
|
|
105
|
-
# http://discordia.wikia.com/wiki/Afflux
|
|
106
|
-
(DECEMBER, 8): 'audioRickRoll.gif',
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
# The default audio-only poster.
|
|
110
|
-
AUDIO_DEFAULT = 'audioOnly.gif'
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
Time is an illusion; lunchtime doubly so.
|
package/build/README.md
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
This directory contains the scripts used to build and test Shaka Player. These
|
|
2
|
-
scripts can run on any platform that supports python v2.7 and JRE 8+.
|
|
3
|
-
|
|
4
|
-
* `all.py` simply runs `gendeps.py`, `check.py`, `docs.py`, and `build.py`.
|
|
5
|
-
It will forward `--force` to `build.py`.
|
|
6
|
-
* `build.py` builds the compiled library. This will fail if there are syntax
|
|
7
|
-
or type errors.
|
|
8
|
-
* `check.py` will check all the files for style violations and will check the
|
|
9
|
-
tests for type errors (but will not produce any compiled output).
|
|
10
|
-
* `checkversion.py` is used internally as part of our release process.
|
|
11
|
-
* `docs.py` will build the documentation. The output will be in `docs/api`.
|
|
12
|
-
* `gendeps.py` will create `deps.js` which is required to use the uncompiled
|
|
13
|
-
library.
|
|
14
|
-
* `shakaBuildHelpers.py` is a utility library used by these scripts.
|
|
15
|
-
* `stats.py` will read the compiled library and source map to get information
|
|
16
|
-
about the size of the compiled library.
|
|
17
|
-
* `test.py` will run the unit/integration tests.
|
|
18
|
-
|
|
19
|
-
All the scripts here use two environment variables:
|
|
20
|
-
|
|
21
|
-
* `PRINT_ARGUMENTS` if set, will print the command-line to subprocesses.
|
|
22
|
-
* `RAISE_INTERRUPT` if set, will raise interrupts rather than swallowing them.
|
|
23
|
-
|
|
24
|
-
```shell
|
|
25
|
-
$ PRINT_ARGUMENTS=1 build.py
|
|
26
|
-
git -C /path/to/shaka describe --tags --dirty
|
|
27
|
-
Compiling the library...
|
|
28
|
-
java -jar /path/to/shaka/node_modules/.../compiler.jar --language_in ...
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
## Configurable Build
|
|
32
|
-
|
|
33
|
-
`build.py` is used to compile the library and can also be used to produce
|
|
34
|
-
customized builds that contain only the features that your app requires.
|
|
35
|
-
`build.py` accepts an optional argument `--name` which will set the name of the
|
|
36
|
-
build, defaulting to `ui`. All other arguments are treated as commands
|
|
37
|
-
describing what to include in the build. If nothing is given, it will use
|
|
38
|
-
`+@complete`.
|
|
39
|
-
|
|
40
|
-
A command is either an addition or a subtraction. An addition is prefixed with
|
|
41
|
-
a `+`; a subtraction with a `-`. An addition will add the JavaScript file (or
|
|
42
|
-
build file) to the resulting library while a subtraction will remove it. After
|
|
43
|
-
the first character, there is either the path to a JavaScript file, or a `@`
|
|
44
|
-
followed by the name of a build file.
|
|
45
|
-
|
|
46
|
-
Build files are the files found in `build/types/`. These files are simply a
|
|
47
|
-
newline separated list of commands to execute. So if the `+@complete` command
|
|
48
|
-
is given, it will open the complete file and run it (which may in turn open
|
|
49
|
-
other build files). Subtracting a build file will reverse all actions applied
|
|
50
|
-
by the given file. So `-@networking` will remove all the networking plugins.
|
|
51
|
-
|
|
52
|
-
```shell
|
|
53
|
-
# Examples:
|
|
54
|
-
build.py +@complete
|
|
55
|
-
build.py +@complete -@networking
|
|
56
|
-
build.py --name custom +@manifests +@networking +../my_plugin.js
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## Test
|
|
60
|
-
|
|
61
|
-
`test.py` accepts some arguments, but mostly will forward them to `karma`. You
|
|
62
|
-
can run `karma start --help` to get more info about the karma test runner. If
|
|
63
|
-
you don't have karma installed, it will be installed by `npm install` and will
|
|
64
|
-
be found in `node_modules/.bin`.
|
|
65
|
-
|
|
66
|
-
`test.py` has two arguments that it handles directly. `--force` will cause
|
|
67
|
-
the build to run even if there are no changes detected to the source code.
|
|
68
|
-
`--no-build` will not build the library even if it does not exist. Note that
|
|
69
|
-
some integration tests will not run without the compiled library present.
|
|
70
|
-
|
|
71
|
-
There are also several custom arguments that are handled in JavaScript by
|
|
72
|
-
`karma.conf.js` or the tests themselves (via `getClientArg`).
|
|
73
|
-
These arguments can be passed in using `test.py` or using `karma start`
|
|
74
|
-
directly:
|
|
75
|
-
* `--quick` will only run unit tests, skipping integration tests.
|
|
76
|
-
* `--enable-logging` will enable console logging. Logs will be printed to
|
|
77
|
-
the console. It also accepts a value for the log level `--enable-logging=1`,
|
|
78
|
-
defaulting to 3. See [lib/debug/log.js][] for the log levels (you must
|
|
79
|
-
pass the number).
|
|
80
|
-
* `--external` will run integration tests against external assets. This will
|
|
81
|
-
take an extremely long time to run, and requires a fast and reliable internet
|
|
82
|
-
connection.
|
|
83
|
-
* `--no-drm` will skip integration tests against DRM license servers. Not
|
|
84
|
-
specifying this flag requires a connection to the open internet.
|
|
85
|
-
* `--uncompiled` will run integration tests using the uncompiled library instead
|
|
86
|
-
of the compiled version.
|
|
87
|
-
* `--random` will run the tests in a random order to isolate test dependencies.
|
|
88
|
-
* `--seed` will seed the random test order so that the same order can be
|
|
89
|
-
reproduced across runs. Specify any value `--seed=xyz`.
|
|
90
|
-
* `--runs` allows running the tests multiple times in succession. This parameter
|
|
91
|
-
must be specified with a positive integer value, for example `--runs 5`.
|
|
92
|
-
* `--use-xvfb` will launch the browsers in a virtual display (only on Linux).
|
|
93
|
-
* `--filter` is used to filter a specific test or set of tests. This parameter
|
|
94
|
-
is specified as a RegExp string `--filter="DataUriPlugin .*\d"`.
|
|
95
|
-
|
|
96
|
-
The `karma` argument `--browsers` will set the browsers used to run the tests
|
|
97
|
-
(e.g. `--browsers Chrome,Firefox`). If you don't pass any arguments, `test.py`
|
|
98
|
-
will choose a defaults based on your platform. However, if you pass any
|
|
99
|
-
arguments to `test.py`, it will not choose browsers and you *must* pass
|
|
100
|
-
`--browsers`.
|
|
101
|
-
|
|
102
|
-
[lib/debug/log.js]: https://github.com/shaka-project/shaka-player/blob/main/lib/debug/log.js
|
|
103
|
-
|
|
104
|
-
## Stats
|
|
105
|
-
|
|
106
|
-
`stats.py` is used to print various stats about the compiled library. This is
|
|
107
|
-
used internally to determine dependencies and to determine the size of the
|
|
108
|
-
compiled library.
|
|
109
|
-
|
|
110
|
-
Before running the script, you have to compile it first. Then you need to pass
|
|
111
|
-
either the name of the build (e.g. `ui`) or the path to the `.map` file.
|
|
112
|
-
You will also need to pass some arguments to determine the output you want.
|
|
113
|
-
You must pass exactly one of the following:
|
|
114
|
-
|
|
115
|
-
* `-c` or `--class-deps` will print dependencies between classes.
|
|
116
|
-
* `-f` or `--function-deps` will print dependencies between functions.
|
|
117
|
-
* `-s` or `--function-sizes` will print the compiled size of the functions.
|
|
118
|
-
* `-t` or `--all-tokens` will print all the tokens in the source map.
|
|
119
|
-
|
|
120
|
-
For `--class-deps` and `--function-deps` you can also output in DOT format.
|
|
121
|
-
This format can be used to produce visual graphs of the dependencies. Passing
|
|
122
|
-
in `-d` or `--dot-format` will output in DOT format. Then the output can be
|
|
123
|
-
piped into another program to produce the output. For example using `graphviz`:
|
|
124
|
-
|
|
125
|
-
```shell
|
|
126
|
-
stats.py -c -d | fdb -Goverlap=prism | neato -n2 -Tsvg > out.svg
|
|
127
|
-
```
|
package/build/__init__.py
DELETED
|
File without changes
|
package/build/all.py
DELETED
|
@@ -1,150 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
#
|
|
3
|
-
# Copyright 2016 Google LLC
|
|
4
|
-
#
|
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
# you may not use this file except in compliance with the License.
|
|
7
|
-
# You may obtain a copy of the License at
|
|
8
|
-
#
|
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
#
|
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
# See the License for the specific language governing permissions and
|
|
15
|
-
# limitations under the License.
|
|
16
|
-
|
|
17
|
-
"""Builds the dependencies, runs the checks, and compiles the library."""
|
|
18
|
-
|
|
19
|
-
import argparse
|
|
20
|
-
|
|
21
|
-
import apps
|
|
22
|
-
import build
|
|
23
|
-
import check
|
|
24
|
-
import compiler
|
|
25
|
-
import docs
|
|
26
|
-
import gendeps
|
|
27
|
-
import generateLocalizations
|
|
28
|
-
import shakaBuildHelpers
|
|
29
|
-
|
|
30
|
-
import os
|
|
31
|
-
import re
|
|
32
|
-
|
|
33
|
-
def compile_less(path_name, main_file_name, parsed_args):
|
|
34
|
-
match = re.compile(r'.*\.less$')
|
|
35
|
-
base = shakaBuildHelpers.get_source_base()
|
|
36
|
-
main_less_src = os.path.join(base, path_name, main_file_name + '.less')
|
|
37
|
-
all_less_srcs = shakaBuildHelpers.get_all_files(
|
|
38
|
-
os.path.join(base, path_name), match)
|
|
39
|
-
output = os.path.join(base, 'dist', main_file_name + '.css')
|
|
40
|
-
|
|
41
|
-
less = compiler.Less(main_less_src, all_less_srcs, output)
|
|
42
|
-
return less.compile(parsed_args.force)
|
|
43
|
-
|
|
44
|
-
def main(args):
|
|
45
|
-
parser = argparse.ArgumentParser(
|
|
46
|
-
description='User facing build script for building the Shaka'
|
|
47
|
-
' Player Project.')
|
|
48
|
-
|
|
49
|
-
parser.add_argument(
|
|
50
|
-
'--locales',
|
|
51
|
-
type=str,
|
|
52
|
-
nargs='+',
|
|
53
|
-
default=generateLocalizations.DEFAULT_LOCALES,
|
|
54
|
-
help='The list of locales to compile in (default %(default)r)')
|
|
55
|
-
|
|
56
|
-
parser.add_argument(
|
|
57
|
-
'--fix',
|
|
58
|
-
help='Automatically fix style violations.',
|
|
59
|
-
action='store_true')
|
|
60
|
-
|
|
61
|
-
parser.add_argument(
|
|
62
|
-
'--force',
|
|
63
|
-
'-f',
|
|
64
|
-
help='Force building the library even if no files have changed.',
|
|
65
|
-
action='store_true')
|
|
66
|
-
|
|
67
|
-
parser.add_argument(
|
|
68
|
-
'--debug',
|
|
69
|
-
help='Limit which build types to build. Will at least build the debug '
|
|
70
|
-
'version.',
|
|
71
|
-
action='store_true')
|
|
72
|
-
|
|
73
|
-
parser.add_argument(
|
|
74
|
-
'--release',
|
|
75
|
-
help='Limit which build types to build. Will at least build the '
|
|
76
|
-
'release version.',
|
|
77
|
-
action='store_true')
|
|
78
|
-
|
|
79
|
-
parsed_args = parser.parse_args(args)
|
|
80
|
-
|
|
81
|
-
# Make the dist/ folder, ignore errors.
|
|
82
|
-
base = shakaBuildHelpers.get_source_base()
|
|
83
|
-
try:
|
|
84
|
-
os.mkdir(os.path.join(base, 'dist'))
|
|
85
|
-
except OSError:
|
|
86
|
-
pass
|
|
87
|
-
|
|
88
|
-
# Generate localizations before running gendeps, so the output is available
|
|
89
|
-
# to the deps system.
|
|
90
|
-
# TODO(#1858): It might be time to look at a third-party build system.
|
|
91
|
-
localizations = compiler.GenerateLocalizations(parsed_args.locales)
|
|
92
|
-
if not localizations.generate(parsed_args.force):
|
|
93
|
-
return 1
|
|
94
|
-
|
|
95
|
-
if gendeps.main([]) != 0:
|
|
96
|
-
return 1
|
|
97
|
-
|
|
98
|
-
check_args = []
|
|
99
|
-
if parsed_args.fix:
|
|
100
|
-
check_args += ['--fix']
|
|
101
|
-
if parsed_args.force:
|
|
102
|
-
check_args += ['--force']
|
|
103
|
-
if check.main(check_args) != 0:
|
|
104
|
-
return 1
|
|
105
|
-
|
|
106
|
-
docs_args = []
|
|
107
|
-
if parsed_args.force:
|
|
108
|
-
docs_args += ['--force']
|
|
109
|
-
if docs.main(docs_args) != 0:
|
|
110
|
-
return 1
|
|
111
|
-
|
|
112
|
-
if not compile_less('ui', 'controls', parsed_args):
|
|
113
|
-
return 1;
|
|
114
|
-
if not compile_less('demo', 'demo', parsed_args):
|
|
115
|
-
return 1
|
|
116
|
-
|
|
117
|
-
build_args_with_ui = ['--name', 'ui', '+@complete']
|
|
118
|
-
build_args_with_ui += ['--locales'] + parsed_args.locales
|
|
119
|
-
build_args_without_ui = ['--name', 'compiled', '+@complete', '-@ui']
|
|
120
|
-
|
|
121
|
-
if parsed_args.force:
|
|
122
|
-
build_args_with_ui += ['--force']
|
|
123
|
-
build_args_without_ui += ['--force']
|
|
124
|
-
|
|
125
|
-
# Create the list of build modes to build with. If the list is empty
|
|
126
|
-
# by the end, then populate it with every mode.
|
|
127
|
-
modes = []
|
|
128
|
-
modes += ['debug'] if parsed_args.debug else []
|
|
129
|
-
modes += ['release'] if parsed_args.release else []
|
|
130
|
-
|
|
131
|
-
# If --debug or --release are not given, build with everything.
|
|
132
|
-
if not modes:
|
|
133
|
-
modes += ['debug', 'release']
|
|
134
|
-
|
|
135
|
-
for mode in modes:
|
|
136
|
-
# Complete build includes the UI library, but it is optional and player lib
|
|
137
|
-
# should build and work without it as well.
|
|
138
|
-
# First, build the full build (UI included) and then build excluding UI.
|
|
139
|
-
for build_args in [build_args_with_ui, build_args_without_ui]:
|
|
140
|
-
if build.main(build_args + ['--mode', mode]) != 0:
|
|
141
|
-
return 1
|
|
142
|
-
|
|
143
|
-
is_debug = mode == 'debug'
|
|
144
|
-
if not apps.build_all(parsed_args.force, is_debug):
|
|
145
|
-
return 1
|
|
146
|
-
|
|
147
|
-
return 0
|
|
148
|
-
|
|
149
|
-
if __name__ == '__main__':
|
|
150
|
-
shakaBuildHelpers.run_main(main)
|
package/build/apps.py
DELETED
|
@@ -1,186 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python
|
|
2
|
-
#
|
|
3
|
-
# Copyright 2016 Google LLC
|
|
4
|
-
#
|
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
# you may not use this file except in compliance with the License.
|
|
7
|
-
# You may obtain a copy of the License at
|
|
8
|
-
#
|
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
#
|
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
# See the License for the specific language governing permissions and
|
|
15
|
-
# limitations under the License.
|
|
16
|
-
|
|
17
|
-
"""Build our various applications."""
|
|
18
|
-
|
|
19
|
-
import argparse
|
|
20
|
-
import logging
|
|
21
|
-
import os
|
|
22
|
-
import re
|
|
23
|
-
|
|
24
|
-
import build
|
|
25
|
-
import compiler
|
|
26
|
-
import shakaBuildHelpers
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
def compile_demo(force, is_debug):
|
|
30
|
-
"""Compile the demo application.
|
|
31
|
-
|
|
32
|
-
Args:
|
|
33
|
-
force: True to rebuild, False to ignore if no changes are detected.
|
|
34
|
-
is_debug: True to compile for debugging, false for release.
|
|
35
|
-
|
|
36
|
-
Returns:
|
|
37
|
-
True on success, False on failure.
|
|
38
|
-
"""
|
|
39
|
-
logging.info('Compiling the demo app (%s)...',
|
|
40
|
-
'debug' if is_debug else 'release')
|
|
41
|
-
|
|
42
|
-
base = shakaBuildHelpers.get_source_base()
|
|
43
|
-
closure_base_js = shakaBuildHelpers.get_closure_base_js_path()
|
|
44
|
-
get = shakaBuildHelpers.get_all_js_files
|
|
45
|
-
cast_receiver = set(get('demo', 'cast_receiver'))
|
|
46
|
-
files = set(
|
|
47
|
-
get('demo') +
|
|
48
|
-
get('externs') +
|
|
49
|
-
get('ui', 'externs') +
|
|
50
|
-
[closure_base_js]) - cast_receiver
|
|
51
|
-
|
|
52
|
-
# Make sure we don't compile in load.js, which will be used to bootstrap
|
|
53
|
-
# everything else. If we build that into the output, we will get an
|
|
54
|
-
# infinite loop of scripts adding themselves.
|
|
55
|
-
files.remove(os.path.join(base, 'demo', 'load.js'))
|
|
56
|
-
# Remove service_worker.js as well. This executes in a different context.
|
|
57
|
-
files.remove(os.path.join(base, 'demo', 'service_worker.js'))
|
|
58
|
-
# Don't compile in the uncompiled require file.
|
|
59
|
-
files.remove(os.path.join(base, 'demo', 'demo_uncompiled.js'))
|
|
60
|
-
# Add lib/debug/asserts.js, which is required for goog.assert.
|
|
61
|
-
files.add(os.path.join(base, 'lib', 'debug', 'asserts.js'))
|
|
62
|
-
|
|
63
|
-
# Add in the generated externs, so that the demo compilation knows the
|
|
64
|
-
# definitions of the library APIs.
|
|
65
|
-
externs = ('shaka-player.ui.debug.externs.js' if is_debug
|
|
66
|
-
else 'shaka-player.ui.externs.js')
|
|
67
|
-
|
|
68
|
-
files.add(os.path.join(base, 'dist', externs))
|
|
69
|
-
|
|
70
|
-
name = 'demo.compiled' + ('.debug' if is_debug else '')
|
|
71
|
-
|
|
72
|
-
# TODO: Why do we always use debug_closure_opts? Nobody remembers.
|
|
73
|
-
closure_opts = build.common_closure_opts + build.debug_closure_opts
|
|
74
|
-
closure_opts += [
|
|
75
|
-
# Ignore missing goog.require since we assume the whole library is
|
|
76
|
-
# already included.
|
|
77
|
-
'--jscomp_off=missingRequire',
|
|
78
|
-
'-D', 'COMPILED=true',
|
|
79
|
-
]
|
|
80
|
-
|
|
81
|
-
closure = compiler.ClosureCompiler(files, name)
|
|
82
|
-
# The output wrapper is only designed for the library. It can't be used
|
|
83
|
-
# for apps. TODO: Should we add a simple function wrapper for apps?
|
|
84
|
-
closure.add_wrapper = False
|
|
85
|
-
if not closure.compile(closure_opts, force):
|
|
86
|
-
return False
|
|
87
|
-
|
|
88
|
-
return True
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
def compile_receiver(force, is_debug):
|
|
92
|
-
"""Compile the cast receiver application.
|
|
93
|
-
|
|
94
|
-
Args:
|
|
95
|
-
force: True to rebuild, False to ignore if no changes are detected.
|
|
96
|
-
is_debug: True to compile for debugging, false for release.
|
|
97
|
-
|
|
98
|
-
Returns:
|
|
99
|
-
True on success, False on failure.
|
|
100
|
-
"""
|
|
101
|
-
logging.info('Compiling the receiver app (%s)...',
|
|
102
|
-
'debug' if is_debug else 'release')
|
|
103
|
-
|
|
104
|
-
base = shakaBuildHelpers.get_source_base()
|
|
105
|
-
closure_base_js = shakaBuildHelpers.get_closure_base_js_path()
|
|
106
|
-
get = shakaBuildHelpers.get_all_js_files
|
|
107
|
-
files = set(get('demo', 'common') +
|
|
108
|
-
get('demo', 'cast_receiver') +
|
|
109
|
-
get('externs') +
|
|
110
|
-
get('ui', 'externs') +
|
|
111
|
-
[closure_base_js])
|
|
112
|
-
|
|
113
|
-
# Add in the generated externs, so that the receiver compilation knows the
|
|
114
|
-
# definitions of the library APIs.
|
|
115
|
-
externs = ('shaka-player.ui.debug.externs.js' if is_debug
|
|
116
|
-
else 'shaka-player.ui.externs.js')
|
|
117
|
-
|
|
118
|
-
files.add(os.path.join(base, 'dist', externs))
|
|
119
|
-
files.add(os.path.join(base, 'lib', 'debug', 'asserts.js'))
|
|
120
|
-
|
|
121
|
-
name = 'receiver.compiled' + ('.debug' if is_debug else '')
|
|
122
|
-
|
|
123
|
-
# TODO: Why do we always use debug_closure_opts? Nobody remembers.
|
|
124
|
-
closure_opts = build.common_closure_opts + build.debug_closure_opts
|
|
125
|
-
closure_opts += [
|
|
126
|
-
# Ignore missing goog.require since we assume the whole library is
|
|
127
|
-
# already included.
|
|
128
|
-
'--jscomp_off=missingRequire',
|
|
129
|
-
'-D', 'COMPILED=true',
|
|
130
|
-
]
|
|
131
|
-
|
|
132
|
-
closure = compiler.ClosureCompiler(files, name)
|
|
133
|
-
# The output wrapper is only designed for the library. It can't be used
|
|
134
|
-
# for apps. TODO: Should we add a simple function wrapper for apps?
|
|
135
|
-
closure.add_wrapper = False
|
|
136
|
-
if not closure.compile(closure_opts, force):
|
|
137
|
-
return False
|
|
138
|
-
|
|
139
|
-
return True
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
def build_all(force, is_debug):
|
|
143
|
-
if not compile_demo(force, is_debug):
|
|
144
|
-
return False
|
|
145
|
-
|
|
146
|
-
if not compile_receiver(force, is_debug):
|
|
147
|
-
return False
|
|
148
|
-
|
|
149
|
-
return True
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
def main(args):
|
|
153
|
-
parser = argparse.ArgumentParser(
|
|
154
|
-
description=__doc__,
|
|
155
|
-
formatter_class=argparse.RawDescriptionHelpFormatter)
|
|
156
|
-
|
|
157
|
-
parser.add_argument(
|
|
158
|
-
'--force',
|
|
159
|
-
'-f',
|
|
160
|
-
help='Force building the library even if no files have changed.',
|
|
161
|
-
action='store_true')
|
|
162
|
-
|
|
163
|
-
parsed_args = parser.parse_args(args)
|
|
164
|
-
|
|
165
|
-
# Make the dist/ folder, ignore errors.
|
|
166
|
-
base = shakaBuildHelpers.get_source_base()
|
|
167
|
-
try:
|
|
168
|
-
os.mkdir(os.path.join(base, 'dist'))
|
|
169
|
-
except OSError:
|
|
170
|
-
pass
|
|
171
|
-
|
|
172
|
-
force = parsed_args.force
|
|
173
|
-
|
|
174
|
-
# Update node modules if needed.
|
|
175
|
-
if not shakaBuildHelpers.update_node_modules():
|
|
176
|
-
return 1
|
|
177
|
-
|
|
178
|
-
for is_debug in [True, False]:
|
|
179
|
-
if not build_all(force, is_debug):
|
|
180
|
-
return 1
|
|
181
|
-
|
|
182
|
-
return 0
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
if __name__ == '__main__':
|
|
186
|
-
shakaBuildHelpers.run_main(main)
|