Beispiel #1
0
def main_filespecs():
    build_root, goals, args = pop_build_root_and_goals(
        '[build root path] [filespecs]*', sys.argv[1:])

    # Create PathGlobs for each arg relative to the buildroot.
    path_globs = [PathGlobs.create(Files, '', globs=[arg]) for arg in args]
    visualize_build_request(build_root, goals, path_globs)
Beispiel #2
0
def calculate_package_search_path(jvm_package_name, source_roots):
  """Return Paths for directories where the given JVMPackageName might exist."""
  rel_package_dir = jvm_package_name.name.replace('.', os_sep)
  if not rel_package_dir.endswith(os_sep):
    rel_package_dir += os_sep
  specs = [os_path_join(srcroot, rel_package_dir) for srcroot in source_roots.srcroots]
  return PathGlobs.create_from_specs('', specs)
Beispiel #3
0
def main_filespecs():
    build_root, goals, args = pop_build_root_and_goals(
        '[build root path] [filespecs]*', sys.argv[1:])

    # Create a PathGlobs object relative to the buildroot.
    path_globs = PathGlobs.create('', globs=args)
    visualize_build_request(build_root,
                            BuildRequest(goals=goals, subjects=[path_globs]))
Beispiel #4
0
  def path_globs(self):
    """Creates a `PathGlobs` object for the files held by these Sources.

    This field may be projected to request the content of the files for this Sources object.
    """
    return PathGlobs.create(self.spec_path,
                            files=self.files,
                            globs=self.globs,
                            rglobs=self.rglobs,
                            zglobs=self.zglobs)
Beispiel #5
0
def calculate_package_search_path(jvm_package_name, source_roots):
    """Return Paths for directories where the given JVMPackageName might exist."""
    rel_package_dir = jvm_package_name.name.replace('.', os_sep)
    if not rel_package_dir.endswith(os_sep):
        rel_package_dir += os_sep
    specs = [
        os_path_join(srcroot, rel_package_dir)
        for srcroot in source_roots.srcroots
    ]
    return PathGlobs.create_from_specs('', specs)
Beispiel #6
0
    def path_globs(self):
        """Creates a `PathGlobs` object for the files held by these Sources.

    This field may be projected to request the content of the files for this Sources object.
    """
        return PathGlobs.create(self.spec_path,
                                files=self.files,
                                globs=self.globs,
                                rglobs=self.rglobs,
                                zglobs=self.zglobs)
Beispiel #7
0
  def to_fileset_with_spec(self, engine, scheduler, relpath):
    """Return a `FilesetWithSpec` object for these files, computed using the given engine.

    TODO: Simplify the engine API. See: https://github.com/pantsbuild/pants/issues/3070
    """
    filespecs = self.legacy_globs_class.to_filespec(self.patterns)
    pathglobs = PathGlobs.create_from_specs(relpath, filespecs.get('globs', []))
    lfc = LazyFilesContent(engine, scheduler, pathglobs)
    return wrapped_globs.FilesetWithSpec('',
                                         filespecs,
                                         files_calculator=lfc.files,
                                         file_content_calculator=lfc.file_content)
Beispiel #8
0
    def to_fileset_with_spec(self, engine, scheduler, relpath):
        """Return a `FilesetWithSpec` object for these files, computed using the given engine.

    TODO: Simplify the engine API. See: https://github.com/pantsbuild/pants/issues/3070
    """
        filespecs = self.legacy_globs_class.to_filespec(self.patterns)
        pathglobs = PathGlobs.create_from_specs(FSFiles, relpath,
                                                filespecs.get('globs', []))
        lfc = LazyFilesContent(engine, scheduler, pathglobs)
        return wrapped_globs.FilesetWithSpec(
            '',
            filespecs,
            files_calculator=lfc.files,
            file_content_calculator=lfc.file_content)
Beispiel #9
0
 def pg(self, *pathglobs):
     return PathGlobs(pathglobs)
Beispiel #10
0
def calculate_package_search_path(jvm_package_name, source_roots):
  """Return PathGlobs to match directories where the given JVMPackageName might exist."""
  rel_package_dir = jvm_package_name.name.replace('.', os_sep)
  specs = [os_path_join(srcroot, rel_package_dir) for srcroot in source_roots.srcroots]
  return PathGlobs.create_from_specs(Dirs, '', specs)
Beispiel #11
0
 def assert_pg_equals(self, ftype, pathglobs, relative_to, filespecs):
   self.assertEquals(PathGlobs(ftype, tuple(pathglobs)), PathGlobs.create_from_specs(ftype, relative_to, filespecs))
Beispiel #12
0
def descendant_addresses_to_globs(descendant_addresses):
  """Given a DescendantAddresses object, return a PathGlobs object for matching directories."""
  return PathGlobs.create(Dirs, descendant_addresses.directory, globs=['.', '*', '**/*'])
Beispiel #13
0
def main_filespecs():
  build_root, goals, args = pop_build_root_and_goals('[build root path] [filespecs]*', sys.argv[1:])

  # Create a PathGlobs object relative to the buildroot.
  path_globs = PathGlobs.create('', globs=args)
  visualize_build_request(build_root, BuildRequest(goals=goals, subjects=[path_globs]))
Beispiel #14
0
def main_filespecs():
  build_root, goals, args = pop_build_root_and_goals('[build root path] [filespecs]*', sys.argv[1:])

  # Create PathGlobs for each arg relative to the buildroot.
  path_globs = [PathGlobs.create('', globs=[arg]) for arg in args]
  visualize_build_request(build_root, goals, path_globs)
Beispiel #15
0
 def specs(self, relative_to, *filespecs):
   return PathGlobs.create_from_specs(relative_to, filespecs)
Beispiel #16
0
 def specs(self, relative_to, *filespecs):
     return PathGlobs.create_from_specs(relative_to, filespecs)
Beispiel #17
0
def main_filespecs():
    build_root, goals, args = pop_build_root_and_goals("[build root path] [filespecs]*", sys.argv[1:])

    # Create a PathGlobs object relative to the buildroot.
    path_globs = PathGlobs.create("", globs=args)
    visualize_build_request(build_root, goals, [path_globs])
Beispiel #18
0
def descendant_addresses_to_globs(descendant_addresses):
    """Given a DescendantAddresses object, return a PathGlobs object for matching directories."""
    return PathGlobs.create(Dirs,
                            descendant_addresses.directory,
                            globs=['.', '*', '**/*'])