Skip to content
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

fix dotnet build cleanup #1678

Merged
merged 1 commit into from Nov 3, 2020
Merged

fix dotnet build cleanup #1678

merged 1 commit into from Nov 3, 2020

Conversation

@rkm
Copy link
Contributor

@rkm rkm commented Nov 2, 2020

From testing, I found that the bin and obj directories may be elsewhere depending on the particular hook project layout. I'd also like to cleanup the build directory properly, since we only need the dotnetenv-default dir after we install the tool.

This patch should solve both cases.

@rkm rkm force-pushed the rkm:dotnet-fix-cleanup branch 3 times, most recently from 8e9ae98 to 8bfa650 Nov 2, 2020
if os.path.isfile(path):
os.remove(path)
elif f not in to_keep:
rmtree(path)

This comment has been minimized.

@asottile

asottile Nov 2, 2020
Member

the problem with this is it will break when introducing language_version for dotnet as that allows multiple builds in a single clone

is there a way we can leverage git clean to do this for us?

This comment has been minimized.

@rkm

rkm Nov 2, 2020
Author Contributor

Ah, good point -- I had hoped we could blitz the entire git directory after the tool install.

I'll look for a git cleaner solution

This comment has been minimized.

@asottile

asottile Nov 2, 2020
Member

there's also the potential that a script hook is defined in the same repo as well

@rkm rkm force-pushed the rkm:dotnet-fix-cleanup branch from 8bfa650 to 76c5950 Nov 2, 2020
@rkm rkm requested a review from asottile Nov 2, 2020
prefix,
(
'git', 'clean', '-fxd',
'-e', helpers.environment_dir(ENVIRONMENT_DIR, version),

This comment has been minimized.

@asottile

asottile Nov 2, 2020
Member

this should probably be f'{ENVIRONMENT_DIR}-*'

helpers.run_setup_cmd(
prefix,
(
'git', 'clean', '-fxd',

This comment has been minimized.

@asottile

asottile Nov 2, 2020
Member

I've actually got a video coming up soon that indicates this should be -ffxd :)

@rkm rkm force-pushed the rkm:dotnet-fix-cleanup branch from 76c5950 to 2b12203 Nov 2, 2020
@rkm rkm requested a review from asottile Nov 3, 2020
@asottile asottile force-pushed the rkm:dotnet-fix-cleanup branch from 2b12203 to aa80234 Nov 3, 2020
Copy link
Member

@asottile asottile left a comment

@asottile asottile merged commit 392a1fe into pre-commit:master Nov 3, 2020
2 checks passed
2 checks passed
pre-commit.ci - pr checks completed successfully
Details
pre-commit.pre-commit #20201103.2 succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants