Esempio n. 1
0
def Flatten(deps):
    """
  Recursively follows a list of dep files and returns source files in
  dependency order. Ignores externs.
  """
    sources, externs = CrawlDepsTree(deps)
    return sources
Esempio n. 2
0
def main():
  parser = ArgumentParser()
  parser.add_argument(
      '-s', '--src_path', help='Path to //src/ directory', required=True)
  parser.add_argument(
      '-i',
      '--input',
      help='Input dependency file generated by js_library.py',
      required=True)
  parser.add_argument(
      '-o',
      '--output',
      help='Generated html output with flattened dependencies',
      required=True)
  parser.add_argument(
      '-m',
      '--mocks',
      nargs='*',
      default=[],
      help='List of additional js files to load before others')
  parser.add_argument('-t', '--target_name', help='Test target name')
  parser.add_argument(
      '--html_import',
      action='store_true',
      help='Enable HTMLImports, used for Polymer elements')
  args = parser.parse_args()

  # Append closure path to sys.path to be able to import js_unit_test.
  sys.path.append(os.path.join(args.src_path, 'third_party/closure_compiler'))
  from js_binary import CrawlDepsTree

  deps, _ = CrawlDepsTree([args.input])

  return _process(deps, args.output, args.mocks, args.html_import,
                  args.target_name)
Esempio n. 3
0
def main():
    parser = ArgumentParser()
    parser.add_argument('-s',
                        '--src_path',
                        help='Path to //src/ directory',
                        required=True)
    parser.add_argument(
        '-i',
        '--input',
        help='Input dependency file generated by js_library.py',
        required=True)
    parser.add_argument(
        '-o',
        '--output',
        help='Generated html output with flattened dependencies',
        required=True)
    parser.add_argument(
        '-m',
        '--mocks',
        nargs='*',
        default=[],
        help='List of additional js files to load before others')
    parser.add_argument('-t', '--target_name', help='Test target name')
    parser.add_argument('--html_import',
                        action='store_true',
                        help='Enable HTMLImports, used for Polymer elements')
    parser.add_argument('--js_module',
                        action='store_true',
                        help='Enable JS Modules for the unittest file.')
    args = parser.parse_args()

    if args.js_module:
        # Convert from:
        # gen/ui/file_manager/file_manager/common/js/example_unittest.m.js_library
        # To:
        # ui/file_manager/file_manager/common/js/example_unittest.m.js
        path_test_file = args.input.replace('gen/', '', 1)
        path_test_file = path_test_file.replace('.js_library', '.js')
        _process_js_module(path_test_file, args.output, args.mocks,
                           args.target_name)
        return

    # Append closure path to sys.path to be able to import js_unit_test.
    sys.path.append(os.path.join(args.src_path,
                                 'third_party/closure_compiler'))
    from js_binary import CrawlDepsTree

    deps, _ = CrawlDepsTree([args.input])

    return _process(deps, args.output, args.mocks, args.html_import,
                    args.target_name)