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

Ask before clearing out out-dir #83

Closed
wants to merge 2 commits into from
Closed

Ask before clearing out out-dir #83

wants to merge 2 commits into from

Conversation

llimllib
Copy link
Contributor

Copy link
Contributor

@paulsmith paulsmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that I'm seeing it in action locally I realize I didn't fully understand the behavior discussed in #74. My feeling was that pushup build would behave like zig build or cargo build, which AFAIK don't prompt each time, because it's assumed the build dir is under full control of the build tool.

Can you explain more about the use-case of needed to check first before clearing the build dir? In normal usage users shouldn't be putting files in there unless via the Pushup tool.

@llimllib
Copy link
Contributor Author

Neither of those tools delete everything in the build dir, which is a very dangerous operation.

My worry is the first user who says "oh output-dir? I want my output in /usr/bin".

If you run zig build file.zig --cache-dir /usr/bin, what you'll get is a few new directories in /usr/bin that you probably don't want.

On the other hand, if you run pushup -out-dir /usr/bin <etc etc>, you'll silently erase your entire /usr/bin directory

Here's what a zig cache folder looks like after building two different binaries:

$ tree zig-cache/
zig-cache/
├── h
├── o
│   ├── 44d1925c83e24fb5b66ebebff916ac77
│   │   └── builtin.zig
│   └── 776651cd8468fc28abb2062cf0f1827e
│       └── builtin.zig
└── z
    ├── 1a8ca814016384106f75c92ca78ed220
    └── d35b7c44b39ce30aa92d0a5fd4c85e00

It creates two directories with a guid for each different binary that you build, and never deletes anything

@llimllib
Copy link
Contributor Author

(updating the tool to not warn the user but to be safely non-destructive would be a fine alternative)

@paulsmith
Copy link
Contributor

I wonder if the best thing to do in the short term is just emulate the zig cache behavior and not try to delete anything. Tests are a different story.

@llimllib
Copy link
Contributor Author

Cool, I'll close this PR and we can aim for a nondestructive strategy - will update the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants