コード例 #1
0
ファイル: build.py プロジェクト: wgenemorgan/shaka-player
    def generate_externs(self, name):
        """Generates externs for the files in |self.include|.

    Args:
      name: The name of the build.

    Returns:
      True on success; False on failure.
    """
        # Update node modules if needed.
        if not shakaBuildHelpers.update_node_modules():
            return False

        files = [shakaBuildHelpers.cygwin_safe_path(f) for f in self.include]

        extern_generator = shakaBuildHelpers.cygwin_safe_path(
            os.path.join(shakaBuildHelpers.get_source_base(), 'build',
                         'generateExterns.js'))

        output = shakaBuildHelpers.cygwin_safe_path(
            os.path.join(shakaBuildHelpers.get_source_base(), 'dist',
                         'shaka-player.' + name + '.externs.js'))

        # TODO: support Windows builds
        cmd_line = ['node', extern_generator, '--output', output] + files
        if shakaBuildHelpers.execute_get_code(cmd_line) != 0:
            print >> sys.stderr, 'Externs generation failed'
            return False

        return True
コード例 #2
0
def main(args):
    parser = argparse.ArgumentParser(
        description=__doc__,
        formatter_class=argparse.RawDescriptionHelpFormatter)
    parser.add_argument('--fix',
                        help='Automatically fix style violations.',
                        action='store_true')
    parser.add_argument('--force',
                        '-f',
                        help='Force checks even if no files have changed.',
                        action='store_true')
    parser.add_argument(
        '--filter',
        metavar='CHECK',
        nargs='+',
        choices=[i[0] for i in _CHECKS],
        help='Run only the given checks (choices: %(choices)s).')

    parsed_args = parser.parse_args(args)

    # Update node modules if needed.
    if not shakaBuildHelpers.update_node_modules():
        return 1

    for name, step in _CHECKS:
        if not parsed_args.filter or name in parsed_args.filter:
            if not step(parsed_args):
                return 1
    return 0
コード例 #3
0
ファイル: check.py プロジェクト: TheModMaker/shaka-player
def main(args):
  parser = argparse.ArgumentParser(
      description=__doc__,
      formatter_class=argparse.RawDescriptionHelpFormatter)
  parser.add_argument('--fix',
                      help='Automatically fix style violations.',
                      action='store_true')

  parsed_args = parser.parse_args(args)

  # Update node modules if needed.
  if not shakaBuildHelpers.update_node_modules():
    return 1

  steps = [
      check_js_lint,
      check_html_lint,
      check_complete,
      check_tests,
      check_externs,
  ]
  for step in steps:
    if not step(parsed_args):
      return 1
  return 0
コード例 #4
0
def main(args):
    parser = argparse.ArgumentParser(
        description=__doc__,
        formatter_class=argparse.RawDescriptionHelpFormatter)

    parser.add_argument(
        '--force',
        '-f',
        help='Force building the library even if no files have changed.',
        action='store_true')

    parsed_args = parser.parse_args(args)

    # Make the dist/ folder, ignore errors.
    base = shakaBuildHelpers.get_source_base()
    try:
        os.mkdir(os.path.join(base, 'dist'))
    except OSError:
        pass

    force = parsed_args.force

    # Update node modules if needed.
    if not shakaBuildHelpers.update_node_modules():
        return 1

    for is_debug in [True, False]:
        if not build_all(force, is_debug):
            return 1

    return 0
コード例 #5
0
def run_tests(args):
    # Update node modules if needed.
    if not shakaBuildHelpers.update_node_modules():
        return 1

    # Generate dependencies and compile library.
    # This is required for the tests.
    if gendeps.gen_deps([]) != 0:
        return 1

    build_args = []
    if '--force' in args:
        build_args.append('--force')
        args.remove('--force')

    if '--no-build' in args:
        args.remove('--no-build')
    else:
        if build.main(build_args) != 0:
            return 1

    if '--runs' in args:
        return run_tests_multiple(args)
    else:
        return run_tests_single(args)
