Class Sandbox
lib/bld/.sandbox/<extensionName>.
Dependencies can be downloaded into the extension's sandbox root or into an explicit
subdirectory of it (see the subDirectory overloads); each location is tracked
independently. A download is skipped and the cached artifacts reused when a snapshot
recorded in lib/bld/.sandbox/sandbox.snapshot is still valid — validity requires
both the resolution inputs (dependencies, repositories, version overrides/boms) and the
current on-disk content of the target directory to match what was recorded, so external
changes to either force a re-download. Snapshot updates are written atomically.
Concurrent downloads for the same extension are serialized; downloads for different extensions may proceed in parallel while still safely sharing the snapshot file.
- Since:
- 1.4
- Author:
- Erik C. Thauvin
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondownloadDependencies(List<rife.bld.dependencies.Dependency> dependencies, List<rife.bld.dependencies.Repository> repositories) Downloads the given dependencies using the provided repositories and a defaultVersionResolution.downloadDependencies(List<rife.bld.dependencies.Dependency> dependencies, List<rife.bld.dependencies.Repository> repositories, @Nullable File subDirectory) Downloads dependencies into the sandbox, optionally under a subdirectory specified as aFile.downloadDependencies(List<rife.bld.dependencies.Dependency> dependencies, List<rife.bld.dependencies.Repository> repositories, @Nullable Path subDirectory) Downloads dependencies into the sandbox, optionally under a subdirectory.downloadDependencies(List<rife.bld.dependencies.Dependency> dependencies, List<rife.bld.dependencies.Repository> repositories, rife.bld.dependencies.VersionResolution resolution) Downloads the given dependencies using the provided repositories and version resolution.downloadDependencies(List<rife.bld.dependencies.Dependency> dependencies, List<rife.bld.dependencies.Repository> repositories, rife.bld.dependencies.VersionResolution resolution, @Nullable File subDirectory) Downloads the given dependencies using the provided repositories and version resolution into an optional subdirectory specified as aFile.downloadDependencies(List<rife.bld.dependencies.Dependency> dependencies, List<rife.bld.dependencies.Repository> repositories, rife.bld.dependencies.VersionResolution resolution, @Nullable Path subDirectory) Downloads dependencies into the sandbox, optionally under a subdirectory.Returns the root sandbox directory.Returns the root sandbox directory as aFile.Returns the extension-specific sandbox directory.Returns the extension-specific sandbox directory as aFile.
-
Constructor Details
-
Sandbox
Creates a new sandbox manager for the given extension.- Parameters:
extensionName- the unique name of the extension; must be a single, non-blank path segmentproject- the bld project used to resolvelib/bld; must not benull- Throws:
NullPointerException- if any argument isnullIllegalArgumentException- ifextensionNameis blank or is not a single path segment (for example, if it contains a separator,..or is absolute)
-
-
Method Details
-
downloadDependencies
public Path downloadDependencies(List<rife.bld.dependencies.Dependency> dependencies, List<rife.bld.dependencies.Repository> repositories) Downloads the given dependencies using the provided repositories and a defaultVersionResolution.- Parameters:
dependencies- the dependencies to resolve; must not benullrepositories- the repositories to resolve from; must not benull- Returns:
- the path to the extension sandbox directory where artifacts were (or would be) downloaded
- Throws:
NullPointerException- if any argument isnullor containnullelementsIllegalArgumentException- if any argument is empty or contain empty elements- See Also:
-
downloadDependencies
public Path downloadDependencies(List<rife.bld.dependencies.Dependency> dependencies, List<rife.bld.dependencies.Repository> repositories, rife.bld.dependencies.VersionResolution resolution) Downloads the given dependencies using the provided repositories and version resolution.If a valid snapshot already exists, the download is skipped.
- Parameters:
dependencies- the dependencies to resolve; must not benullor emptyrepositories- the repositories to resolve from; must not benullor emptyresolution- the version resolution strategy; must not benull- Returns:
- the path to the extension sandbox directory where artifacts were (or would be) downloaded
- Throws:
NullPointerException- if any argument isnullor containnullelementsIllegalArgumentException- if any argument is empty or contain empty elements- See Also:
-
downloadDependencies
public Path downloadDependencies(List<rife.bld.dependencies.Dependency> dependencies, List<rife.bld.dependencies.Repository> repositories, rife.bld.dependencies.VersionResolution resolution, @Nullable Path subDirectory) Downloads dependencies into the sandbox, optionally under a subdirectory.- Parameters:
dependencies- the direct dependencies to resolve; must not benullor emptyrepositories- the repositories to resolve from; must not benullor emptyresolution- the version resolution strategy; must not benullsubDirectory- optional subdirectory within the extension sandbox to place artifacts; may benullto use the extension root- Returns:
- the path to the directory where artifacts were downloaded
- Throws:
NullPointerException- if any argument isnullor containnullelementsIllegalArgumentException- if any argument is empty or contain empty elements, or ifsubDirectoryresolves outside the extension sandboxIllegalStateException- if an existing download directory cannot be deletedUncheckedIOException- if the download directory cannot be created or the snapshot cannot be written
-
downloadDependencies
public Path downloadDependencies(List<rife.bld.dependencies.Dependency> dependencies, List<rife.bld.dependencies.Repository> repositories, rife.bld.dependencies.VersionResolution resolution, @Nullable File subDirectory) Downloads the given dependencies using the provided repositories and version resolution into an optional subdirectory specified as aFile.- Parameters:
dependencies- the dependencies to resolve; must not benullor emptyrepositories- the repositories to resolve from; must not benullor emptyresolution- the version resolution strategy; must not benullsubDirectory- optional subdirectory as aFile; may benull- Returns:
- the path to the directory where artifacts were downloaded
- Throws:
NullPointerException- if any argument isnullor containnullelementsIllegalArgumentException- if any argument is empty or contain empty elements, or ifsubDirectoryresolves outside the extension sandboxIllegalStateException- if an existing download directory cannot be deletedUncheckedIOException- if the download directory cannot be created or the snapshot cannot be written- See Also:
-
downloadDependencies
public Path downloadDependencies(List<rife.bld.dependencies.Dependency> dependencies, List<rife.bld.dependencies.Repository> repositories, @Nullable Path subDirectory) Downloads dependencies into the sandbox, optionally under a subdirectory.- Parameters:
dependencies- the direct dependencies to resolve; must not benullor emptyrepositories- the repositories to resolve from; must not benullor emptysubDirectory- optional subdirectory within the extension sandbox to place artifacts; may benullto use the extension root- Returns:
- the path to the directory where artifacts were downloaded
- Throws:
NullPointerException- if any argument isnullor containnullelementsIllegalArgumentException- if any argument is empty or contain empty elements, or ifsubDirectoryresolves outside the extension sandboxIllegalStateException- if an existing download directory cannot be deletedUncheckedIOException- if the download directory cannot be created or the snapshot cannot be written- See Also:
-
downloadDependencies
public Path downloadDependencies(List<rife.bld.dependencies.Dependency> dependencies, List<rife.bld.dependencies.Repository> repositories, @Nullable File subDirectory) Downloads dependencies into the sandbox, optionally under a subdirectory specified as aFile.- Parameters:
dependencies- the dependencies to resolve; must not benullor emptyrepositories- the repositories to resolve from; must not benullor emptysubDirectory- optional subdirectory as aFile; may benull- Returns:
- the path to the directory where artifacts were downloaded
- See Also:
-
getSandboxDirectory
Returns the root sandbox directory.- Returns:
- the path to
lib/bld/.sandbox
-
getSandboxDirectoryAsFile
Returns the root sandbox directory as aFile.- Returns:
- the root sandbox directory file
-
getSandboxExtensionDirectory
Returns the extension-specific sandbox directory.- Returns:
- the path to
lib/bld/.sandbox/<extensionName>
-
getSandboxExtensionDirectoryAsFile
Returns the extension-specific sandbox directory as aFile.- Returns:
- the extension sandbox directory file
-