Skip to content

Commit

Permalink
build: Stop using deprecated tool to generate closure deps (#4060)
Browse files Browse the repository at this point in the history
The depswriter.py tool from google-closure-library was generating
deprecation warnings.  This switches to a newer, rewritten version
called google-closure-deps.
  • Loading branch information
joeyparrish committed Mar 23, 2022
1 parent 33e8400 commit 6f274cb
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 39 deletions.
26 changes: 11 additions & 15 deletions build/gendeps.py
Expand Up @@ -24,17 +24,6 @@
import shakaBuildHelpers


# The relative path in each of these is relative to Closure's base.js, which
# lives at node_modules/google-closure-library/closure/goog/base.js
deps_args = [
'--root_with_prefix=lib ../../../../lib',
'--root_with_prefix=ui ../../../../ui',
'--root_with_prefix=third_party ../../../../third_party',
'--root_with_prefix=dist ../../../../dist',
'--root_with_prefix=demo ../../../../demo',
]


def main(_):
"""Generates the uncompiled dependencies files."""
# Update node modules if needed.
Expand All @@ -50,12 +39,19 @@ def main(_):
except OSError:
pass
os.chdir(base)
deps_writer = os.path.join(
'node_modules', 'google-closure-library',
'closure', 'bin', 'build', 'depswriter.py')

make_deps = shakaBuildHelpers.get_node_binary(
'google-closure-deps', 'closure-make-deps')

try:
cmd_line = [sys.executable or 'python', deps_writer] + deps_args
cmd_line = make_deps + [
# Folders to search for sources using goog.require/goog.provide
'-r', 'demo', 'lib', 'ui', 'third_party',
# Individual files to add to those
'-f', 'dist/locales.js',
# The path to the folder containing the Closure library's base.js
'--closure-path', 'node_modules/google-closure-library/closure/goog',
]
deps = shakaBuildHelpers.execute_get_output(cmd_line)
with open(os.path.join(base, 'dist', 'deps.js'), 'wb') as f:
f.write(deps)
Expand Down
69 changes: 47 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Expand Up @@ -29,8 +29,9 @@
"esprima": "^4.0.1",
"fastestsmallesttextencoderdecoder": "^1.0.22",
"fontfaceonload": "^1.0.2",
"google-closure-compiler-java": "^20220202.0.0",
"google-closure-library": "^20220104.0.0",
"google-closure-compiler-java": "^20220301.0.0",
"google-closure-deps": "^20220301.0.0",
"google-closure-library": "^20220301.0.0",
"htmlhint": "github:joeyparrish/HTMLHint#1c3a7e8b",
"jasmine-ajax": "^4.0.0",
"jimp": "^0.16.1",
Expand Down

0 comments on commit 6f274cb

Please sign in to comment.