コード例 #6
0
def main(args):
    parser = argparse.ArgumentParser(
        description=__doc__,
        formatter_class=argparse.RawDescriptionHelpFormatter)
    parser.add_argument('--fix',
                        help='Automatically fix style violations.',
                        action='store_true')

    parsed_args = parser.parse_args(args)

    # Update node modules if needed.
    if not shakaBuildHelpers.update_node_modules():
        return 1

    steps = [
        check_js_lint,
        check_html_lint,
        check_complete,
        check_tests,
        check_externs,
    ]
    for step in steps:
        if not step(parsed_args):
            return 1
    return 0
コード例 #7
0
def main(args):
    for arg in args:
        if arg == '--help':
            usage()
            return 0
        else:
            logging.error('Unknown option: %s', arg)
            usage()
            return 1

    # Update node modules if needed.
    if not shakaBuildHelpers.update_node_modules():
        return 1

    steps = [
        check_closure_compiler_linter,
        check_js_lint,
        check_html_lint,
        check_complete,
        check_tests,
        check_externs,
    ]
    for step in steps:
        if not step():
            return 1
    return 0
コード例 #8
0
ファイル: check.py プロジェクト: jwplayer/shaka-player
def main(args):
  for arg in args:
    if arg == '--help':
      usage()
      return 0
    else:
      logging.error('Unknown option: %s', arg)
      usage()
      return 1

  # Update node modules if needed.
  if not shakaBuildHelpers.update_node_modules():
    return 1

  steps = [
    check_closure_compiler_linter,
    check_js_lint,
    check_html_lint,
    check_complete,
    check_tests,
    check_externs,
  ]
  for step in steps:
    if not step():
      return 1
  return 0
コード例 #9
0
ファイル: gendeps.py プロジェクト: xvmoon/shaka-player
def main(_):
    """Generates the uncompiled dependencies files."""
    # Update node modules if needed.
    if not shakaBuildHelpers.update_node_modules():
        return 1

    logging.info('Generating Closure dependencies...')

    # Make the dist/ folder, ignore errors.
    base = shakaBuildHelpers.get_source_base()
    try:
        os.mkdir(os.path.join(base, 'dist'))
    except OSError:
        pass
    os.chdir(base)
    deps_writer = os.path.join('node_modules', 'google-closure-library',
                               'closure', 'bin', 'build', 'depswriter.py')

    try:
        cmd_line = [sys.executable or 'python', deps_writer] + deps_args
        deps = shakaBuildHelpers.execute_get_output(cmd_line)
        with open(os.path.join(base, 'dist', 'deps.js'), 'wb') as f:
            f.write(deps)
        return 0
    except subprocess.CalledProcessError as e:
        return e.returncode
コード例 #10
0
ファイル: test.py プロジェクト: Ross-cz/shaka-player
def run_tests(args):
  # Update node modules if needed.
  if not shakaBuildHelpers.update_node_modules():
    return 1

  # Generate dependencies and compile library.
  # This is required for the tests.
  if gendeps.gen_deps([]) != 0:
    return 1

  build_args = []
  if '--force' in args:
    build_args.append('--force')
    args.remove('--force')

  if '--no-build' in args:
    args.remove('--no-build')
  else:
    if build.main(build_args) != 0:
      return 1

  if '--runs' in args:
    return run_tests_multiple(args)
  else:
    return run_tests_single(args)
