Exemple #1
0
    def build_library(self, name, locales, force, is_debug):
        """Builds Shaka Player using the files in |self.include|.

    Args:
      name: The name of the build.
      locales: A list of strings of locale identifiers.
      force: True to rebuild, False to ignore if no changes are detected.
      is_debug: True to compile for debugging, false for release.

    Returns:
      True on success; False on failure.
    """
        self.add_closure()
        if not self.add_core():
            return False
        if self.has_ui():
            self.generate_localizations(locales, force)

        if is_debug:
            name += '.debug'

        build_name = 'shaka-player.' + name
        closure = compiler.ClosureCompiler(self.include, build_name)

        closure_opts = common_closure_opts + common_closure_defines
        if is_debug:
            closure_opts += debug_closure_opts + debug_closure_defines
        else:
            closure_opts += release_closure_opts + release_closure_defines

        if not closure.compile(closure_opts, force):
            return False

        # 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):
            return False

        generated_externs = [extern_generator.output]
        shaka_externs = shakaBuildHelpers.get_all_js_files('externs')
        if self.has_ui():
            shaka_externs += shakaBuildHelpers.get_all_js_files('ui/externs')
        ts_def_generator = compiler.TsDefGenerator(
            generated_externs + shaka_externs, build_name)

        if not ts_def_generator.generate(force):
            return False

        return True
Exemple #2
0
  def build_library(self, name, locales, force, is_debug):
    """Builds Shaka Player using the files in |self.include|.

    Args:
      name: The name of the build.
      locales: A list of strings of locale identifiers.
      force: True to rebuild, False to ignore if no changes are detected.
      is_debug: True to compile for debugging, false for release.

    Returns:
      True on success; False on failure.
    """
    self.add_closure()
    if not self.add_core():
      return False
    if self.has_ui():
      self.generate_localizations(locales, force)

    if is_debug:
      name += '.debug'

    build_name = 'shaka-player.' + name
    closure = compiler.ClosureCompiler(self.include, build_name)

    # Don't pass node modules to the extern generator.
    local_include = set([f for f in self.include if 'node_modules' not in f])
    generator = compiler.ExternGenerator(local_include, build_name)

    closure_opts = common_closure_opts + common_closure_defines
    if is_debug:
      closure_opts += debug_closure_opts + debug_closure_defines
      # The output wrapper is only used in the release build.
      closure.add_wrapper = False
    else:
      closure_opts += release_closure_opts + release_closure_defines

    if not closure.compile(closure_opts, force):
      return False

    if not generator.generate(force):
      return False

    return True
Exemple #3
0
  def build_library(self, name, force, is_debug):
    """Builds Shaka Player using the files in |self.include|.

    Args:
      name: The name of the build.
      force: True to rebuild, False to ignore if no changes are detected.
      is_debug: True to compile for debugging, false for release.

    Returns:
      True on success; False on failure.
    """
    self.add_closure()
    self.add_core()

    if is_debug:
      name += '.debug'

    build_name = 'shaka-player.' + name
    closure = compiler.ClosureCompiler(self.include, build_name)
    generator = compiler.ExternGenerator(self.include, build_name)

    closure_opts = common_closure_opts + common_closure_defines
    if is_debug:
      closure_opts += debug_closure_opts + debug_closure_defines
      # The output wrapper is only used in the release build.
      closure.add_wrapper = False
    else:
      closure_opts += release_closure_opts + release_closure_defines

    if not closure.compile(closure_opts, force):
      return False

    if not generator.generate(force):
      return False

    return True