Exemplo n.º 1
0
 def _get_project_tree(self, build_file_rev, pants_ignore):
     """Creates the project tree for build files for use in a given pants run."""
     if build_file_rev:
         return ScmProjectTree(self._root_dir, get_scm(), build_file_rev,
                               pants_ignore)
     else:
         return FileSystemProjectTree(self._root_dir, pants_ignore)
Exemplo n.º 2
0
def get_project_tree(options):
  """Creates the project tree for build files for use in a given pants run."""
  pants_ignore = options.pants_ignore or []
  if options.build_file_rev:
    return ScmProjectTree(get_buildroot(), get_scm(), options.build_file_rev, pants_ignore)
  else:
    return FileSystemProjectTree(get_buildroot(), pants_ignore)
Exemplo n.º 3
0
    def test_build_file_rev(self):
        # Test that the build_file_rev global option works.  Because the
        # test framework does not yet support bootstrap options, this test
        # in fact just directly calls ScmBuildFile.set_rev.

        with pushd(self.root_dir):
            subprocess.check_call(['git', 'init'])
            subprocess.check_call(
                ['git', 'config', 'user.email', '*****@*****.**'])
            subprocess.check_call(['git', 'config', 'user.name', 'Your Name'])
            subprocess.check_call(['git', 'add', '.'])
            subprocess.check_call(['git', 'commit', '-m' 'initial commit'])

            subprocess.check_call([
                'rm', '-rf', 'path-that-does-exist', 'grandparent', 'BUILD',
                'BUILD.twitter'
            ])

            self._project_tree = ScmProjectTree(self.root_dir,
                                                Git(worktree=self.root_dir),
                                                'HEAD')

            my_buildfile = self.create_buildfile('grandparent/parent/BUILD')
            buildfile = self.create_buildfile(
                'grandparent/parent/BUILD.twitter')

            self.assertEquals(
                OrderedSet([my_buildfile, buildfile]),
                OrderedSet(self.get_build_files_family('grandparent/parent')))

            self.assertEquals(
                OrderedSet([
                    self.create_buildfile(
                        'grandparent/parent/child2/child3/BUILD')
                ]),
                OrderedSet(
                    self.get_build_files_family(
                        'grandparent/parent/child2/child3')))

            buildfiles = self.scan_buildfiles('grandparent')

            self.assertEquals(
                OrderedSet([
                    self.create_buildfile('grandparent/parent/BUILD'),
                    self.create_buildfile('grandparent/parent/BUILD.twitter'),
                    self.create_buildfile('grandparent/parent/child1/BUILD'),
                    self.create_buildfile(
                        'grandparent/parent/child1/BUILD.twitter'),
                    self.create_buildfile(
                        'grandparent/parent/child2/child3/BUILD'),
                    self.create_buildfile('grandparent/parent/child5/BUILD'),
                ]), buildfiles)
Exemplo n.º 4
0
 def mk_project_tree(self, build_root_src):
     # Use mk_fs_tree only to feed the files for the git repo, not using its FileSystemProjectTree.
     worktree = self.mk_fs_tree(build_root_src).build_root
     with initialize_repo(worktree) as git_repo:
         yield ScmProjectTree(worktree, git_repo, 'HEAD')
 def mk_project_tree(self, build_root, ignore_patterns=None):
     return ScmProjectTree(build_root, Git(worktree=build_root), 'HEAD',
                           ignore_patterns)
Exemplo n.º 6
0
 def mk_project_tree(self, build_root_src):
     return ScmProjectTree(build_root_src, Git(worktree=build_root_src),
                           'HEAD')
Exemplo n.º 7
0
 def _get_project_tree(cls, root_dir):
     return ScmProjectTree(root_dir, cls._scm, cls._rev)