コード例 #11
0
def main(args):
    parser = argparse.ArgumentParser(
        description=__doc__,
        formatter_class=argparse.RawDescriptionHelpFormatter)

    parser.add_argument(
        '--force',
        '-f',
        help='Force building the library even if no files have changed.',
        action='store_true')

    parser.add_argument('--mode',
                        help='Specify which build mode to use.',
                        choices=['debug', 'release'],
                        default='release')

    parser.add_argument('--debug',
                        help='Same as using "--mode debug".',
                        action='store_const',
                        dest='mode',
                        const='debug')

    parser.add_argument(
        '--name',
        help='Set the name of the build. Uses "compiled" if not given.',
        type=str,
        default='compiled')

    parsed_args, commands = parser.parse_known_args(args)

    # If no commands are given then use complete  by default.
    if len(commands) == 0:
        commands.append('+@complete')

    logging.info('Compiling the library (%s)...', parsed_args.mode)

    custom_build = Build()

    if not custom_build.parse_build(commands, os.getcwd()):
        return 1

    # Update node modules if needed.
    if not shakaBuildHelpers.update_node_modules():
        return 1

    name = parsed_args.name
    rebuild = parsed_args.force
    is_debug = parsed_args.mode == 'debug'

    if not custom_build.build_library(name, rebuild, is_debug):
        return 1

    if not compile_demo(rebuild, is_debug):
        return 1

    if not compile_receiver(rebuild, is_debug):
        return 1

    return 0
コード例 #12
0
ファイル: build.py プロジェクト: vickyvxr/shaka-player
def main(args):
    name = 'compiled'
    lines = []
    rebuild = False
    is_debug = False
    i = 0
    while i < len(args):
        if args[i] == '--name':
            i += 1
            if i == len(args):
                logging.error('--name requires an argument')
                return 1
            name = args[i]
        elif args[i] == '--debug':
            is_debug = True
        elif args[i] == '--release':
            if is_debug:
                logging.error('Cannot specify both --debug and --release')
                return 1
            # No-op since already the default.
        elif args[i] == '--force':
            rebuild = True
        elif args[i] == '--help':
            usage()
            return 0
        elif args[i].startswith('--'):
            logging.error('Unknown option: %s', args[i])
            usage()
            return 1
        else:
            lines.append(args[i])
        i += 1

    if not lines:
        lines = ['+@complete']

    logging.info('Compiling the library (%s)...',
                 'debug' if is_debug else 'release')
    custom_build = Build()
    if not custom_build.parse_build(lines, os.getcwd()):
        return 1

    # Update node modules if needed.
    if not shakaBuildHelpers.update_node_modules():
        return 1

    if not custom_build.build_library(name, rebuild, is_debug):
        return 1

    if not compile_demo(rebuild, is_debug):
        return 1

    if not compile_receiver(rebuild, is_debug):
        return 1

    return 0
コード例 #13
0
ファイル: test.py プロジェクト: valotvince/shaka-player
    def RunCommand(self, karma_conf):
        """Build a command and send it to Karma for execution.

       Uses |self.parsed_args| and |self.karma_config| to build and run a Karma
       command.
    """
        if self.parsed_args.use_xvfb and not shakaBuildHelpers.is_linux():
            logging.error('xvfb can only be used on Linux')
            return 1

        if not shakaBuildHelpers.update_node_modules():
            logging.error('Failed to update node modules')
            return 1

        karma = shakaBuildHelpers.get_node_binary('karma')
        cmd = ['xvfb-run', '--auto-servernum'
               ] if self.parsed_args.use_xvfb else []
        cmd += karma + ['start']
        cmd += [karma_conf] if karma_conf else []
        cmd += ['--settings', json.dumps(self.karma_config)]

        # There is no need to print a status here as the gendep and build
        # calls will print their own status updates.
        if self.parsed_args.build:
            if gendeps.main([]) != 0:
                logging.error('Failed to generate project dependencies')
                return 1

            if build.main(['--force'] if self.parsed_args.force else []) != 0:
                logging.error('Failed to build project')
                return 1

        # Before Running the command, print the command.
        if self.parsed_args.print_command:
            logging.info('Karma Run Command')
            logging.info('%s', cmd)

        # Run the command.
        results = []
        for run in range(self.parsed_args.runs):
            logging.info('Running test (%d / %d, %d failed so far)...',
                         run + 1, self.parsed_args.runs,
                         len(results) - results.count(0))
            results.append(shakaBuildHelpers.execute_get_code(cmd))

        # Print a summary of the results.
        if self.parsed_args.runs > 1:
            logging.info('All runs completed. %d / %d runs passed.',
                         results.count(0), len(results))
            logging.info('Results (exit code): %r', results)
        else:
            logging.info('Run complete')
            logging.info('Result (exit code): %d', results[0])

        return 0 if all(result == 0 for result in results) else 1
