Skip to content

[build] Ignore .git in ninja copy #60017

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def build(self):
# Ninja can only be built in-tree. Copy the source tree to the build
# directory.
shell.rmtree(self.build_dir)
shell.copytree(self.source_dir, self.build_dir)
shell.copytree(self.source_dir, self.build_dir, ignore_pattern=".git")
with shell.pushd(self.build_dir):
shell.call([sys.executable, 'configure.py', '--bootstrap'],
env=env)
5 changes: 3 additions & 2 deletions utils/swift_build_support/swift_build_support/shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,13 +183,14 @@ def rmtree(path, dry_run=None, echo=True):
shutil.rmtree(path)


def copytree(src, dest, dry_run=None, echo=True):
def copytree(src, dest, dry_run=None, ignore_pattern=None, echo=True):
dry_run = _coerce_dry_run(dry_run)
if dry_run or echo:
_echo_command(dry_run, ['cp', '-r', src, dest])
if dry_run:
return
shutil.copytree(src, dest)
ignore = shutil.ignore_patterns(ignore_pattern) if ignore_pattern else None
shutil.copytree(src, dest, ignore=ignore)


def symlink(source, dest, dry_run=None, echo=True):
Expand Down