mirror of https://github.com/aminya/setup-cpp
fix: use dynamic imports to load the cache files
This commit is contained in:
parent
0f42dc4b13
commit
8705b57937
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -5,19 +5,11 @@ import { info, warning } from "../utils/io/io"
|
|||
import * as core from "@actions/core"
|
||||
import path from "path"
|
||||
import { isGitHubCI } from "../utils/env/isci"
|
||||
import { isCacheFeatureAvailable } from "setup-python/src/utils"
|
||||
import { getCacheDistributor } from "setup-python/src/cache-distributions/cache-factory"
|
||||
|
||||
function isPyPyVersion(versionSpec: string) {
|
||||
return versionSpec.startsWith("pypy-")
|
||||
}
|
||||
|
||||
async function cacheDependencies(cache: string, pythonVersion: string) {
|
||||
const cacheDependencyPath = undefined // core.getInput("cache-dependency-path") || undefined
|
||||
const cacheDistributor = getCacheDistributor(cache, pythonVersion, cacheDependencyPath)
|
||||
await cacheDistributor.restoreCache()
|
||||
}
|
||||
|
||||
export async function setupActionsPython(version: string, _setupDir: string, arch: string) {
|
||||
if (process.env.AGENT_TOOLSDIRECTORY?.trim()) {
|
||||
core.debug(`Python is expected to be installed into AGENT_TOOLSDIRECTORY=${process.env.AGENT_TOOLSDIRECTORY}`)
|
||||
|
@ -41,9 +33,9 @@ export async function setupActionsPython(version: string, _setupDir: string, arc
|
|||
}
|
||||
|
||||
const cache = "pip" // core.getInput("cache") // package manager used for caching
|
||||
if (isCacheFeatureAvailable()) {
|
||||
await cacheDependencies(cache, pythonVersion)
|
||||
}
|
||||
|
||||
const { cacheDependencies } = await import("./cache")
|
||||
await cacheDependencies(cache, pythonVersion)
|
||||
}
|
||||
} catch (err) {
|
||||
core.setFailed((err as Error).message)
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
import { isCacheFeatureAvailable } from "setup-python/src/utils"
|
||||
import { getCacheDistributor } from "setup-python/src/cache-distributions/cache-factory"
|
||||
|
||||
export async function cacheDependencies(cache: string, pythonVersion: string) {
|
||||
if (isCacheFeatureAvailable()) {
|
||||
const cacheDependencyPath = undefined // core.getInput("cache-dependency-path") || undefined
|
||||
const cacheDistributor = getCacheDistributor(cache, pythonVersion, cacheDependencyPath)
|
||||
await cacheDistributor.restoreCache()
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue