public abstract class AbstractSourcePathResolver extends Object implements SourcePathResolver
Most of the SourcePathResolverAdapter interface can be implemented in terms of just a few functions ( the main requirement is resolving BuildTargetSourcePaths).
Existing code may expect to resolve each SourcePath to only one Path. In such
cases, SourcePathResolverAdapter is used to convert the resolver to return only one
Path per SourcePath.
| Constructor and Description |
|---|
AbstractSourcePathResolver() |
| Modifier and Type | Method and Description |
|---|---|
com.google.common.collect.ImmutableMap<Path,Path> |
createRelativeMap(Path basePath,
Iterable<SourcePath> sourcePaths)
Creates a map where given source paths are resolved relatively to the given base path and
stored (as keys) with their absolute paths (as values).
|
com.google.common.collect.ImmutableCollection<Path> |
filterInputsToCompareToOutput(Iterable<? extends SourcePath> sources)
|
com.google.common.collect.ImmutableSortedSet<Path> |
getAbsolutePath(SourcePath sourcePath) |
com.google.common.collect.ImmutableSortedSet<Path> |
getAllAbsolutePaths(Collection<? extends SourcePath> sourcePaths) |
protected abstract ProjectFilesystem |
getBuildTargetSourcePathFilesystem(BuildTargetSourcePath sourcePath) |
ProjectFilesystem |
getFilesystem(SourcePath sourcePath) |
com.google.common.collect.ImmutableSortedSet<Path> |
getIdeallyRelativePath(SourcePath sourcePath) |
<T> com.google.common.collect.ImmutableMap<T,com.google.common.collect.ImmutableSortedSet<Path>> |
getMappedPaths(Map<T,SourcePath> sourcePathMap) |
com.google.common.collect.ImmutableSortedSet<Path> |
getRelativePath(ProjectFilesystem projectFilesystem,
SourcePath sourcePath) |
com.google.common.collect.ImmutableSortedSet<Path> |
getRelativePath(SourcePath sourcePath) |
abstract String |
getSourcePathName(BuildTarget target,
SourcePath sourcePath) |
com.google.common.collect.ImmutableMap<String,SourcePath> |
getSourcePathNames(BuildTarget target,
String parameter,
Iterable<SourcePath> sourcePaths)
Resolved the logical names for a group of SourcePath objects into a map, throwing an error on
duplicates.
|
<T> com.google.common.collect.ImmutableMap<String,T> |
getSourcePathNames(BuildTarget target,
String parameter,
Iterable<T> objects,
java.util.function.Predicate<T> filter,
java.util.function.Function<T,SourcePath> objectSourcePathFunction)
Resolves the logical names for a group of objects that have a SourcePath into a map, throwing
an error on duplicates.
|
protected abstract com.google.common.collect.ImmutableSortedSet<SourcePath> |
resolveDefaultBuildTargetSourcePath(DefaultBuildTargetSourcePath targetSourcePath) |
protected abstract com.google.common.collect.ImmutableSortedSet<SourcePath> resolveDefaultBuildTargetSourcePath(DefaultBuildTargetSourcePath targetSourcePath)
public abstract String getSourcePathName(BuildTarget target, SourcePath sourcePath)
getSourcePathName in interface SourcePathResolverprotected abstract ProjectFilesystem getBuildTargetSourcePathFilesystem(BuildTargetSourcePath sourcePath)
public <T> com.google.common.collect.ImmutableMap<T,com.google.common.collect.ImmutableSortedSet<Path>> getMappedPaths(Map<T,SourcePath> sourcePathMap)
getMappedPaths in interface SourcePathResolverpublic ProjectFilesystem getFilesystem(SourcePath sourcePath)
getFilesystem in interface SourcePathResolverProjectFilesystem associated with sourcePath.public com.google.common.collect.ImmutableSortedSet<Path> getAbsolutePath(SourcePath sourcePath)
getAbsolutePath in interface SourcePathResolverPath instances for this sourcePath, resolved using its associated
ProjectFilesystem.public com.google.common.collect.ImmutableSortedSet<Path> getAllAbsolutePaths(Collection<? extends SourcePath> sourcePaths)
getAllAbsolutePaths in interface SourcePathResolverpublic com.google.common.collect.ImmutableSortedSet<Path> getRelativePath(SourcePath sourcePath)
getRelativePath in interface SourcePathResolverPath instances the sourcePath refers to, relative to its owning
ProjectFilesystem.public com.google.common.collect.ImmutableSortedSet<Path> getIdeallyRelativePath(SourcePath sourcePath)
getIdeallyRelativePath in interface SourcePathResolverPath instances the sourcePath refers to, ideally relative to its
owning ProjectFilesystem. Absolute path may get returned however!
We should make sure that getPathPrivateImpl(com.facebook.buck.core.sourcepath.SourcePath) always returns a relative path
after which we should simply call getRelativePath(com.facebook.buck.core.sourcepath.SourcePath). Until then we still need this
nonsense.
public com.google.common.collect.ImmutableMap<String,SourcePath> getSourcePathNames(BuildTarget target, String parameter, Iterable<SourcePath> sourcePaths)
getSourcePathNames in interface SourcePathResolverpublic <T> com.google.common.collect.ImmutableMap<String,T> getSourcePathNames(BuildTarget target, String parameter, Iterable<T> objects, java.util.function.Predicate<T> filter, java.util.function.Function<T,SourcePath> objectSourcePathFunction)
getSourcePathNames in interface SourcePathResolverpublic com.google.common.collect.ImmutableCollection<Path> filterInputsToCompareToOutput(Iterable<? extends SourcePath> sources)
filterInputsToCompareToOutput in interface SourcePathResolverpublic com.google.common.collect.ImmutableSortedSet<Path> getRelativePath(ProjectFilesystem projectFilesystem, SourcePath sourcePath)
getRelativePath in interface SourcePathResolverPath instances to the given SourcePath that is relative to the given
ProjectFilesystempublic com.google.common.collect.ImmutableMap<Path,Path> createRelativeMap(Path basePath, Iterable<SourcePath> sourcePaths)
SourcePathResolvercreateRelativeMap in interface SourcePathResolver