コード例 #14
0
ファイル: test.py プロジェクト: jwplayer/shaka-player
  def RunCommand(self, karma_conf):
    """Build a command and send it to Karma for execution.

       Uses |self.parsed_args| and |self.karma_config| to build and run a Karma
       command.
    """
    if self.parsed_args.use_xvfb and not shakaBuildHelpers.is_linux():
      logging.error('xvfb can only be used on Linux')
      return 1

    if not shakaBuildHelpers.update_node_modules():
      logging.error('Failed to update node modules')
      return 1

    karma = shakaBuildHelpers.get_node_binary('karma')
    cmd = ['xvfb-run', '--auto-servernum'] if self.parsed_args.use_xvfb else []
    cmd += karma + ['start']
    cmd += [karma_conf] if karma_conf else []
    cmd += ['--settings', json.dumps(self.karma_config)]

    # There is no need to print a status here as the gendep and build
    # calls will print their own status updates.
    if self.parsed_args.build:
      if gendeps.gen_deps([]) != 0:
        logging.error('Failed to generate project dependencies')
        return 1

      if build.main(['--force'] if self.parsed_args.force else []) != 0:
        logging.error('Failed to build project')
        return 1

    # Before Running the command, print the command.
    if self.parsed_args.print_command:
      logging.info('Karma Run Command')
      logging.info('%s', cmd)

    # Run the command.
    results = []
    for run in range(self.parsed_args.runs):
      logging.info('Running test (%d / %d)...', run + 1, self.parsed_args.runs)
      results.append(shakaBuildHelpers.execute_get_code(cmd))

    # Print a summary of the results.
    if self.parsed_args.runs > 1:
      logging.info('All runs completed. %d / %d runs passed.',
                   results.count(0),
                   len(results))
      logging.info('Results (exit code): %r', results)
    else:
      logging.info('Run complete')
      logging.info('Result (exit code): %d', results[0])

    return 0 if all(result == 0 for result in results) else 1
コード例 #15
0
ファイル: test.py プロジェクト: baconz/shaka-player
def run_tests(args):
    """Runs all the karma tests."""
    # Update node modules if needed.
    if not shakaBuildHelpers.update_node_modules():
        return 1

    # Generate dependencies and compile library.
    # This is required for the tests.
    if gendeps.gen_deps([]) != 0:
        return 1

    build_args = []
    if "--force" in args:
        build_args.append("--force")
        args.remove("--force")

    if "--no-build" in args:
        args.remove("--no-build")
    else:
        if build.main(build_args) != 0:
            return 1

    karma_command_name = "karma"
    if shakaBuildHelpers.is_windows():
        # Windows karma program has a different name
        karma_command_name = "karma.cmd"

    karma_path = shakaBuildHelpers.get_node_binary_path(karma_command_name)
    cmd = [karma_path, "start"]

    # Get the browsers supported on the local system.
    browsers = _get_browsers()
    if not browsers:
        print >> sys.stderr, 'Unrecognized system "%s"' % platform.uname()[0]
        return 1

    print "Starting tests..."
    if not args:
        # Run tests in all available browsers.
        print "Running with platform default:", "--browsers", browsers
        cmd_line = cmd + ["--browsers", browsers]
        shakaBuildHelpers.print_cmd_line(cmd_line)
        return subprocess.call(cmd_line)
    else:
        # Run with command-line arguments from the user.
        if "--browsers" not in args:
            print "No --browsers specified."
            print "In this mode, browsers must be manually connected to karma."
        cmd_line = cmd + args
        shakaBuildHelpers.print_cmd_line(cmd_line)
        return subprocess.call(cmd_line)
