Class ArtifactFilesystem


  • public class ArtifactFilesystem
    extends Object
    A Filesystem for operating on Artifacts
    • Constructor Detail

      • ArtifactFilesystem

        public ArtifactFilesystem​(ProjectFilesystem filesystem)
        Parameters:
        filesystem - that the Artifacts are relative to.
    • Method Detail

      • writeContentsToPath

        public void writeContentsToPath​(String contents,
                                        Artifact artifact)
                                 throws IOException
        Write a string to a given Artifact, creating parent directories as necessary
        Parameters:
        contents - the desired contents
        artifact - 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 an Artifact executable
        Parameters:
        artifact - the artifact to write. It must be bound.
        Throws:
        IOException - Making the file executable failed
      • 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