Files
codeql/swift/tools/incompatible-os/IncompatibleOs.cpp
Paolo Tranquilli 8efd127010 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).
2024-12-16 10:12:31 +01:00

29 lines
1.0 KiB
C++

// 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;
}