コード例 #16
0
ファイル: test.py プロジェクト: runt18/shaka-player
def run_tests(args):
    """Runs all the karma tests."""
    # Update node modules if needed.
    if not shakaBuildHelpers.update_node_modules():
        return 1

    # Generate dependencies and compile library.
    # This is required for the tests.
    if gendeps.gen_deps([]) != 0:
        return 1

    build_args = []
    if '--force' in args:
        build_args.append('--force')
        args.remove('--force')

    if '--no-build' in args:
        args.remove('--no-build')
    else:
        if build.main(build_args) != 0:
            return 1

    karma_command_name = 'karma'
    if shakaBuildHelpers.is_windows():
        # Windows karma program has a different name
        karma_command_name = 'karma.cmd'

    karma_path = shakaBuildHelpers.get_node_binary_path(karma_command_name)
    cmd = [karma_path, 'start']

    # Get the browsers supported on the local system.
    browsers = _get_browsers()
    if not browsers:
        print >> sys.stderr, 'Unrecognized system "%s"' % platform.uname()[0]
        return 1

    print 'Starting tests...'
    if not args:
        # Run tests in all available browsers.
        print 'Running with platform default:', '--browsers', browsers
        cmd_line = cmd + ['--browsers', browsers]
        shakaBuildHelpers.print_cmd_line(cmd_line)
        return subprocess.call(cmd_line)
    else:
        # Run with command-line arguments from the user.
        if '--browsers' not in args:
            print 'No --browsers specified.'
            print 'In this mode, browsers must be manually connected to karma.'
        cmd_line = cmd + args
        shakaBuildHelpers.print_cmd_line(cmd_line)
        return subprocess.call(cmd_line)
コード例 #17
0
def run_tests_single(args):
    """Runs all the karma tests."""
    # Update node modules if needed.
    if not shakaBuildHelpers.update_node_modules():
        return 1

    # Generate dependencies and compile library.
    # This is required for the tests.
    if gendeps.gen_deps([]) != 0:
        return 1

    build_args = []
    if '--force' in args:
        build_args.append('--force')
        args.remove('--force')

    if '--no-build' in args:
        args.remove('--no-build')
    else:
        if build.main(build_args) != 0:
            return 1

    karma_path = shakaBuildHelpers.get_node_binary_path('karma')
    cmd = [karma_path, 'start']

    if shakaBuildHelpers.is_linux() and '--use-xvfb' in args:
        cmd = ['xvfb-run', '--auto-servernum'] + cmd

    # Get the browsers supported on the local system.
    browsers = _get_browsers()
    if not browsers:
        print >> sys.stderr, 'Unrecognized system "%s"' % platform.uname()[0]
        return 1

    print 'Starting tests...'
    if not args:
        # Run tests in all available browsers.
        print 'Running with platform default:', '--browsers', browsers
        cmd_line = cmd + ['--browsers', browsers]
        return shakaBuildHelpers.execute_get_code(cmd_line)
    else:
        # Run with command-line arguments from the user.
        if '--browsers' not in args:
            print 'No --browsers specified.'
            print 'In this mode, browsers must be manually connected to karma.'
        cmd_line = cmd + args
        return shakaBuildHelpers.execute_get_code(cmd_line)
