Exemplo n.º 1
0
def _set_up_generate_ninja():
  # Create generated_ninja directory if necessary.
  ninja_dir = build_common.get_generated_ninja_dir()
  if not os.path.exists(ninja_dir):
    os.makedirs(ninja_dir)

  # Set up default resource path.
  framework_resources_base_path = (
      build_common.get_build_path_for_apk('framework-res', subpath='R'))
  ninja_generator.JavaNinjaGenerator.add_default_resource_include(
      os.path.join(framework_resources_base_path, 'framework-res.apk'))

  # Set up global filter for makefile to ninja translator.
  make_to_ninja.MakefileNinjaTranslator.add_global_filter(
      _filter_all_make_to_ninja)

  dependency_inspection.start_inspection()
  dependency_inspection.add_files(*_get_build_system_dependencies())
  make_to_ninja.prepare_make_to_ninja()
  depended_files = dependency_inspection.get_files()
  depended_listings = dependency_inspection.get_listings()
  dependency_inspection.stop_inspection()

  cache_to_save = []
  needs_clobbering = True
  if OPTIONS.enable_config_cache():
    needs_clobbering = False
    cache_path = _get_global_deps_file_path()
    global_deps = _load_global_deps_from_file(cache_path)
    if global_deps is None:
      needs_clobbering = True
      global_deps = CacheDependency()
    else:
      if not global_deps.check_freshness():
        needs_clobbering = True
    global_deps.refresh(depended_files, depended_listings)

    cache_to_save.append((global_deps, cache_path))

  _config_loader.load()

  return needs_clobbering, cache_to_save
Exemplo n.º 2
0
def find_deps(source_path, python_path=None):
  """Returns the list of dependencies for a python script.

  Args:
      source_path: The path to the Python module/script to examine.
      python_path: A list of paths to use as the Python search path to find
          imported modules.

  Returns:
    The list of returned dependencies, filtered to the files located under the
    project source code tree.

    Note that the input source_path is returned as one of the output
    dependencies.

  If this function is called while a config.py is running, it records the output
  dependencies as dependencies of the config.py.
  """
  python_path = build_common.as_list(python_path) + sys.path
  finder = modulefinder.ModuleFinder(python_path)
  finder.run_script(source_path)

  # Examine the paths of all the modules that were loaded. Some of the paths we
  # get back are relative. Some absolute. Convert everything to absolute.
  dependencies = [os.path.abspath(module.__file__)
                  for module in finder.modules.itervalues()
                  if module.__file__]

  # Filter down the dependencies to those that are contained under the project,
  # and convert paths into project relative paths.
  # We assume that changes to the Python standard library for example are
  # irrelevant.
  result = [build_common.get_project_relpath(path)
            for path in dependencies
            if build_common.is_abs_path_in_project(path)]

  dependency_inspection.add_files(source_path, *result)

  return sorted(result)
Exemplo n.º 3
0
def get_build_version(commit="HEAD"):
    if commit == "HEAD":
        dependency_inspection.add_files(get_build_version_path())
    return get_build_tag(commit).replace("arc-runtime-", "")
Exemplo n.º 4
0
def get_build_version(commit='HEAD'):
    if commit == 'HEAD':
        dependency_inspection.add_files(get_build_version_path())
    return get_build_tag(commit).replace('arc-runtime-', '')