Commit Graph

32 Commits

Author SHA1 Message Date
Joey Parrish 7e6a0f38ff fix: Correct license headers in misc. files
This corrects/normalizes license headers in misc. files, such as
config files, docs, build tools, tests, and externs.  This does not
affect the compiled output, and is only done for consistency.

Issue #2638

Change-Id: I9d8da2de55243b08d7df2b743aac73c6f15e858a
2020-06-09 16:13:56 -07:00
Joey Parrish 1076b78465 Unfork Closure base and update the compiler
The Closure Library's base.js, the Closure Compiler, and the Closure
deps-writer are all now loaded via NPM instead of commiting them
directly to the repo.  This also updates both the library and compiler
to the latest version: 20200406.

We still have a fork of the Closure Library's URI parser.  The latest
upstream version of that has too many dependencies on the rest of the
library to import directly from NPM.

Some internals of the build system have been refactored, and the
"complete" set of files in the build system now includes third_party.

Our forked URI parser does not pass lint checks yet, so the linter
does not run over third_party yet.

A couple of overly-severe sets of compiler checks have been disabled,
since even the latest Closure Library's base.js doesn't pass them.

The script-loader in load.js had to be updated for compatibility with
the new Closure Library.  If you don't return "true" now, Closure's
base.js will stop loading subsequent source files.

Some local externs that we had written are now available from the
compiler, so our local copies have been deleted.

A few type-related changes have been made as well, removing casts that
were necessary with the old compiler, but not necessary with the new
one.

Finally, this corrects some type issues in the tests using the new
"typeof" annotation from the compiler.  This allows us to type a
variable as a class defined elsewhere.  For example, after loading the
compiled library, we can reference compiledShaka.Player, which has the
type "typeof shaka.Player".  The compiler can then type-check all uses
of it in the tests.

Closes #2528 (bad polyfill code generated by the old compiler)

Change-Id: I62ec61e82d4edf342b2c576c2d4f89f11562ee65
2020-04-30 19:32:30 -07:00
Jacob Trimble 6ab4e68ff2 Fix default encoding when reading files.
Under Windows, the default encoding isn't UTF-8, so we are getting
encoding errors when trying to read files.  This adds a helper to
explicitly set the encoding to UTF-8 in Python3.  This doesn't really
affect Python2 since it reads the file as byte strings.

We can't use 'locale.setlocale' to fix this since (at least on my
machine) we can't set the encoding to be UTF-8 on Windows.

Fixes #2206

Change-Id: I76e35cc9ae638b433ca61c7bda6478e989bc755a
2019-10-25 17:23:28 +00:00
Jacob Trimble 12b5cee024 Fix some python3 compatibility.
Change-Id: Iab859ba529f1339cec8befc2fbce46ca28a62a0f
2019-06-11 22:36:18 +00:00
Joey Parrish 42b40bd3da Require NodeJS v8+ and NPM v5+
This updates our build requirements to NodeJS v8+ and NPM v5+, both
released in 2017.

This also clarifies our support for Python 3 (not well-documented
before) to the version we are using on Debian, v3.5.

Requiring NodeJS v8+ means our node tools (like our extern generator)
no longer need shims for compatibility.  This allows us to drop the
"es6-shim" and "array-includes" modules.

In NPM v5+, the "prepublish" script has been deprecated, and replaced
with "prepublishOnly" (which is what we want) and "prepare" (the old
behavior we had to work around).  This allows us to drop the
"in-publish" module.

Change-Id: Ied189c76a58fe981c12d41155b834f2d6ea73bbd
2019-05-15 20:32:34 +00:00
Joey Parrish 6df4d40e7b Handle prereleases in version parser
Prereleases and other build metadata can come after the three numeric
parts of the version, separated by a hyphen.  This fixes both parsing
and sorting of these versions.

Fixes #1758

Change-Id: I6e24f1a96a19204178eef014e2765fc40ccb48e8
2019-01-10 23:11:05 +00:00
Jacob Trimble b3f2141dbd Fix paths on Windows.
Fixes #1700