コード例 #18
0
ファイル: test.py プロジェクト: CCC-EE/shaka-player
def run_tests(args):
  """Runs all the karma tests."""
  # Update node modules if needed.
  if not shakaBuildHelpers.update_node_modules():
    return 1

  # Generate dependencies and compile library.
  # This is required for the tests.
  if gendeps.gen_deps([]) != 0:
    return 1

  build_args = []
  if '--force' in args:
    build_args.append('--force')
    args.remove('--force')

  if '--no-build' in args:
    args.remove('--no-build')
  else:
    if build.main(build_args) != 0:
      return 1

  karma_path = shakaBuildHelpers.get_node_binary_path('karma')
  cmd = [karma_path, 'start']

  # Get the browsers supported on the local system.
  browsers = _get_browsers()
  if not browsers:
    print >> sys.stderr, 'Unrecognized system "%s"' % platform.uname()[0]
    return 1

  print 'Starting tests...'
  if not args:
    # Run tests in all available browsers.
    print 'Running with platform default:', '--browsers', browsers
    cmd_line = cmd + ['--browsers', browsers]
    shakaBuildHelpers.print_cmd_line(cmd_line)
    return subprocess.call(cmd_line)
  else:
    # Run with command-line arguments from the user.
    if '--browsers' not in args:
      print 'No --browsers specified.'
      print 'In this mode, browsers must be manually connected to karma.'
    cmd_line = cmd + args
    shakaBuildHelpers.print_cmd_line(cmd_line)
    return subprocess.call(cmd_line)
コード例 #19
0
ファイル: check.py プロジェクト: indiereign/shaka-player
def check_html_lint():
  """Runs the HTML linter over the HTML files.

  Returns:
    True on success, False on failure.
  """
  # Update node modules if needed.
  if not shakaBuildHelpers.update_node_modules():
    return False

  logging.info('Running htmlhint...')
  htmlhint_path = shakaBuildHelpers.get_node_binary_path('htmlhint')
  base = shakaBuildHelpers.get_source_base()
  files = ['index.html', 'demo/index.html', 'support.html']
  file_paths = [os.path.join(base, x) for x in files]
  config_path = os.path.join(base, '.htmlhintrc')
  cmd_line = [htmlhint_path, '--config=' + config_path] + file_paths
  return shakaBuildHelpers.execute_get_code(cmd_line) == 0
コード例 #20
0
ファイル: check.py プロジェクト: vickyvxr/shaka-player
def check_html_lint():
  """Runs the HTML linter over the HTML files.

  Returns:
    True on success, False on failure.
  """
  # Update node modules if needed.
  if not shakaBuildHelpers.update_node_modules():
    return False

  logging.info('Running htmlhint...')
  htmlhint_path = shakaBuildHelpers.get_node_binary_path('htmlhint')
  base = shakaBuildHelpers.get_source_base()
  files = ['index.html', 'demo/index.html', 'support.html']
  file_paths = [os.path.join(base, x) for x in files]
  config_path = os.path.join(base, '.htmlhintrc')
  cmd_line = [htmlhint_path, '--config=' + config_path] + file_paths
  return shakaBuildHelpers.execute_get_code(cmd_line) == 0
コード例 #21
0
def main(_):
  """Generates the uncompiled dependencies files."""
  # Update node modules if needed.
  if not shakaBuildHelpers.update_node_modules():
    return 1

  logging.info('Generating Closure dependencies...')

  # Make the dist/ folder, ignore errors.
  base = shakaBuildHelpers.get_source_base()
  try:
    os.mkdir(os.path.join(base, 'dist'))
  except OSError:
    pass
  os.chdir(base)

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

  try:
    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)

    # This command doesn't use exit codes for some stupid reason.
    # TODO: Remove when https://github.com/google/closure-library/issues/1162
    # is resolved and we have upgraded.
    if len(deps) == 0:
      return 1

    with open(os.path.join(base, 'dist', 'deps.js'), 'wb') as f:
      f.write(deps)
    return 0
  except subprocess.CalledProcessError as e:
    return e.returncode
