From d10c8c3a8ebc3542dd27a37fe124766e044a7e52 Mon Sep 17 00:00:00 2001
From: Anonymous Maarten <[EMAIL REDACTED]>
Date: Sun, 18 Jun 2023 01:31:02 +0200
Subject: [PATCH] Use SdlBuildPlatform in hash
---
packed/index.js | 11 +++++++----
src/main.ts | 15 +++++++++++----
2 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/packed/index.js b/packed/index.js
index 6cb76c185aba..310ac7f9f0be 100644
--- a/packed/index.js
+++ b/packed/index.js
@@ -84,7 +84,6 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
const child_process = __importStar(__nccwpck_require__(2081));
const crypto = __importStar(__nccwpck_require__(6113));
const fs = __importStar(__nccwpck_require__(7147));
-const os = __importStar(__nccwpck_require__(2037));
const cache = __importStar(__nccwpck_require__(7799));
const core = __importStar(__nccwpck_require__(2186));
const constants_1 = __nccwpck_require__(7077);
@@ -139,7 +138,7 @@ async function cmake_configure_build(SOURCE_DIR, build_dir, prefix_dir, build_ty
child_process.execSync(install_command, { stdio: "inherit" });
});
}
-function calculate_state_hash(sdl_git_hash) {
+function calculate_state_hash(sdl_git_hash, build_platform) {
const ENV_KEYS = [
"AR",
"CC",
@@ -161,7 +160,10 @@ function calculate_state_hash(sdl_git_hash) {
const v = core.getInput(key);
inputs_state.push(`${key}=${v}`);
}
- const misc_state = [`GIT_HASH=${sdl_git_hash}`, `platform=${os.platform()}`];
+ const misc_state = [
+ `GIT_HASH=${sdl_git_hash}`,
+ `build_platform=${build_platform}`,
+ ];
const complete_state = [
"ENVIRONMENT",
...env_state,
@@ -217,7 +219,7 @@ async function run() {
}
}
const GIT_HASH = await convert_git_branch_tag_to_hash(git_branch_hash);
- const STATE_HASH = calculate_state_hash(GIT_HASH);
+ const STATE_HASH = calculate_state_hash(GIT_HASH, SDL_BUILD_PLATFORM);
core.info(`setup-sdl state = ${STATE_HASH}`);
const SOURCE_DIR = `${SETUP_SDL_ROOT}/${STATE_HASH}/source`;
const BUILD_DIR = `${SETUP_SDL_ROOT}/${STATE_HASH}/build`;
@@ -240,6 +242,7 @@ async function run() {
cmake_args += " -GNinja";
}
await cmake_configure_build(SOURCE_DIR, BUILD_DIR, PACKAGE_DIR, CMAKE_BUILD_TYPE, cmake_args);
+ core.info(`Caching ${CACHE_PATHS}.`);
await cache.saveCache(CACHE_PATHS, CACHE_KEY);
}
core.exportVariable(`SDL${SDL_VERSION.major}_ROOT`, PACKAGE_DIR);
diff --git a/src/main.ts b/src/main.ts
index 83b1465ac30e..ff3c280474ea 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -1,7 +1,6 @@
import * as child_process from "child_process";
import * as crypto from "crypto";
import * as fs from "fs";
-import * as os from "os";
import * as cache from "@actions/cache";
import * as core from "@actions/core";
@@ -20,6 +19,7 @@ import {
import {
get_sdl_build_platform,
get_platform_root_directory,
+ SdlBuildPlatform,
} from "./platform";
async function convert_git_branch_tag_to_hash(
@@ -98,7 +98,10 @@ async function cmake_configure_build(
});
}
-function calculate_state_hash(sdl_git_hash: string) {
+function calculate_state_hash(
+ sdl_git_hash: string,
+ build_platform: SdlBuildPlatform
+) {
const ENV_KEYS = [
"AR",
"CC",
@@ -122,7 +125,10 @@ function calculate_state_hash(sdl_git_hash: string) {
inputs_state.push(`${key}=${v}`);
}
- const misc_state = [`GIT_HASH=${sdl_git_hash}`, `platform=${os.platform()}`];
+ const misc_state = [
+ `GIT_HASH=${sdl_git_hash}`,
+ `build_platform=${build_platform}`,
+ ];
const complete_state: string[] = [
"ENVIRONMENT",
@@ -198,7 +204,7 @@ async function run() {
git_branch_hash
);
- const STATE_HASH = calculate_state_hash(GIT_HASH);
+ const STATE_HASH = calculate_state_hash(GIT_HASH, SDL_BUILD_PLATFORM);
core.info(`setup-sdl state = ${STATE_HASH}`);
const SOURCE_DIR = `${SETUP_SDL_ROOT}/${STATE_HASH}/source`;
@@ -237,6 +243,7 @@ async function run() {
cmake_args
);
+ core.info(`Caching ${CACHE_PATHS}.`);
await cache.saveCache(CACHE_PATHS, CACHE_KEY);
}