Change-Id: I864da5023e82639a0e81ca8f9c26563add93f2ab
2018-12-04 16:51:12 +00:00
Sandra Lokshina 6b1ca2d229 Initial release of Shaka Player UI
Other contributors:
 - @joeyparrish
 - @michellezhuogg
 - @TheModMaker
 - @theodab
 - @vaage

Change-Id: If6df33d9ab5035d1ead4402004f7de37ee8470f4
2018-11-16 14:40:37 -08:00
Jacob Trimble 841f31b3ba Add support for Python3.
Change-Id: Ia7a5b41e3e7d4a75339d6e4de85b8b303fad8d9d
2018-10-23 19:10:29 +00:00
Jacob Trimble c4aecb81c5 Fix confusing log when building.
Currently when building, the compiler prints a confusing log while
compiling the wrapper. "The compiler is waiting for input via stdin."
Since we are handling that, just suppress the message.

Change-Id: Ie1ad7eba51774e80b515d37d5ae926aabc507a5f
2018-06-21 21:36:38 +00:00
Joey Parrish 53a7433478 Execute node module bins directly
This avoids line-length limits on Windows in the node module's
pass-through shell script.

The long list of files, combined with a node module's bin file,
tripped the Windows command-line length limit of 8k.  The transition
to eslint, therefore, broke the Windows build.

Issue #1157
Closes #1228

Change-Id: Ie57624efbbbfb4a27035e82ab12e788d18652ae3
2018-01-18 00:05:17 +00:00
Michelle Zhuo ec636bbe90 Calculate git version in shaka-player directory
If the shaka-player directory doesn't have a '.git' file, we'll use the
npm version instead of finding the '.git' file in the whole repository.
This is to prevent grabbing version tag from a parent project, which
uses shaka-player as a dependency.

Test command:
python -c 'from build import shakaBuildHelpers; print
shakaBuildHelpers.calculate_version()'
If there's is a .git file, it shows the git version.
If not, it shows the npm version.

Closes #871

Change-Id: Iee3cd6868c46f327966fd6ce5071ca7b750174b6
2017-06-23 00:06:42 +00:00
Joey Parrish b3f29a31ea Fix pollution from npm on Windows and fix npm v5
Closes #776, #854

Change-Id: I63e785342e051042ba603b63973ddfdc89d80f1a
2017-06-06 18:31:42 +00:00
Jacob Trimble fddcf0c259 Use logging module over print.
Rather than using print, use the logging module.  This allows embedding
environments to setup logging how they want.  This also ensures the logs
are flushed properly.

The prints for check.py, checkversion.py, stats.py, and for the --help
flag will still be printed to stdout since that would be the expected
output location.

Change-Id: I26e1bc866803c42981628c7e62261d13c7b3ff2b
2017-05-10 21:25:39 +00:00
Joey Parrish 633c9b8def Fix typo in build script
Change-Id: I57bda40310cb908e0c28eb4b93be6d1648aef4a1
2017-04-25 11:33:27 -07:00
Joey Parrish 9f8b540ee5 Update node modules only when needed
Since node modules are required in several parts of the build
process now, avoid updating them unless package.json has changed
since the last update.

Change-Id: Ied40f198fff80bf261f77269995e9a58881a0462
2017-04-25 17:06:57 +00:00
Joey Parrish 1e0ad7126f Update shebang lines of python scripts
/usr/bin/env python is preferable, since it allows us to support
executable scripts on systems where python is installed in places
other than /usr/bin.

Incidentally, this was the only thing I needed to do to confirm
full build support on Windows, so I'm dropping a TODO about Windows
support for the extern generator.

Change-Id: Ice93174428e0d8015d0a7787f07a17e8ac808dc7
2017-04-24 20:17:43 +00:00
Jacob Trimble ff7f593eee Don't pipe stdout when running tests.
A recent change for printing errors for missing dependencies broke
the tests script by always piping stdout to a string.  This makes the
tests (and similar subprocesses) inherit stdout so it prints to the
terminal.

Change-Id: I13bcb2ac49b3ae5b1b1cc81c458124f5ac78a1e8
2017-01-11 11:35:44 -08:00
Jacob Trimble dfa356b7d9 Print error when missing dependencies in build scripts.
When a program (e.g. Java) cannot be found in the build scripts, it
will now print a more specific error message and quit early to avoid
other confusing messages.

