Search in sources :

Example 16 with ArchiveMemberPath

use of com.facebook.buck.io.ArchiveMemberPath in project buck by facebook.

the class AbstractDependencyFileEntry method fromSourcePath.

public static DependencyFileEntry fromSourcePath(SourcePath sourcePath, SourcePathResolver resolver) {
    final DependencyFileEntry.Builder builder = DependencyFileEntry.builder();
    if (sourcePath instanceof ArchiveMemberSourcePath) {
        ArchiveMemberSourcePath archiveMemberSourcePath = (ArchiveMemberSourcePath) sourcePath;
        ArchiveMemberPath relativeArchiveMemberPath = resolver.getRelativeArchiveMemberPath(archiveMemberSourcePath);
        builder.setPathToFile(relativeArchiveMemberPath.getArchivePath());
        builder.setPathWithinArchive(relativeArchiveMemberPath.getMemberPath());
    } else {
        builder.setPathToFile(resolver.getRelativePath(sourcePath));
    }
    return builder.build();
}
Also used : ArchiveMemberPath(com.facebook.buck.io.ArchiveMemberPath) ArchiveMemberSourcePath(com.facebook.buck.rules.ArchiveMemberSourcePath)

Aggregations

ArchiveMemberPath (com.facebook.buck.io.ArchiveMemberPath)16 Path (java.nio.file.Path)14 ProjectFilesystem (com.facebook.buck.io.ProjectFilesystem)11 Test (org.junit.Test)11 FakeProjectFilesystem (com.facebook.buck.testutil.FakeProjectFilesystem)10 Config (com.facebook.buck.config.Config)2 BuildJobStateFileHashes (com.facebook.buck.distributed.thrift.BuildJobStateFileHashes)1 BuildTarget (com.facebook.buck.model.BuildTarget)1 ArchiveMemberSourcePath (com.facebook.buck.rules.ArchiveMemberSourcePath)1 DefaultRuleKeyFactory (com.facebook.buck.rules.keys.DefaultRuleKeyFactory)1 FakeFileHashCache (com.facebook.buck.testutil.FakeFileHashCache)1 DefaultFileHashCache (com.facebook.buck.util.cache.DefaultFileHashCache)1 FileHashCache (com.facebook.buck.util.cache.FileHashCache)1 NullFileHashCache (com.facebook.buck.util.cache.NullFileHashCache)1 ProjectFileHashCache (com.facebook.buck.util.cache.ProjectFileHashCache)1 StackedFileHashCache (com.facebook.buck.util.cache.StackedFileHashCache)1 HashCode (com.google.common.hash.HashCode)1 IOException (java.io.IOException)1 NoSuchFileException (java.nio.file.NoSuchFileException)1 ExecutionException (java.util.concurrent.ExecutionException)1