1616import io .quarkus .paths .PathCollection ;
1717import io .quarkus .paths .PathList ;
1818
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+ */
1928public final class ArchiveRootBuildItem extends SimpleBuildItem {
2029
30+ /**
31+ * Builder for constructing {@link ArchiveRootBuildItem} instances.
32+ */
2133 public static class Builder {
2234
2335 private List <Path > archiveRoots = new ArrayList <>();
@@ -26,33 +38,70 @@ public static class Builder {
2638 private Builder () {
2739 }
2840
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+ */
2947 public Builder addArchiveRoot (Path root ) {
3048 this .archiveRoots .add (root );
3149 return this ;
3250 }
3351
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+ */
3458 public Builder addArchiveRoots (PathCollection paths ) {
3559 paths .forEach (archiveRoots ::add );
3660 return this ;
3761 }
3862
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+ */
3969 public Builder setExcludedFromIndexing (Collection <Path > excludedFromIndexing ) {
4070 this .excludedFromIndexing = excludedFromIndexing ;
4171 return this ;
4272 }
4373
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+ */
4481 @ Deprecated
4582 public Builder setArchiveLocation (Path archiveLocation ) {
4683 this .archiveRoots .clear ();
4784 this .archiveRoots .add (archiveLocation );
4885 return this ;
4986 }
5087
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+ */
5195 public ArchiveRootBuildItem build (QuarkusBuildCloseablesBuildItem buildCloseables ) throws IOException {
5296 return new ArchiveRootBuildItem (this , buildCloseables );
5397 }
5498 }
5599
100+ /**
101+ * Creates a new {@link Builder} instance for building an {@link ArchiveRootBuildItem}.
102+ *
103+ * @return a new {@link Builder} instance
104+ */
56105 public static Builder builder () {
57106 return new Builder ();
58107 }
@@ -62,10 +111,22 @@ public static Builder builder() {
62111 private final PathCollection rootDirs ;
63112 private final PathCollection paths ;
64113
114+ /**
115+ * Constructs an {@link ArchiveRootBuildItem} with a single application classes directory.
116+ *
117+ * @param appClassesDir the path to the application classes directory
118+ */
65119 public ArchiveRootBuildItem (Path appClassesDir ) {
66120 this (appClassesDir , appClassesDir );
67121 }
68122
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+ */
69130 @ Deprecated
70131 public ArchiveRootBuildItem (Path archiveLocation , Path archiveRoot ) {
71132 this (archiveLocation , archiveRoot , Collections .emptySet ());
0 commit comments