public interface HotCompiler
A HotCompiler is registered to a HotReloader through
HotReloader.addCompiler(compiler, reload, srcDirs).
The source files for the compiler are those under the
srcDirs and matching
When source files are created/updated/deleted, the changes are fed to the
method for recompilation. There is also a
compile(allFiles) method for recompiling all source files.
A HotCompiler usually compiles source files to output files. However it may do something else, e.g. update an external device after a source file is updated.
An implementation of HotCompiler can be stateful, and not thread-safe.
A HotCompiler instance should not be shared, i.e. it should not be used in multiple
The PathMatcher for source files.
Compile all source files.
Compile changed source files.
Only those files under the
will be fed to this PathMatcher;
only those approved by this PathMatcher are source files for this compiler.
An example PathMatcher:
void compile(Consumer<CharSequence> msgOut, Set<Path> allFiles) throws Exception
This method is usually called in the initial phase of the HotReloader. It may also be called whenever the HotReloader thinks necessary.
The compiler does not necessarily do a clean build. For example, it may compare timestamps of source files and output files, skip source files that are older than the output files.
void compile(Consumer<CharSequence> msgOut, Set<Path> createdFiles, Set<Path> updatedFiles, Set<Path> deletedFiles) throws Exception
This method is called if some source files are created/updated/deleted.