diff --git a/src/build-cache.ts b/src/build-cache.ts index 051d194..a7e3228 100644 --- a/src/build-cache.ts +++ b/src/build-cache.ts @@ -12,9 +12,7 @@ function getBuildCacheKey(): string { if (!buildCacheKey) { buildCacheKey = ''; } - return `xmake-build-cache-${buildCacheKey}-${os.arch()}-${os.platform()}-${ - process.env.RUNNER_OS ?? 'unknown' - }`; + return `xmake-build-cache-${buildCacheKey}-${os.arch()}-${os.platform()}-${process.env.RUNNER_OS ?? 'unknown'}`; } function getBuildCachePath(): string { @@ -29,7 +27,6 @@ function getBuildCacheFolder(): string { return '.xmake-build-cache'; } - export async function loadBuildCache(): Promise { const buildCache = core.getBooleanInput('build-cache'); if (!buildCache) { @@ -40,8 +37,8 @@ export async function loadBuildCache(): Promise { core.exportVariable('XMAKE_ACTION_BUILD_CACHE', 'true'); const buildCacheFolder = getBuildCacheFolder(); - const buildCacheKey = getBuildCacheKey(); - const buildCachePath = getBuildCachePath(); + const buildCacheKey = getBuildCacheKey(); + const buildCachePath = getBuildCachePath(); if (buildCacheFolder && process.env.GITHUB_WORKSPACE) { const fullCachePath = path.join(process.env.GITHUB_WORKSPACE, buildCacheFolder); @@ -68,8 +65,8 @@ export async function saveBuildCache(): Promise { } const buildCacheFolder = getBuildCacheFolder(); - const buildCacheKey = getBuildCacheKey(); - const buildCachePath = getBuildCachePath(); + const buildCacheKey = getBuildCacheKey(); + const buildCachePath = getBuildCachePath(); if (buildCacheFolder && process.env.GITHUB_WORKSPACE && fsutils.isDir(buildCachePath)) { const fullCachePath = path.join(process.env.GITHUB_WORKSPACE, buildCacheFolder); diff --git a/src/package-cache.ts b/src/package-cache.ts index 9cf0ccc..c429c15 100644 --- a/src/package-cache.ts +++ b/src/package-cache.ts @@ -17,9 +17,9 @@ function getPackageCacheKey(): string { }`; } -function getPackageCachePath(): string { +async function getPackageCachePath(): Promise { let packageCachePath = ""; - await exec('xmake', ['l', 'core.package.package.installdir'], (error: Error | null, stdout: string, stderr: string) => { + await exec('xmake l core.package.package.installdir', (error: Error | null, stdout: string, stderr: string) => { if (error) { core.info(`exec error: ${error}`); return; @@ -42,7 +42,7 @@ export async function loadPackageCache(): Promise { const packageCacheFolder = getPackageCacheFolder(); const packageCacheKey = getPackageCacheKey(); - const packageCachePath = getPackageCachePath(); + const packageCachePath = await getPackageCachePath(); if (!packageCachePath || packageCachePath === '') { return; } @@ -73,7 +73,7 @@ export async function savePackageCache(): Promise { const packageCacheFolder = getPackageCacheFolder(); const packageCacheKey = getPackageCacheKey(); - const packageCachePath = getPackageCachePath(); + const packageCachePath = await getPackageCachePath(); if (!packageCachePath || packageCachePath === '') { return; }