コード例 #22
0
ファイル: build.py プロジェクト: indiereign/shaka-player
def main(args):
  name = 'compiled'
  lines = []
  rebuild = False
  is_debug = False
  i = 0
  while i < len(args):
    if args[i] == '--name':
      i += 1
      if i == len(args):
        logging.error('--name requires an argument')
        return 1
      name = args[i]
    elif args[i] == '--debug':
      is_debug = True
    elif args[i] == '--force':
      rebuild = True
    elif args[i] == '--help':
      usage()
      return 0
    elif args[i].startswith('--'):
      logging.error('Unknown option: %s', args[i])
      usage()
      return 1
    else:
      lines.append(args[i])
    i += 1

  if not lines:
    lines = ['+@complete']

  logging.info('Compiling the library...')
  custom_build = Build()
  if not custom_build.parse_build(lines, os.getcwd()):
    return 1

  # Update node modules if needed.
  if not shakaBuildHelpers.update_node_modules():
    return 1

  return 0 if custom_build.build_library(name, rebuild, is_debug) else 1
コード例 #23
0
ファイル: build.py プロジェクト: jhaip/shaka-player
def main(args):
    name = 'compiled'
    lines = []
    rebuild = False
    is_debug = False
    i = 0
    while i < len(args):
        if args[i] == '--name':
            i += 1
            if i == len(args):
                print >> sys.stderr, '--name requires an argument'
                return 1
            name = args[i]
        elif args[i] == '--debug':
            is_debug = True
        elif args[i] == '--force':
            rebuild = True
        elif args[i] == '--help':
            usage()
            return 0
        elif args[i].startswith('--'):
            print >> sys.stderr, 'Unknown option', args[i]
            usage()
            return 1
        else:
            lines.append(args[i])
        i += 1

    if not lines:
        lines = ['+@complete']

    print 'Compiling the library...'
    custom_build = Build()
    if not custom_build.parse_build(lines, os.getcwd()):
        return 1

    # Update node modules if needed.
    if not shakaBuildHelpers.update_node_modules():
        return 1

    return 0 if custom_build.build_library(name, rebuild, is_debug) else 1
コード例 #24
0
ファイル: check.py プロジェクト: joeyparrish/shaka-player
def main(args):
  parser = argparse.ArgumentParser(
      description=__doc__,
      formatter_class=argparse.RawDescriptionHelpFormatter)
  parser.add_argument(
      '--fix',
      help='Automatically fix style violations.',
      action='store_true')
  parser.add_argument(
      '--force',
      '-f',
      help='Force checks even if no files have changed.',
      action='store_true')
  parser.add_argument(
      '--filter',
      metavar='CHECK',
      nargs='+',
      choices=[i[0] for i in _CHECKS],
      help='Run only the given checks (choices: %(choices)s).')

  parsed_args = parser.parse_args(args)

  # Make the dist/ folder, ignore errors.
  base = shakaBuildHelpers.get_source_base()
  try:
    os.mkdir(os.path.join(base, 'dist'))
  except OSError:
    pass

  # Update node modules if needed.
  if not shakaBuildHelpers.update_node_modules():
    return 1

  for name, step in _CHECKS:
    if not parsed_args.filter or name in parsed_args.filter:
      if not step(parsed_args):
        return 1
  return 0
コード例 #25
0
def main(args):
    parser = argparse.ArgumentParser(
        description=__doc__,
        formatter_class=argparse.RawDescriptionHelpFormatter)

    parser.add_argument(
        '--force',
        '-f',
        help='Force building the library even if no files have changed.',
        action='store_true')

    parsed_args = parser.parse_args(args)
    force = parsed_args.force

    # Update node modules if needed.
    if not shakaBuildHelpers.update_node_modules():
        return 1

    for is_debug in [True, False]:
        if not build_all(force, is_debug):
            return 1

    return 0
