16
16
import io .quarkus .paths .PathCollection ;
17
17
import io .quarkus .paths .PathList ;
18
18
19
+ /**
20
+ * Represents a build item for an archive root, typically used in Quarkus build steps to
21
+ * reference application classes directories or archives (like JARs) for indexing and processing.
22
+ *
23
+ * <p>
24
+ * This class contains the paths of directories or archives to be used as archive roots,
25
+ * as well as paths that should be excluded from indexing.
26
+ * </p>
27
+ */
19
28
public final class ArchiveRootBuildItem extends SimpleBuildItem {
20
29
30
+ /**
31
+ * Builder for constructing {@link ArchiveRootBuildItem} instances.
32
+ */
21
33
public static class Builder {
22
34
23
35
private List <Path > archiveRoots = new ArrayList <>();
@@ -26,33 +38,70 @@ public static class Builder {
26
38
private Builder () {
27
39
}
28
40
41
+ /**
42
+ * Adds a single archive root path to the builder.
43
+ *
44
+ * @param root the archive root path to add
45
+ * @return this builder instance
46
+ */
29
47
public Builder addArchiveRoot (Path root ) {
30
48
this .archiveRoots .add (root );
31
49
return this ;
32
50
}
33
51
52
+ /**
53
+ * Adds multiple archive root paths to the builder.
54
+ *
55
+ * @param paths a {@link PathCollection} of archive root paths to add
56
+ * @return this builder instance
57
+ */
34
58
public Builder addArchiveRoots (PathCollection paths ) {
35
59
paths .forEach (archiveRoots ::add );
36
60
return this ;
37
61
}
38
62
63
+ /**
64
+ * Sets the collection of paths to exclude from indexing.
65
+ *
66
+ * @param excludedFromIndexing a collection of paths to be excluded
67
+ * @return this builder instance
68
+ */
39
69
public Builder setExcludedFromIndexing (Collection <Path > excludedFromIndexing ) {
40
70
this .excludedFromIndexing = excludedFromIndexing ;
41
71
return this ;
42
72
}
43
73
74
+ /**
75
+ * @deprecated Use {@link #addArchiveRoot(Path)} instead to add archive roots.
76
+ * This method clears previous archive roots before setting the new one.
77
+ *
78
+ * @param archiveLocation the archive location to set
79
+ * @return this builder instance
80
+ */
44
81
@ Deprecated
45
82
public Builder setArchiveLocation (Path archiveLocation ) {
46
83
this .archiveRoots .clear ();
47
84
this .archiveRoots .add (archiveLocation );
48
85
return this ;
49
86
}
50
87
88
+ /**
89
+ * Builds the {@link ArchiveRootBuildItem} using the configured properties.
90
+ *
91
+ * @param buildCloseables a {@link QuarkusBuildCloseablesBuildItem} to manage opened resources (e.g., zip file systems)
92
+ * @return a new {@link ArchiveRootBuildItem} instance
93
+ * @throws IOException if an I/O error occurs when accessing the archive roots
94
+ */
51
95
public ArchiveRootBuildItem build (QuarkusBuildCloseablesBuildItem buildCloseables ) throws IOException {
52
96
return new ArchiveRootBuildItem (this , buildCloseables );
53
97
}
54
98
}
55
99
100
+ /**
101
+ * Creates a new {@link Builder} instance for building an {@link ArchiveRootBuildItem}.
102
+ *
103
+ * @return a new {@link Builder} instance
104
+ */
56
105
public static Builder builder () {
57
106
return new Builder ();
58
107
}
@@ -62,10 +111,22 @@ public static Builder builder() {
62
111
private final PathCollection rootDirs ;
63
112
private final PathCollection paths ;
64
113
114
+ /**
115
+ * Constructs an {@link ArchiveRootBuildItem} with a single application classes directory.
116
+ *
117
+ * @param appClassesDir the path to the application classes directory
118
+ */
65
119
public ArchiveRootBuildItem (Path appClassesDir ) {
66
120
this (appClassesDir , appClassesDir );
67
121
}
68
122
123
+ /**
124
+ * @deprecated Use {@link Builder} instead.
125
+ * Constructs an {@link ArchiveRootBuildItem} with a given archive location and root directory.
126
+ *
127
+ * @param archiveLocation the archive location (e.g., JAR file path)
128
+ * @param archiveRoot the root directory of the archive
129
+ */
69
130
@ Deprecated
70
131
public ArchiveRootBuildItem (Path archiveLocation , Path archiveRoot ) {
71
132
this (archiveLocation , archiveRoot , Collections .emptySet ());
0 commit comments