build: try and map the found files back to the src folder

This commit is contained in:
Jacob Overgaard
2024-07-03 12:59:11 +02:00
parent bce01f373b
commit 5ff3a01dee

View File

@@ -28,9 +28,9 @@ function checkPathLength(dir) {
hasError = true;
if (IS_AZURE_PIPELINES) {
console.error(`##vso[task.logissue type=error;sourcepath=${filePath};]Path exceeds maximum length of ${MAX_PATH_LENGTH} characters: ${filePath} with ${filePath.length} characters`);
console.error(`##vso[task.logissue type=error;sourcepath=${mapFileToSourcePath(filePath)};]Path exceeds maximum length of ${MAX_PATH_LENGTH} characters: ${filePath} with ${filePath.length} characters`);
} else if (IS_GITHUB_ACTIONS) {
console.error(`::error file=${filePath},title=Path exceeds ${MAX_PATH_LENGTH} characters::Paths should not be longer than ${MAX_PATH_LENGTH} characters to support WIN32 systems. The file ${filePath} exceeds that with ${filePath.length - MAX_PATH_LENGTH} characters.`);
console.error(`::error file=${mapFileToSourcePath(filePath)},title=Path exceeds ${MAX_PATH_LENGTH} characters::Paths should not be longer than ${MAX_PATH_LENGTH} characters to support WIN32 systems. The file ${filePath} exceeds that with ${filePath.length - MAX_PATH_LENGTH} characters.`);
} else {
console.error(`Path exceeds maximum length of ${MAX_PATH_LENGTH} characters: ${FILE_PATH_COLOR}`, filePath, filePath.length - MAX_PATH_LENGTH);
}
@@ -47,6 +47,16 @@ function checkPathLength(dir) {
return hasError;
}
/**
* Maps a file path to a source path for CI logs.
* @remark This might not always work as expected, especially on bundled files, but it's a best effort to map the file path to a source path.
* @param {string} file - The file path to map to a source path
* @returns {string}
*/
function mapFileToSourcePath(file) {
return file.replace(PROJECT_DIR, 'src');
}
const hasError = checkPathLength(PROJECT_DIR, MAX_PATH_LENGTH);
if (hasError) {