Skip to content

Commit

Permalink
refactor(src/cli/cli.cc): guard 'CXX' with 'IN_GITHUB_ACTIONS_CI'
Browse files Browse the repository at this point in the history
  • Loading branch information
jwerle committed Aug 31, 2023
1 parent 64a70d2 commit ee4f9c8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
21 changes: 10 additions & 11 deletions src/cli/cli.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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) {
Expand All @@ -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 << " ";
Expand Down
4 changes: 2 additions & 2 deletions src/common.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit ee4f9c8

Please sign in to comment.