File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33import static ch .vorburger .test .Assert .assertTrue ;
44
5- import java . nio . file . Path ;
5+ import dev . enola . be . io . FileSet ;
66
77public class Bootstrap {
88
@@ -12,9 +12,7 @@ public static void main(String[] args) throws Exception {
1212
1313 var input =
1414 new JavaCompiler .Input .Builder ()
15- // TODO FileSet Glob
16- .source (Path .of ("src/ch/vorburger/jvmtools/JavaCompiler.java" ))
17- .source (Path .of ("src/ch/vorburger/jvmtools/JavaCompilerTest.java" ))
15+ .sources (new FileSet .Builder ().addRoot ("src" ).includeGlob ("**/*.java" ))
1816 .outputDirectory (".build/bootstrap-classes" )
1917 .build ();
2018 assertTrue (new JavaCompiler ().invoke (input ));
Original file line number Diff line number Diff line change 33import ch .vorburger .main .StdIO ;
44import ch .vorburger .stereotype .Service ;
55
6+ import dev .enola .be .io .FileSet ;
7+
68import java .io .PrintStream ;
79import java .nio .file .Path ;
810import java .util .ArrayList ;
@@ -33,7 +35,12 @@ public Builder stdIO(StdIO stdIO) {
3335 return this ;
3436 }
3537
36- public Builder source (Stream <Path > paths ) {
38+ public Builder sources (FileSet .Builder fileSetBuilder ) {
39+ sources (fileSetBuilder .build ().stream ());
40+ return this ;
41+ }
42+
43+ public Builder sources (Stream <Path > paths ) {
3744 // TODO Optimization: Keep Stream, and start compiling right away from it...
3845 paths .forEach (this .sourcepath ::addPath );
3946 return this ;
Original file line number Diff line number Diff line change @@ -49,6 +49,11 @@ public Builder addRoot(Path root) {
4949 return this ;
5050 }
5151
52+ public Builder addRoot (String root ) {
53+ this .roots .add (Path .of (root ));
54+ return this ;
55+ }
56+
5257 public Builder includeGlob (String pattern ) {
5358 this .includes .add (FileSystems .getDefault ().getPathMatcher ("glob:" + pattern ));
5459 return this ;
You can’t perform that action at this time.
0 commit comments