From ee4f9c82ebd2f8c83704d94d54edf5c1366f4d89 Mon Sep 17 00:00:00 2001 From: Joseph Werle Date: Thu, 31 Aug 2023 18:12:05 -0400 Subject: [PATCH] refactor(src/cli/cli.cc): guard 'CXX' with 'IN_GITHUB_ACTIONS_CI' --- src/cli/cli.cc | 21 ++++++++++----------- src/common.hh | 4 ++-- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/cli/cli.cc b/src/cli/cli.cc index 99b74b7be2..da3ec55392 100644 --- a/src/cli/cli.cc +++ b/src/cli/cli.cc @@ -4358,6 +4358,7 @@ int main (const int argc, const char* argv[]) { // build desktop extension if (isForDesktop) { + static const auto IN_GITHUB_ACTIONS_CI = getEnv("GITHUB_ACTIONS_CI").size() == 0; auto oldCwd = fs::current_path(); fs::current_path(targetPath); @@ -4544,7 +4545,7 @@ int main (const int argc, const char* argv[]) { if (source.ends_with(".hh") || source.ends_with(".h")) { continue; } else if (source.ends_with(".cc") || source.ends_with(".cpp") || source.ends_with(".c++") || source.ends_with(".mm")) { - compiler = CXX.size() > 0 ? CXX : "clang++"; + compiler = CXX.size() > 0 && !IN_GITHUB_ACTIONS_CI ? CXX : "clang++"; compilerFlags += " -v"; compilerFlags += " -std=c++2a -v"; if (platform.mac) { @@ -4557,16 +4558,14 @@ int main (const int argc, const char* argv[]) { compilerFlags += " -Wno-unused-command-line-argument"; } - if (CXX.size() == 0) { - if (compiler.ends_with("clang++")) { - compiler = compiler.substr(0, compiler.size() - 2); - } else if (compiler.ends_with("clang++.exe")) { - compiler = compiler.substr(0, compiler.size() - 6) + ".exe"; - } else if (compiler.ends_with("g++")) { - compiler = compiler.substr(0, compiler.size() - 2) + "cc"; - } else if (compiler.ends_with("g++.exe")) { - compiler = compiler.substr(0, compiler.size() - 6) + "cc.exe"; - } + if (compiler.ends_with("clang++")) { + compiler = compiler.substr(0, compiler.size() - 2); + } else if (compiler.ends_with("clang++.exe")) { + compiler = compiler.substr(0, compiler.size() - 6) + ".exe"; + } else if (compiler.ends_with("g++")) { + compiler = compiler.substr(0, compiler.size() - 2) + "cc"; + } else if (compiler.ends_with("g++.exe")) { + compiler = compiler.substr(0, compiler.size() - 6) + "cc.exe"; } } else if (source.ends_with(".o") || source.ends_with(".a")) { objects << source << " "; diff --git a/src/common.hh b/src/common.hh index 5d8ac81910..e4d3084a33 100644 --- a/src/common.hh +++ b/src/common.hh @@ -655,12 +655,12 @@ namespace SSC { auto& stream = isError ? std::cerr : std::cout; stream << str; + #if defined(_WIN32) if (IN_GITHUB_ACTIONS_CI) { - #if defined(_WIN32) notifyCli(); return; - #endif } + #endif stream << std::endl; notifyCli();