|
| 1 | +// Unconditionally emits a diagnostic about running the autobuilder on an incompatible, non-macOS OS |
| 2 | +// and exits with an error code. |
| 3 | +// |
| 4 | +// This is implemented as a C++ binary instead of a hardcoded JSON file so we can leverage existing |
| 5 | +// diagnostic machinery for emitting correct timestamps, generating correct file names, etc. |
| 6 | + |
| 7 | +#include "swift/logging/SwiftLogging.h" |
| 8 | + |
| 9 | +const std::string_view codeql::programName = "autobuilder"; |
| 10 | + |
| 11 | +namespace codeql_diagnostics { |
| 12 | +constexpr codeql::SwiftDiagnosticsSource incompatible_os{ |
| 13 | + "incompatible_os", "Incompatible operating system for autobuild (expected macOS)", |
| 14 | + "Change the action runner to a macOS one. Analysis on Linux might work, but requires setting " |
| 15 | + "up a custom build command", |
| 16 | + "https://docs.github.com/en/actions/using-workflows/" |
| 17 | + "workflow-syntax-for-github-actions#jobsjob_idruns-on " |
| 18 | + "https://docs.github.com/en/enterprise-server/code-security/code-scanning/" |
| 19 | + "automatically-scanning-your-code-for-vulnerabilities-and-errors/customizing-code-scanning " |
| 20 | + "https://docs.github.com/en/enterprise-server/code-security/code-scanning/" |
| 21 | + "automatically-scanning-your-code-for-vulnerabilities-and-errors/" |
| 22 | + "configuring-the-codeql-workflow-for-compiled-languages#adding-build-steps-for-a-compiled-" |
| 23 | + "language"}; |
| 24 | +} // namespace codeql_diagnostics |
| 25 | + |
| 26 | +static codeql::Logger& logger() { |
| 27 | + static codeql::Logger ret{"main"}; |
| 28 | + return ret; |
| 29 | +} |
| 30 | + |
| 31 | +int main() { |
| 32 | + DIAGNOSE_ERROR(incompatible_os, |
| 33 | + "CodeQL Swift analysis is currently only officially supported on macOS"); |
| 34 | + return 1; |
| 35 | +} |
0 commit comments