コード例 #26
0
def main(args):
    parser = argparse.ArgumentParser(
        description=__doc__,
        formatter_class=argparse.RawDescriptionHelpFormatter)
    parser.add_argument('--fix',
                        help='Automatically fix style violations.',
                        action='store_true')
    parser.add_argument('--force',
                        '-f',
                        help='Force checks even if no files have changed.',
                        action='store_true')

    parsed_args = parser.parse_args(args)

    # Make the dist/ folder, ignore errors.
    base = shakaBuildHelpers.get_source_base()
    try:
        os.mkdir(os.path.join(base, 'dist'))
    except OSError:
        pass

    # Update node modules if needed.
    if not shakaBuildHelpers.update_node_modules():
        return 1

    steps = [
        check_js_lint,
        check_html_lint,
        check_css_lint,
        check_complete,
        check_tests,
    ]
    for step in steps:
        if not step(parsed_args):
            return 1
    return 0
コード例 #27
0
ファイル: build.py プロジェクト: Telefonica/stv-shaka-player
def main(args):
    parser = argparse.ArgumentParser(
        description=__doc__,
        formatter_class=argparse.RawDescriptionHelpFormatter)

    parser.add_argument(
        '--locales',
        type=str,
        nargs='+',
        default=generateLocalizations.DEFAULT_LOCALES,
        help=
        'The list of locales to compile in (requires UI, default %(default)r)')

    parser.add_argument(
        '--force',
        '-f',
        help='Force building the library even if no files have changed.',
        action='store_true')

    parser.add_argument('--mode',
                        help='Specify which build mode to use.',
                        choices=['debug', 'release'],
                        default='release')

    parser.add_argument('--debug',
                        help='Same as using "--mode debug".',
                        action='store_const',
                        dest='mode',
                        const='debug')

    parser.add_argument(
        '--name',
        help='Set the name of the build. Uses "ui" if not given.',
        type=str,
        default='ui')

    parsed_args, commands = parser.parse_known_args(args)

    # Make the dist/ folder, ignore errors.
    base = shakaBuildHelpers.get_source_base()
    try:
        os.mkdir(os.path.join(base, 'dist'))
    except OSError:
        pass

    # Update node modules if needed.
    if not shakaBuildHelpers.update_node_modules():
        return 1

    # If no commands are given then use complete  by default.
    if len(commands) == 0:
        commands.append('+@complete')

    logging.info('Compiling the library (%s, %s)...', parsed_args.name,
                 parsed_args.mode)

    custom_build = Build()

    if not custom_build.parse_build(commands, os.getcwd()):
        return 1

    name = parsed_args.name
    locales = parsed_args.locales
    force = parsed_args.force
    is_debug = parsed_args.mode == 'debug'

    if not custom_build.build_library(name, locales, force, is_debug):
        return 1

    return 0
コード例 #28
0
ファイル: build.py プロジェクト: xzhan96/xzhan96.github.io
def main(args):
  parser = argparse.ArgumentParser(
      description=__doc__,
      formatter_class=argparse.RawDescriptionHelpFormatter)

  parser.add_argument(
      '--force',
      '-f',
      help='Force building the library even if no files have changed.',
      action='store_true')

  parser.add_argument(
      '--mode',
      help='Specify which build mode to use.',
      choices=['debug', 'release'],
      default='release')

  parser.add_argument(
      '--debug',
      help='Same as using "--mode debug".',
      action='store_const',
      dest='mode',
      const='debug')

  parser.add_argument(
      '--name',
      help='Set the name of the build. Uses "compiled" if not given.',
      type=str,
      default='compiled')

  parsed_args, commands = parser.parse_known_args(args)

  # If no commands are given then use complete  by default.
  if len(commands) == 0:
    commands.append('+@complete')

  logging.info('Compiling the library (%s)...', parsed_args.mode)

  custom_build = Build()

  if not custom_build.parse_build(commands, os.getcwd()):
    return 1

  # Update node modules if needed.
  if not shakaBuildHelpers.update_node_modules():
    return 1

  name = parsed_args.name
  rebuild = parsed_args.force
  is_debug = parsed_args.mode == 'debug'

  if not custom_build.build_library(name, rebuild, is_debug):
    return 1

  if not compile_demo(rebuild, is_debug):
    return 1

  if not compile_receiver(rebuild, is_debug):
    return 1

  return 0