Package com.facebook.buck.core.artifact
Class ArtifactFilesystem
- java.lang.Object
-
- com.facebook.buck.core.artifact.ArtifactFilesystem
-
-
Constructor Summary
Constructors Constructor Description ArtifactFilesystem(ProjectFilesystem filesystem)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
copy(Artifact toCopy, Artifact dest, CopySourceMode mode)
Makes a copy of the givenArtifact
to the given destinationArtifact
, with copy behaviour as specified by theCopySourceMode
.void
createPackagePaths(com.google.common.collect.ImmutableSet<OutputArtifact> outputs)
Create the package paths that actions will write into if it does not existInputStream
getInputStream(Artifact artifact)
OutputStream
getOutputStream(Artifact artifact, FileAttribute<?>... attrs)
void
makeExecutable(Artifact artifact)
Make anArtifact
executablevoid
removeBuildArtifacts(com.google.common.collect.ImmutableSet<OutputArtifact> outputs)
Remove build artifacts (only) that exist on the underlying filesystem.String
stringify(Artifact artifact)
Expand an artifact into a command line argument.String
stringifyAbsolute(Artifact artifact)
Expand an artifact into a command line argument.void
writeContentsToPath(String contents, Artifact artifact)
Write a string to a givenArtifact
, creating parent directories as necessary
-
-
-
Constructor Detail
-
ArtifactFilesystem
public ArtifactFilesystem(ProjectFilesystem filesystem)
- Parameters:
filesystem
- that theArtifact
s are relative to.
-
-
Method Detail
-
getInputStream
public InputStream getInputStream(Artifact artifact) throws IOException
- Parameters:
artifact
- the artifact to read. It should be bound.- Returns:
- an
InputStream
of the given artifact. - Throws:
IOException
-
getOutputStream
public OutputStream getOutputStream(Artifact artifact, FileAttribute<?>... attrs) throws IOException
- Parameters:
artifact
- the artifact to write. It should be bound.- Returns:
- an
OutputStream
of the given artifact. - Throws:
IOException
-
writeContentsToPath
public void writeContentsToPath(String contents, Artifact artifact) throws IOException
Write a string to a givenArtifact
, creating parent directories as necessary- Parameters:
contents
- the desired contentsartifact
- the artifact to write. It must be bound.- Throws:
IOException
- The file could not be written
-
makeExecutable
public void makeExecutable(Artifact artifact) throws IOException
Make anArtifact
executable- Parameters:
artifact
- the artifact to write. It must be bound.- Throws:
IOException
- Making the file executable failed
-
copy
public void copy(Artifact toCopy, Artifact dest, CopySourceMode mode) throws IOException
Makes a copy of the givenArtifact
to the given destinationArtifact
, with copy behaviour as specified by theCopySourceMode
.- Throws:
IOException
-
stringify
public String stringify(Artifact artifact)
Expand an artifact into a command line argument.NOTE: This should not be used just to get a string version of a path. This API may become more restrictive in the future if necessary.
- Parameters:
artifact
- a bound artifact whose path is requested- Returns:
- The path to an artifact as a string
-
stringifyAbsolute
public String stringifyAbsolute(Artifact artifact)
Expand an artifact into a command line argument.NOTE: This should not be used just to get a string version of a path. This API may become more restrictive in the future if necessary. When possible, then non-absolute version of this function (
stringify(Artifact)
should be used.- Parameters:
artifact
- a bound artifact whose path is requested- Returns:
- The path to an artifact as a string
-
createPackagePaths
public void createPackagePaths(com.google.common.collect.ImmutableSet<OutputArtifact> outputs) throws IOException
Create the package paths that actions will write into if it does not exist- Throws:
IOException
-
removeBuildArtifacts
public void removeBuildArtifacts(com.google.common.collect.ImmutableSet<OutputArtifact> outputs) throws IOException
Remove build artifacts (only) that exist on the underlying filesystem.- Throws:
IOException
-
-