feat(install): cross-target installs and target-only builds
VoidBuildSystem CI / 3A · Linux test (debug) (push) Successful in 6m26s
VoidBuildSystem CI / 3A · Linux test (relwithdebinfo) (push) Successful in 6m38s
VoidBuildSystem CI / 4A · Linux package (relwithdebinfo) (push) Successful in 1m26s
VoidBuildSystem CI / 5 · Release (push) Skipped
VoidBuildSystem CI / 4A · Linux package (sanitizers) (push) Successful in 1m18s
VoidBuildSystem CI / 4A · Linux package (debug) (push) Successful in 1m15s
VoidBuildSystem CI / 4A2 · VBS installers (self-hosted) (push) Failing after 31s
VoidBuildSystem CI / 1 · Requirements (push) Successful in 2s
VoidBuildSystem CI / 2B · Windows Wine build (debug) (push) Successful in 1m51s
VoidBuildSystem CI / 2A · Linux build (debug) (push) Successful in 2m31s
VoidBuildSystem CI / 2B · Windows Wine build (relwithdebinfo) (push) Successful in 3m13s
VoidBuildSystem CI / 2A · Linux build (sanitizers) (push) Successful in 3m24s
VoidBuildSystem CI / 2A · Linux build (relwithdebinfo) (push) Successful in 4m43s
VoidBuildSystem CI / 3B · Windows Wine test (debug) (push) Successful in 20s
VoidBuildSystem CI / 3B · Windows Wine test (relwithdebinfo) (push) Successful in 26s
VoidBuildSystem CI / 3A · Linux test (sanitizers) (push) Successful in 1m42s
VoidBuildSystem CI / 4B · Windows package (debug) (push) Successful in 22s
VoidBuildSystem CI / 4B · Windows package (relwithdebinfo) (push) Successful in 37s
VoidBuildSystem CI / 3A · Linux test (debug) (push) Successful in 6m26s
VoidBuildSystem CI / 3A · Linux test (relwithdebinfo) (push) Successful in 6m38s
VoidBuildSystem CI / 4A · Linux package (relwithdebinfo) (push) Successful in 1m26s
VoidBuildSystem CI / 5 · Release (push) Skipped
VoidBuildSystem CI / 4A · Linux package (sanitizers) (push) Successful in 1m18s
VoidBuildSystem CI / 4A · Linux package (debug) (push) Successful in 1m15s
VoidBuildSystem CI / 4A2 · VBS installers (self-hosted) (push) Failing after 31s
VoidBuildSystem CI / 1 · Requirements (push) Successful in 2s
VoidBuildSystem CI / 2B · Windows Wine build (debug) (push) Successful in 1m51s
VoidBuildSystem CI / 2A · Linux build (debug) (push) Successful in 2m31s
VoidBuildSystem CI / 2B · Windows Wine build (relwithdebinfo) (push) Successful in 3m13s
VoidBuildSystem CI / 2A · Linux build (sanitizers) (push) Successful in 3m24s
VoidBuildSystem CI / 2A · Linux build (relwithdebinfo) (push) Successful in 4m43s
VoidBuildSystem CI / 3B · Windows Wine test (debug) (push) Successful in 20s
VoidBuildSystem CI / 3B · Windows Wine test (relwithdebinfo) (push) Successful in 26s
VoidBuildSystem CI / 3A · Linux test (sanitizers) (push) Successful in 1m42s
VoidBuildSystem CI / 4B · Windows package (debug) (push) Successful in 22s
VoidBuildSystem CI / 4B · Windows package (relwithdebinfo) (push) Successful in 37s
- vbs install accepts --target-os/--target-arch like vbs build, so the Windows installers can be produced from the Linux host. - Only targets carrying an install rule (plus their dependencies) are built, so install no longer links test executables. - Failed install actions print their captured stderr. - The VBS description compares the target OS case-insensitively. - The installer job uses a per-run build directory: concurrent runs on the same runner share the repository workspace.
This commit is contained in:
1 parent
0186711a90
commit
f1e52467d7
3 files changed
+43
-8
No files matched your search
@@ -247,8 +247,10 @@ jobs:
|
|||||||
out=dist-installers
|
out=dist-installers
|
||||||
prefix="$(mktemp -d)"
|
prefix="$(mktemp -d)"
|
||||||
mkdir -p "${out}"
|
mkdir -p "${out}"
|
||||||
# The first install builds the project with VBS (build.cpp); the rest reuse
|
# Concurrent runs on the same runner share the repository workspace, so the
|
||||||
# the shared build directory.
|
# self-hosted build directory is unique per run. The first install builds the
|
||||||
|
# project with VBS (build.cpp); the rest reuse it.
|
||||||
|
build_dir="build/selfhost-${GITHUB_RUN_ID}"
|
||||||
for fmt in tar sh zip deb rpm wix dmg nuget; do
|
for fmt in tar sh zip deb rpm wix dmg nuget; do
|
||||||
case "${fmt}" in
|
case "${fmt}" in
|
||||||
tar) ext=tar ;;
|
tar) ext=tar ;;
|
||||||
@@ -256,7 +258,7 @@ jobs:
|
|||||||
nuget) ext=nupkg ;;
|
nuget) ext=nupkg ;;
|
||||||
*) ext="${fmt}" ;;
|
*) ext="${fmt}" ;;
|
||||||
esac
|
esac
|
||||||
"${vbs}" install --project . --build-dir build/selfhost --profile release \
|
"${vbs}" install --project . --build-dir "${build_dir}" --profile release \
|
||||||
--prefix "${prefix}" --package-name VoidBuildSystem \
|
--prefix "${prefix}" --package-name VoidBuildSystem \
|
||||||
--package-version "${version}" \
|
--package-version "${version}" \
|
||||||
--archive "${out}/vbs-${label}-linux-x86_64-${fmt}.${ext}" \
|
--archive "${out}/vbs-${label}-linux-x86_64-${fmt}.${ext}" \
|
||||||
|
|||||||
@@ -1,5 +1,22 @@
|
|||||||
#include "build-support/Defaults.hpp"
|
#include "build-support/Defaults.hpp"
|
||||||
|
|
||||||
|
#include <algorithm>
|
||||||
|
#include <cctype>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
// The profile context carries the target OS as written on the command line
|
||||||
|
// ("windows") or as the host name ("Windows"): compare case-insensitively.
|
||||||
|
bool targets_windows(const Void::Build::ProfileContext &ctx) {
|
||||||
|
std::string os = ctx.os;
|
||||||
|
std::ranges::transform(os, os.begin(),
|
||||||
|
[](unsigned char c) { return static_cast<char>(std::tolower(c)); });
|
||||||
|
return os == "windows";
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
void build(Void::Build::Project &project) {
|
void build(Void::Build::Project &project) {
|
||||||
const auto &ctx = project.context();
|
const auto &ctx = project.context();
|
||||||
|
|
||||||
@@ -48,7 +65,7 @@ void build(Void::Build::Project &project) {
|
|||||||
.link(library.target("Void::Crypto"), Void::Build::Visibility::Public)
|
.link(library.target("Void::Crypto"), Void::Build::Visibility::Public)
|
||||||
.link(library.target("Void::Archive"), Void::Build::Visibility::Public)
|
.link(library.target("Void::Archive"), Void::Build::Visibility::Public)
|
||||||
.link(library.target("Void::Log"), Void::Build::Visibility::Public);
|
.link(library.target("Void::Log"), Void::Build::Visibility::Public);
|
||||||
if (ctx.os == "Windows") {
|
if (targets_windows(ctx)) {
|
||||||
// Winsock for the registry client and the native Windows HTTP fallbacks.
|
// Winsock for the registry client and the native Windows HTTP fallbacks.
|
||||||
core.link_option("-lws2_32");
|
core.link_option("-lws2_32");
|
||||||
}
|
}
|
||||||
@@ -92,7 +109,7 @@ void build(Void::Build::Project &project) {
|
|||||||
BuildSupport::compiler_warnings(cli, ctx);
|
BuildSupport::compiler_warnings(cli, ctx);
|
||||||
|
|
||||||
// The registry service is POSIX-only until its Track C3 Windows port lands.
|
// The registry service is POSIX-only until its Track C3 Windows port lands.
|
||||||
if (ctx.os != "Windows") {
|
if (!targets_windows(ctx)) {
|
||||||
auto registry_lib = project.static_library("VoidBuildRegistry");
|
auto registry_lib = project.static_library("VoidBuildRegistry");
|
||||||
registry_lib.cxx_standard(Void::Build::CxxStandard::Cxx26)
|
registry_lib.cxx_standard(Void::Build::CxxStandard::Cxx26)
|
||||||
.sources(project.glob("registry/service/*.cpp"))
|
.sources(project.glob("registry/service/*.cpp"))
|
||||||
|
|||||||
+19
-3
@@ -2552,6 +2552,8 @@ struct InstallCmdOptions {
|
|||||||
std::optional<std::string> build_arg;
|
std::optional<std::string> build_arg;
|
||||||
std::string profile_name{"debug"};
|
std::string profile_name{"debug"};
|
||||||
std::optional<std::string> compiler_arg;
|
std::optional<std::string> compiler_arg;
|
||||||
|
std::optional<std::string> target_os_arg;
|
||||||
|
std::optional<std::string> target_arch_arg;
|
||||||
std::optional<std::string> prefix_arg;
|
std::optional<std::string> prefix_arg;
|
||||||
std::optional<std::string> pkg_name_arg;
|
std::optional<std::string> pkg_name_arg;
|
||||||
std::string pkg_ver{"0.1.0"};
|
std::string pkg_ver{"0.1.0"};
|
||||||
@@ -2636,8 +2638,9 @@ int execute_install_command(const InstallCmdOptions &opts) {
|
|||||||
}
|
}
|
||||||
ProfileContext ctx;
|
ProfileContext ctx;
|
||||||
try {
|
try {
|
||||||
ctx = profs->resolve(opts.profile_name, compiler_override, Toolchain::host_os_name(),
|
ctx = profs->resolve(opts.profile_name, compiler_override,
|
||||||
Toolchain::host_architecture_name());
|
opts.target_os_arg.value_or(Toolchain::host_os_name()),
|
||||||
|
opts.target_arch_arg.value_or(Toolchain::host_architecture_name()));
|
||||||
} catch (const std::exception &ex) {
|
} catch (const std::exception &ex) {
|
||||||
std::cerr << "vbs install: " << ex.what() << '\n';
|
std::cerr << "vbs install: " << ex.what() << '\n';
|
||||||
return 2;
|
return 2;
|
||||||
@@ -2757,7 +2760,16 @@ int execute_install_command(const InstallCmdOptions &opts) {
|
|||||||
std::cerr << "vbs install: " << graph.error().message() << '\n';
|
std::cerr << "vbs install: " << graph.error().message() << '\n';
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
auto exec = Execution::execute_graph(*graph, *state);
|
// Only the targets that are actually installed (plus their dependencies)
|
||||||
|
// need to be built: test executables and tools without install rules are
|
||||||
|
// not part of the package.
|
||||||
|
Execution::ExecutionOptions eopts;
|
||||||
|
for (const auto &target : desc->targets) {
|
||||||
|
if (target.install_rule) {
|
||||||
|
eopts.selected_targets.push_back(target.name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
auto exec = Execution::execute_graph(*graph, *state, eopts);
|
||||||
if (!exec || !exec->succeeded) {
|
if (!exec || !exec->succeeded) {
|
||||||
std::cerr << "vbs install: build failed before staging\n";
|
std::cerr << "vbs install: build failed before staging\n";
|
||||||
if (!exec) {
|
if (!exec) {
|
||||||
@@ -3890,6 +3902,10 @@ int main(int argc, char **argv) {
|
|||||||
.option("--build-dir", "-B", "Build output directory", install_opts.build_arg)
|
.option("--build-dir", "-B", "Build output directory", install_opts.build_arg)
|
||||||
.option_default("--profile", "-p", "Profile name", install_opts.profile_name, "debug")
|
.option_default("--profile", "-p", "Profile name", install_opts.profile_name, "debug")
|
||||||
.option("--compiler", "", "Override compiler family (gcc|clang)", install_opts.compiler_arg)
|
.option("--compiler", "", "Override compiler family (gcc|clang)", install_opts.compiler_arg)
|
||||||
|
.option("--target-os", "", "Target operating system (default: host, e.g. windows)",
|
||||||
|
install_opts.target_os_arg)
|
||||||
|
.option("--target-arch", "", "Target architecture (default: host, e.g. x86_64)",
|
||||||
|
install_opts.target_arch_arg)
|
||||||
.option("--prefix", "", "Install destination prefix (required)", install_opts.prefix_arg)
|
.option("--prefix", "", "Install destination prefix (required)", install_opts.prefix_arg)
|
||||||
.option("--package-name", "", "Exported package name", install_opts.pkg_name_arg)
|
.option("--package-name", "", "Exported package name", install_opts.pkg_name_arg)
|
||||||
.option_default("--package-version", "", "Exported package version", install_opts.pkg_ver,
|
.option_default("--package-version", "", "Exported package version", install_opts.pkg_ver,
|
||||||
|
|||||||
Reference in new issue
Block a user