v.driver #
Helpers for generated C, native source files, and compiler arguments. Header contents and preprocessor output must never be passed here.
Constants #
const project_backend_flag = '-v3-internal-project-backend'
project_backend_flag precedes the -b that the launcher adds for the backend of a project's v.mod. Such a backend is the project's default: unlike a -b on the command line, it does not ask for the generated C to be kept next to the output.
fn is_generated_source #
fn is_generated_source(path string) bool
is_generated_source reports whether path is the temporary source that the compiler writes for -e code or standard input. Such a source belongs to no project, so the launcher does not apply the backend of the v.mod in the folder that holds it. Recognizing the name, instead of marking the child command line, keeps the command that a .vvmrc forwards to another compiler version unchanged.
fn run #
fn run(args []string)
run executes the V3 compiler driver with args. run compiles the input selected by args using the requested backend and flags.
fn vtest_build_environment #
fn vtest_build_environment(vroot string, args []string) TestBuildEnvironment
vtest_build_environment resolves the facts and defines of the compilation that the compiler options args describe (-os, -arch, -cc, -prod, -race, -d, ...), the way run resolves them for v <args> file_test.v. A test runner started with those options exports the result through pref.set_build_flags_and_defines, so that its // vtest build: decisions match the compiler's own.
struct TestBuildEnvironment #
struct TestBuildEnvironment {
pub:
facts []string
defines []string
}
TestBuildEnvironment is what a // vtest build: expression is evaluated against: the facts of a compilation (its OS, architecture, C compiler kind, prod, the CI job) and the defines it sets.