Skip to content

Commit

Permalink
build: fix build failure in context of node module
Browse files Browse the repository at this point in the history
Building Shaka Player after installing it via node currently results
in a build failure.  This is because stylelint wants to filter out any
sources that match the glob **/node_modules/**, which in that context
is all of our sources.

To fix the failure, we add the --disable-default-ignores flag to the
stylelint command line.

We also had a similar hard-coded exclusion in build.py, which is now
fixed, as well.

Change-Id: I33f6619ebaccce1e1efa5da68e31cd49036addcd
  • Loading branch information
joeyparrish committed Dec 8, 2020
1 parent ea90fbd commit 7d1a047
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
8 changes: 6 additions & 2 deletions build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,12 @@ def build_library(self, name, locales, force, is_debug):
if not closure.compile(closure_opts, force):
return False

# Don't pass node modules to the extern generator.
local_include = set([f for f in self.include if 'node_modules' not in f])
# Don't pass local node modules to the extern generator. But don't simply
# exclude the string 'node_modules', either, since Shaka Player could be
# rebuilt after installing it as a node module.
node_modules_path = os.path.join(
shakaBuildHelpers.get_source_base(), 'node_modules')
local_include = set([f for f in self.include if node_modules_path not in f])
extern_generator = compiler.ExternGenerator(local_include, build_name)

if not extern_generator.generate(force):
Expand Down
9 changes: 8 additions & 1 deletion build/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,14 @@ def lint(self, fix=False, force=False):
return True

stylelint = shakaBuildHelpers.get_node_binary('stylelint')
cmd_line = stylelint + ['--config', self.config_path] + self.source_files
cmd_line = stylelint + [
'--config', self.config_path,
# The "default ignores" is something like **/node_modules/**, which
# means that if we run the build scripts from inside the installed node
# modules of shaka-player, all our sources will be filtered out if we
# don't disable the default ignores in stylelint.
'--disable-default-ignores',
] + self.source_files

if fix:
cmd_line += ['--fix']
Expand Down

0 comments on commit 7d1a047

Please sign in to comment.