Skip to content

Engine → Scripting → managed_build.h

managed_build_runner

Syntax

class CONJURE_API managed_build_runner

Constructors

AccessSignatureDescription
publicmanaged_build_runner( core::jobs::job_system *jobs = nullptr);jobs runs the build off the main thread; nullptr runs it inline inside build() (the report is still posted to the main-thread queue so callers behave the same either way).

Important

Copy constructor and assignment has been deleted.

Destructors

AccessSignatureDescription
public~managed_build_runner();

Variables

AccessNameTypeDefaultDescription
privatemBuildCountu320
privatemDotnetExecutablestd::string"dotnet"
privatemJobcore::jobs::job_handle{}
privatemJobscore::jobs::job_system *nullptr
privatemStatestd::shared_ptr<shared_state>std::make_shared<shared_state>()

Functions

Public

build

void build(
    const std::filesystem::path &projectPath,
    std::string_view configuration,
    std::function<void(const build_report &)> onComplete);

Spawns dotnet build <project> -c <configuration> on a job; onComplete runs on the main thread at the next drain_main_thread_queue(). Asserts and ignores the call while a build runs.

void build(
    const build_request &request,
    std::function<void(const build_report &)> onComplete);

Same with every option of build_request.

build_count

[[nodiscard]] u32 build_count() const noexcept;

Builds issued so far.

command_line

[[nodiscard]] static core::process_desc command_line(
    const build_request &request,
    std::string_view dotnet);

The process description a request turns into: dotnet build <project> -c <configuration> [-o <output>] --nologo -clp:NoSummary [-p:Name=Value...], run in build_request::workingDirectory. Paths are passed as UTF-8; the output directory and every property value go through msbuild_escape(). It never adds ContinuousIntegrationBuild, so the debug information keeps the real source paths and the built scripts can be debugged; a caller that wants it passes it in build_request::properties.

dotnet_executable

[[nodiscard]] const std::string &dotnet_executable() const noexcept;

is_building

[[nodiscard]] bool is_building() const noexcept;

parse_output

[[nodiscard]] static std::vector<build_diagnostic> parse_output(
    std::string_view msbuildOutput);

Parses MSBuild output: file(line,col): error CS1002: message and the warning form; other lines are ignored. Paths with spaces and project suffixes [Game.csproj] are handled.

run_blocking

[[nodiscard]] static build_report run_blocking(
    const build_request &request,
    std::string_view dotnet);

Runs a request to completion on the calling thread.

set_dotnet_executable

void set_dotnet_executable(
    std::string executable);

The dotnet program to spawn ("dotnet" from PATH by default).

wait

void wait();

Blocks until the running build (if any) finished; the report is then in the main-thread queue.