pub struct ToolCache { /* private fields */ }Expand description
Tool Cache
Implementations§
Source§impl ToolCache
impl ToolCache
Sourcepub async fn extract_archive(
&self,
archive: &PathBuf,
output: &PathBuf,
) -> Result<(), ToolCacheError>
pub async fn extract_archive( &self, archive: &PathBuf, output: &PathBuf, ) -> Result<(), ToolCacheError>
Extract an archive
Source§impl ToolCache
impl ToolCache
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new Tool Cache
This will either use the RUNNER_TOOL_CACHE environment variable or
it will try to find the tool cache in the default locations.
There are 3 default locations:
/opt/hostedtoolcache(Unix)/usr/local/share/toolcache(Unix)/tmp/toolcache(Unix)C:\\hostedtoolcache(Windows)C:\\Program Files\\toolcache(Windows)C:\\tmp\\toolcache(Windows)
If no locations are found or writeable, it will create a new tool cache
in the current directory at ./.toolcache.
Sourcepub fn build() -> ToolCacheBuilder
pub fn build() -> ToolCacheBuilder
Create a new ToolCacheBuilder
Sourcepub fn platform(&self) -> ToolPlatform
pub fn platform(&self) -> ToolPlatform
Get the platform for the tool cache
By default this is set to the current platform of the system.
You can override this by using the platform method on the ToolCacheBuilder.
Sourcepub fn arch(&self) -> ToolCacheArch
pub fn arch(&self) -> ToolCacheArch
Get the architecture for the tool cache
By default this is set to the current architecture of the system.
You can override this by using the arch method on the ToolCacheBuilder.
Sourcepub fn get_tool_cache(&self) -> &PathBuf
pub fn get_tool_cache(&self) -> &PathBuf
Get the Tool Cache Path
This is either set by the RUNNER_TOOL_CACHE environment variable
or it is one of the default locations.
Sourcepub async fn find(
&self,
tool: impl Into<String>,
version: impl Into<String>,
) -> Result<Tool, ToolCacheError>
pub async fn find( &self, tool: impl Into<String>, version: impl Into<String>, ) -> Result<Tool, ToolCacheError>
Find a tool in the cache
Sourcepub async fn find_all_version(
&self,
tool: impl Into<String>,
) -> Result<Vec<Tool>, ToolCacheError>
pub async fn find_all_version( &self, tool: impl Into<String>, ) -> Result<Vec<Tool>, ToolCacheError>
Find all versions of a tool in the cache
Sourcepub async fn find_with_arch(
&self,
tool: impl Into<String>,
version: impl Into<String>,
arch: impl Into<ToolCacheArch>,
) -> Result<Tool, ToolCacheError>
pub async fn find_with_arch( &self, tool: impl Into<String>, version: impl Into<String>, arch: impl Into<ToolCacheArch>, ) -> Result<Tool, ToolCacheError>
Find a tool in the cache with a specific architecture
Sourcepub fn new_tool_path(
&self,
tool: impl Into<String>,
version: impl Into<String>,
) -> PathBuf
pub fn new_tool_path( &self, tool: impl Into<String>, version: impl Into<String>, ) -> PathBuf
Create a path for the tool in the cache to be used
Sourcepub fn set_retry_count(&mut self, count: u8)
👎Deprecated since 0.17.0: Use the ToolCacheBuilder instead
pub fn set_retry_count(&mut self, count: u8)
Set the number of times to retry a download (default is 10)