Change-Id: I5f1f26a6c05b8db45355bfbc8d799d603c80c55c
2017-01-11 18:14:28 +00:00
Chad Assareh d274213912 Gracefully handle running build/test.py without npm installed.
Change-Id: Iaf359ded1e4723de2bf9a2082a6d7b981a6979c4
2017-01-06 22:00:50 +00:00
Joey Parrish 6f47acf688 Fix spurious error message in build/checkversion.py
There is a meaningless and unhelpful error message appearing at publish
time with some npm versions.  Suppress it by including stderr into the
captured stdout.

Change-Id: I73693433e5df5cc8d63375c08f765fbbb801f10f
2016-10-26 20:30:20 +00:00
Jacob Trimble 1e5dc5cc14 Fix build scripts for Windows.
* Node binaries should have .cmd appended to file name.
* htmlhint cannot find .htmlhintrc file.
* Use same python environment for subprocesses.

Closes #526

Change-Id: I6b4c898b39a3e2eb8d808feb2b46b79fba5dc455
2016-09-20 14:01:42 -07:00
Jacob Trimble a1449e44dc Make build files consistent with Google python style guide.
Change-Id: I49d181c4dbe4fe12b73cdc4a5c78b3dcf1319b56
2016-06-28 22:30:30 +00:00
Joey Parrish 1972925e1b Print args in a usable copy-paste form
Change-Id: I816392f2ebce99e3edae9d67553d0efde3edbbee
2016-04-06 23:15:56 +00:00
Jacob Trimble 18849bf6a6 Detect and print error for unsupported npm versions.
On versions before v1.3.12, 'npm update' appears to do nothing and
and returns success.  This causes the tests to fail if the node
modules are not installed yet.  Now it will detect the npm version
and print an error message if it is unsupported.

Closes #318

Change-Id: Iff1db8a6f85d5ce705e5504ee9cb23d2246b87c3
2016-04-05 18:34:20 +00:00
Jacob Trimble 19973d63f4 Changed copyright headers from 2015 to 2016.
Change-Id: I429ff27e4794c03b7ea392e38415075077f9bfb1
2016-03-15 16:32:13 -07:00
Joey Parrish 11ad4f7699 Update modules before running tests
Change-Id: I7039418a0a27de56b0f452800c90eebc084d814c
2016-03-10 18:01:51 +00:00
Johan Sundström e915a893be Always build the same input files to a stable output.
(Leaning just on traversal order, two different checkouts may produce different
file list orders for different people building, on some OS:es / file systems.)
2016-03-03 18:24:43 -08:00
Joey Parrish 198f784a47 Tolerate error return values from npm ls
This happens, for example, if you have modules installed locally
which are not required by shaka-player.

Change-Id: I338b66382d4e6046e1560161b192dab8e4ac78d9
2016-02-26 17:01:27 -08:00
Chad Assareh 1c82f75786 Adding webdriver browsers to karma conf.
Change-Id: I2f2a93aca79d44bc4051195260011ef4c9643e13
2016-02-19 22:23:25 +00:00
Jacob Trimble 92075fbc29 Replaced remaining build scripts with python.
This also makes all build scripts runnable on Windows using both
Cygwin and native python.

Change-Id: If324800b8b899cac1cc715d30383255cd5f6ee71
2016-02-02 00:37:42 +00:00
Jacob Trimble 5cb3baa602 Added configurable build framework.
Created a new build script written in python.  This can be used to
build one of several available build types as well as any custom
build.  It uses a custom file format to specify the contents of a
build.  The default is to build the complete build.

There will be a follow up change to replace the rest of the build
scripts with python.  This replaces lib.sh and build.sh, but lib.sh
still exists.

This also updates the stat script for the new output location and
now supports giving the build type name as the argument.  Also can
now be run with any working directory.

Change-Id: I1243e8ad2c7e780ef67d002d4ac8d7d5e3bd5211
2016-01-28 10:31:58 -08:00