Skip to content

Commit

Permalink
ci: avoid hitting MAX_PATHLEN in win32 builds (#16299)
Browse files Browse the repository at this point in the history
  • Loading branch information
DonIsaac authored Jan 10, 2025
1 parent ccc7bde commit b4d9223
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
4 changes: 3 additions & 1 deletion cmake/tools/SetupWebKit.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ if(NOT WEBKIT_VERSION)
set(WEBKIT_VERSION e1a802a2287edfe7f4046a9dd8307c8b59f5d816)
endif()

string(SUBSTRING ${WEBKIT_VERSION} 0 16 WEBKIT_VERSION_PREFIX)

if(WEBKIT_LOCAL)
set(DEFAULT_WEBKIT_PATH ${VENDOR_PATH}/WebKit/WebKitBuild/${CMAKE_BUILD_TYPE})
else()
set(DEFAULT_WEBKIT_PATH ${CACHE_PATH}/webkit-${WEBKIT_VERSION})
set(DEFAULT_WEBKIT_PATH ${CACHE_PATH}/webkit-${WEBKIT_VERSION_PREFIX})
endif()

option(WEBKIT_PATH "The path to the WebKit directory")
Expand Down
26 changes: 19 additions & 7 deletions scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,28 @@ function cmakePath(path) {
return path.replace(/\\/g, "/");
}

/** @param {string} str */
const toAlphaNumeric = str => str.replace(/[^a-z0-9]/gi, "-");
function getCachePath(branch) {
const buildPath = process.env.BUILDKITE_BUILD_PATH;
const repository = process.env.BUILDKITE_REPO;
const fork = process.env.BUILDKITE_PULL_REQUEST_REPO;
const repositoryKey = (fork || repository).replace(/[^a-z0-9]/gi, "-");
const branchName = (branch || process.env.BUILDKITE_BRANCH).replace(/[^a-z0-9]/gi, "-");
const {
BUILDKITE_BUILD_PATH: buildPath,
BUILDKITE_REPO: repository,
BUILDKITE_PULL_REQUEST_REPO: fork,
BUILDKITE_BRANCH,
BUILDKITE_STEP_KEY,
} = process.env;

// NOTE: settings that could be long should be truncated to avoid hitting max
// path length limit on windows (4096)
const repositoryKey = toAlphaNumeric(
// remove domain name, only leaving 'org/repo'
(fork || repository).replace(/^https?:\/\/github\.com\/?/, ""),
);
const branchName = toAlphaNumeric(branch || BUILDKITE_BRANCH);
const branchKey = branchName.startsWith("gh-readonly-queue-")
? branchName.slice(18, branchName.indexOf("-pr-"))
: branchName;
const stepKey = process.env.BUILDKITE_STEP_KEY.replace(/[^a-z0-9]/gi, "-");
: branchName.slice(0, 32);
const stepKey = toAlphaNumeric(BUILDKITE_STEP_KEY);
return resolve(buildPath, "..", "cache", repositoryKey, branchKey, stepKey);
}

Expand Down

0 comments on commit b4d9223

Please sign in to comment.