You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pages/how-to/selective-cleaning.md
+92-20Lines changed: 92 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,46 +1,99 @@
1
-
# Selective cleaning with fpm
1
+
# Cleaning build artifacts with fpm
2
+
3
+
The `fpm clean` command allows you to remove build artifacts to free up disk space or ensure a fresh build. This guide covers both general cleaning and selective cleaning options.
4
+
5
+
## Overview
6
+
7
+
By default, `fpm clean` prompts for confirmation before deleting directories in the `build/` folder while preserving dependencies. The command supports several modes of operation:
8
+
9
+
-**Interactive cleaning** (default): Prompts for confirmation
10
+
-**Automatic cleaning**: Skip prompts with `--skip` or `--all`
11
+
-**Selective cleaning***(fpm v0.14.0+)*: Target specific executable types
12
+
-**Registry cache cleaning**: Remove cached registry data
13
+
14
+
## General cleaning options
15
+
16
+
### Default behavior
17
+
18
+
```bash
19
+
fpm clean
20
+
```
21
+
22
+
Prompts for confirmation before deleting build artifacts, excluding dependencies. This is the safest option for regular use.
23
+
24
+
### Skip confirmation, preserve dependencies
25
+
26
+
```bash
27
+
fpm clean --skip
28
+
```
29
+
30
+
Deletes build directories without prompting but preserves dependency builds. Useful in automated scripts where you want to clean your project but keep external dependencies intact.
31
+
32
+
### Clean everything including dependencies
33
+
34
+
```bash
35
+
fpm clean --all
36
+
```
37
+
38
+
Deletes all build directories without prompting, including dependencies. Use this when you need a completely fresh build environment or when dependency issues require rebuilding everything from scratch.
39
+
40
+
### Clean registry cache
41
+
42
+
```bash
43
+
fpm clean --registry-cache
44
+
```
45
+
46
+
Removes cached registry data. Useful when registry metadata becomes stale or when troubleshooting package resolution issues.
47
+
48
+
### Custom configuration file
49
+
50
+
```bash
51
+
fpm clean --config-file /path/to/config.toml
52
+
```
53
+
54
+
Use a custom global configuration file location for the clean operation.
55
+
56
+
## Selective cleaning options
2
57
3
58
:::{note}
4
59
Available since fpm v0.14.0
5
60
:::
6
61
7
-
The `fpm clean` command allows you to remove build artifacts to free up disk space or ensure a fresh build. By default, `fpm clean` removes all build artifacts, but you can use selective cleaning to remove only specific types of executables, which speeds up recompilation by preserving other build outputs.
8
-
9
-
## Command overview
62
+
Selective cleaning allows you to remove only specific types of executables, which speeds up recompilation by preserving other build outputs.
10
63
11
-
The selective cleaning feature provides three flags to target specific executable types:
64
+
### Available selective cleaning flags
12
65
13
66
-`--test`: Clean only test executables
14
67
-`--apps`: Clean only application executables
15
68
-`--examples`: Clean only example executables
16
69
17
-
##Basic usage
70
+
### Selective cleaning examples
18
71
19
-
### Clean test executables only
72
+
####Clean test executables only
20
73
21
74
```bash
22
75
fpm clean --test
23
76
```
24
77
25
78
This removes only the compiled test executables while preserving application executables, example executables, and all object files. Useful when you've modified test code and want to ensure tests are rebuilt from scratch.
26
79
27
-
### Clean application executables only
80
+
####Clean application executables only
28
81
29
82
```bash
30
83
fpm clean --apps
31
84
```
32
85
33
86
This removes only the compiled application executables while preserving test executables, example executables, and object files. Useful when you've made changes that affect only your main applications.
34
87
35
-
### Clean example executables only
88
+
####Clean example executables only
36
89
37
90
```bash
38
91
fpm clean --examples
39
92
```
40
93
41
94
This removes only the compiled example executables while preserving application and test executables, and object files. Useful when working on documentation examples.
42
95
43
-
## Combining flags
96
+
###Combining selective flags
44
97
45
98
You can combine multiple flags to clean several types of executables simultaneously:
46
99
@@ -52,9 +105,11 @@ fpm clean --test --apps
52
105
fpm clean --test --apps --examples
53
106
```
54
107
55
-
## Practical use cases
108
+
## Use cases and workflows
109
+
110
+
### Common scenarios
56
111
57
-
### Debugging failing tests
112
+
####Debugging failing tests
58
113
59
114
When tests are failing and you suspect cached executables might be the issue:
60
115
@@ -65,7 +120,7 @@ fpm test
65
120
66
121
This ensures test executables are rebuilt from scratch while preserving your application builds.
67
122
68
-
### Preparing for release
123
+
####Preparing for release
69
124
70
125
Before building release versions of your applications:
71
126
@@ -98,14 +153,31 @@ fpm clean --apps # If working on applications
98
153
fpm clean --examples # If working on examples
99
154
```
100
155
101
-
## Comparison with full cleaning
156
+
## Command reference
157
+
158
+
### Complete option summary
159
+
160
+
| Command | What gets removed | Dependencies | Prompts | Use when |
0 commit comments