public class SourceCache extends Object
Modifier and Type | Class and Description |
---|---|
static class |
SourceCache.SourceCacheFeature
An automatic feature class which acquires the image loader class path via the afterAnalysis
callback.
|
Modifier and Type | Field and Description |
---|---|
protected static List<Path> |
classPathEntries
A list of all entries in the classpath used by the native image classloader.
|
protected static List<String> |
sourcePathEntries
A list of all entries in the classpath used by the native image classloader.
|
protected List<com.oracle.svm.hosted.image.sources.SourceRoot> |
srcRoots
A list of root directories which may contain source files from which this cache can be
populated.
|
Modifier | Constructor and Description |
---|---|
protected |
SourceCache()
Create the source cache.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addApplicationSourceRoot(Path sourceRoot,
boolean fromClassPath) |
protected File |
cachedFile(Path candidate)
Convert a potential resolved candidate path to the corresponding local File in this cache.
|
protected Path |
cachedPath(Path candidate)
Convert a potential resolved candidate path to the corresponding local Path in this cache.
|
protected Path |
checkCacheFile(Path filePath,
Class<?> clazz)
Check whether the copy of a given source file in the local source cache is up to date with
respect to any original located in this cache's and if not copy the original to the
subdirectory that belongs to this cache.
|
protected static boolean |
checkSourcePath(Path sourcePath)
Indicate whether a source path identifies a file in the associated file system.
|
protected static void |
ensureTargetDirs(Path targetDir)
Ensure the directory hierarchy for a path exists creating any missing directories if needed.
|
protected Path |
extendPath(Path root,
Path filePath)
Extend a root path form one file system using a path potentially derived from another file
system by converting he latter to a text string and replacing the file separator if
necessary.
|
File |
findCandidate(Path filePath)
Given a prototype path for a file to be resolved return a File identifying a cached candidate
for for that Path or null if no cached candidate exists.
|
Path |
resolve(Path filePath,
Class<?> clazz)
Cache the source file identified by the supplied prototype path if a legitimate candidate for
inclusion in this cache can be identified and is not yet included in the cache or
alternatively identify and validate any existing candidate cache entry to ensure it is not
out of date refreshing it if need be.
|
protected Path |
tryCacheFile(Path filePath,
Class<?> clazz)
Attempt to copy a source file from one of this cache's source roots to the local sources
directory storing it in the subdirectory that belongs to this cache.
|
protected boolean |
tryCacheFileFromRoot(Path sourcePath,
Path targetPath) |
protected boolean |
tryCheckCacheFile(Path sourcePath,
Path targetPath) |
protected static final List<Path> classPathEntries
protected static final List<String> sourcePathEntries
protected List<com.oracle.svm.hosted.image.sources.SourceRoot> srcRoots
protected void addApplicationSourceRoot(Path sourceRoot, boolean fromClassPath)
public Path resolve(Path filePath, Class<?> clazz)
filePath
- a prototype path for a file to be included in the cache derived from the name
of some associated class.public File findCandidate(Path filePath)
filePath
- a prototype path for a file to be included in the cache derived from the name
of some associated class.protected Path tryCacheFile(Path filePath, Class<?> clazz)
filePath
- a path appended to each of the cache's source roots in turn until an
acceptable source file is found and copied to the local source directory.protected Path checkCacheFile(Path filePath, Class<?> clazz)
filePath
- a path appended to each of the cache's source roots in turn until an matching
original source is found for comparison against the local source directory.protected boolean tryCheckCacheFile(Path sourcePath, Path targetPath) throws IOException
IOException
protected Path extendPath(Path root, Path filePath)
root
- the path to be extendedfilePath
- the subpath to extend it withprotected Path cachedPath(Path candidate)
candidate
- a resolved candidate path for some given resolution requestprotected File cachedFile(Path candidate)
candidate
- a resolved candidate path for some given resolution requestprotected static boolean checkSourcePath(Path sourcePath)
sourcePath
- the path to checkprotected static void ensureTargetDirs(Path targetDir)
targetDir
- a path to the desired directory