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: README.md
+53Lines changed: 53 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,6 +32,59 @@ The project was relocated from <https://github.com/sonatype/sisu-build-api>. Als
32
32
33
33
## Provided APIs
34
34
35
+
### Resources API
36
+
37
+
The Resources API provides a modern, Path-based interface for managing build resources. It separates resource management concerns from logging/messaging functionality and provides better control over file operations during the build process.
38
+
39
+
**Key Features:**
40
+
- Modern `java.nio.file.Path` instead of `java.io.File`
41
+
- Change detection with `hasDelta()` (best effort hint)
42
+
- Reliable input/output freshness checking with `isUptodate()`
43
+
- Optimized output streams that only update files when content changes
44
+
- Support for marking generated/derived files for IDE integration
45
+
- Convenient copy operation that respects up-to-date checks
try (OutputStream out = resources.newOutputStream(generated, true)) {
75
+
// Write content - file marked as derived for IDE warnings
76
+
out.write(content);
77
+
}
78
+
79
+
// Mark a file as generated/derived
80
+
resources.markDerived(generated);
81
+
}
82
+
```
83
+
84
+
**When to use `hasDelta()` vs `isUptodate()`:**
85
+
- Use `hasDelta()` as a hint for user-editable source files where you want to detect changes
86
+
- Use `isUptodate()` when there's a clear input/output relationship, as it handles cases where target files may be deleted or modified outside the build process
87
+
35
88
### Messages API
36
89
37
90
The Messages API provides a modern, flexible way to create and manage build messages/markers that inform users in an IDE about issues in their files. It uses a builder pattern for constructing messages in a more convenient and extensible way compared to the legacy BuildContext message methods.
0 commit comments