refactor: drop Windows host support
crafter-build is moving to a single Flatpak distribution, and there is no Windows host in that picture: no build.cmd, no MSVC or mingw host build, no DLL plus launcher. Delete every host-Windows path instead of leaving it to rot unverified: the cmd.exe command runner and quoting, the LOCALAPPDATA cache, the MSVC and mingw-host LoadProject variants with their LIBCXX_DIR and CRAFTER_MINGW_DIR plumbing, the winsock port probe, the LoadLibrary libclang loader, the console-width and isatty shims, and the preprocessor guards around the Linux bodies. The x86_64-w64-mingw32 cross-compile target stays. It is target logic (output names, -femulated-tls, the libstdc++ link extras, copying a dependency DLL next to a mingw exe, wine as the runner) and did not depend on any of the removed code. The msvc target goes with the host that was the only thing able to use it. Three target-path warts fixed on the way: ExpectedOutput named a mingw static library <name>.lib while the archive step wrote lib<name>.a, so those libraries relinked on every run; the import lib is no longer copied next to a mingw exe, since the dependency's own bin dir is already on the link line; and llvm-ar now writes every archive, not only the LTO ones, so Debug and Release archives are made the same way. CRAFTER_API and Crafter.Build-Api.h existed only for the DLL boundary. Nothing downstream used them, so they are removed rather than kept as an empty macro nobody can verify. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
f60ba809b5
commit
46082a3117
24 changed files with 138 additions and 1053 deletions
|
|
@ -35,38 +35,11 @@ namespace {
|
|||
return out;
|
||||
}
|
||||
|
||||
// cmd.exe doesn't recognize '...' as quoting (it would pass the single
|
||||
// quotes through to the executable). Wrap in "..." for cmd; embedded "
|
||||
// is rare in paths but escape it to be safe. Backslash sequences before
|
||||
// " don't need the MS-CRT doubling rules because we go through
|
||||
// `cmd /C "..."`, which uses cmd's parser, not the CRT's argv splitter.
|
||||
std::string ShellQuoteCmd(std::string_view s) {
|
||||
std::string out;
|
||||
out.reserve(s.size() + 2);
|
||||
out.push_back('"');
|
||||
for (char c : s) {
|
||||
if (c == '"') out += "\\\"";
|
||||
else out.push_back(c);
|
||||
}
|
||||
out.push_back('"');
|
||||
return out;
|
||||
}
|
||||
|
||||
// Host-shell quoting: sh on Linux, cmd on Windows. For args/paths that
|
||||
// hit the local shell (Local runner exec, Cmd-prefix runner exec).
|
||||
std::string ShellQuoteHost(std::string_view s) {
|
||||
#ifdef _WIN32
|
||||
return ShellQuoteCmd(s);
|
||||
#else
|
||||
return ShellQuoteSh(s);
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string JoinAndQuoteArgs(std::span<const std::string> args) {
|
||||
std::string out;
|
||||
for (const auto& a : args) {
|
||||
if (!out.empty()) out.push_back(' ');
|
||||
out += ShellQuoteHost(a);
|
||||
out += ShellQuoteSh(a);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
|
@ -191,11 +164,7 @@ TestRunner TestRunner::Cmd(std::string command) {
|
|||
TestRunner r;
|
||||
r.name = std::format("cmd:{}", command);
|
||||
r.exec = std::format("{} {{bin}} {{args}}", command);
|
||||
#ifdef _WIN32
|
||||
r.probe = std::format("where {}", command);
|
||||
#else
|
||||
r.probe = std::format("which {}", command);
|
||||
#endif
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
@ -203,11 +172,7 @@ TestRunner TestRunner::Wine() {
|
|||
TestRunner r;
|
||||
r.name = "wine";
|
||||
r.exec = "wine {bin} {args}";
|
||||
#ifdef _WIN32
|
||||
r.probe = "where wine";
|
||||
#else
|
||||
r.probe = "which wine";
|
||||
#endif
|
||||
return r;
|
||||
}
|
||||
|
||||
|
|
@ -218,11 +183,8 @@ TestRunner TestRunner::ForTarget(const Configuration& cfg) {
|
|||
// case (cfg.target defaulted to HostTarget()) without any wrapper.
|
||||
if (target == HostTarget()) return Local();
|
||||
|
||||
// Windows targets: native on a Windows host, Wine on Linux. We don't
|
||||
// distinguish mingw vs msvc here — the produced .exe runs the same way.
|
||||
if (TargetIsWindows(target)) {
|
||||
return TargetIsWindows(HostTarget()) ? Local() : Wine();
|
||||
}
|
||||
// Windows targets run under Wine; there is no Windows host.
|
||||
if (TargetIsWindows(target)) return Wine();
|
||||
|
||||
// WASI: a .wasm file isn't directly executable; wasmtime is the canonical
|
||||
// runtime. wasi-cli also works but the upstream Bytecode Alliance name is
|
||||
|
|
@ -311,7 +273,7 @@ TestResult Crafter::RunSingleTest(const Test& test, const fs::path& binary, std:
|
|||
|
||||
if (test.runner.exec.empty()) {
|
||||
// Local runner: spawn the binary directly through the host shell.
|
||||
std::string cmd = std::format("{} {}", ShellQuoteHost(binary.string()), ph["{args}"]);
|
||||
std::string cmd = std::format("{} {}", ShellQuoteSh(binary.string()), ph["{args}"]);
|
||||
r = RunCommandWithTimeout(cmd, timeout);
|
||||
} else {
|
||||
// Prefix runner (qemu-user, wasmtime, wine, ...): templated exec
|
||||
|
|
@ -337,11 +299,7 @@ TestResult Crafter::RunSingleTest(const Test& test, const fs::path& binary, std:
|
|||
|
||||
namespace {
|
||||
bool ToolOnPath(std::string_view name) {
|
||||
#ifdef _WIN32
|
||||
std::string cmd = std::format("where {} > nul 2>&1", name);
|
||||
#else
|
||||
std::string cmd = std::format("which {} > /dev/null 2>&1", name);
|
||||
#endif
|
||||
return std::system(cmd.c_str()) == 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue