-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Swift: improve diagnostics for OS incompatibility
* do not mention any more that one might make analysis happen on Linux with advanced setup * say that outright Swift analysis is only supported on macOS, not just autobuild. * emit the error diagnostics even for traced builds, not only for autobuilds (by using a dummy `extractor` executable).
- Loading branch information
Paolo Tranquilli
committed
Dec 16, 2024
1 parent
7ab06fc
commit 8efd127
Showing
9 changed files
with
63 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
exec -a "$0" "$(dirname $0)/incompatible-os" |
4 changes: 2 additions & 2 deletions
4
swift/ql/integration-tests/autobuilder/unsupported-os/diagnostics.expected
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
"%CODEQL_EXTRACTOR_SWIFT_ROOT%/tools/%CODEQL_PLATFORM%/autobuilder-incompatible-os.exe" | ||
"%CODEQL_EXTRACTOR_SWIFT_ROOT%/tools/%CODEQL_PLATFORM%/exctractor.exe" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
swift/tools/diagnostics/BUILD.bazel → swift/tools/incompatible-os/BUILD.bazel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// Unconditionally emits a diagnostic about running the autobuilder on an incompatible, non-macOS OS | ||
// and exits with an error code. | ||
// | ||
// This is implemented as a C++ binary instead of a hardcoded JSON file so we can leverage existing | ||
// diagnostic machinery for emitting correct timestamps, generating correct file names, etc. | ||
|
||
#include "swift/logging/SwiftLogging.h" | ||
|
||
const std::string_view codeql::programName = "extractor"; | ||
const std::string_view codeql::extractorName = "swift"; | ||
|
||
constexpr codeql::Diagnostic incompatibleOs{ | ||
.id = "incompatible-os", | ||
.name = "Incompatible operating system (expected macOS)", | ||
.action = "[Change the Actions runner][1] to run on macOS.\n\n" | ||
"[1]: " | ||
"https://docs.github.com/en/actions/using-workflows/" | ||
"workflow-syntax-for-github-actions#jobsjob_idruns-on"}; | ||
|
||
static codeql::Logger& logger() { | ||
static codeql::Logger ret{"main"}; | ||
return ret; | ||
} | ||
|
||
int main() { | ||
DIAGNOSE_ERROR(incompatibleOs, "Currently, Swift analysis is only supported on macOS."); | ||
return 1; | ||
} |