Skip to content

v.builder #

Constants #

const no_compiler_error = '
Error: no C compiler detected.

You can find instructions on how to install one in the V wiki:

If you think you have one installed, make sure it is in your PATH.
If you do have one in your PATH, please raise an issue on GitHub:

You can also use `v doctor`, to see what V knows about your current environment.

You can also seek #help on Discord:

fn compile #

fn compile(command string, pref &pref.Preferences, backend_cb FnBackend)

fn module_path #

fn module_path(mod string) string

fn msvc_string_flags #

fn msvc_string_flags(cflags []cflag.CFlag) MsvcStringFlags

pub fn (cflags []CFlag) msvc_string_flags() MsvcStringFlags {

fn new_builder #

fn new_builder(pref &pref.Preferences) Builder

fn verror #

fn verror(s string)

type FnBackend #

type FnBackend = fn (mut b Builder)

struct Builder #

struct Builder {
	compiled_dir string // contains os.real_path() of the dir of the final file beeing compiled, or the dir itself when doing `v .`
	module_path  string
pub mut:
	checker             &checker.Checker
	transformer         &transformer.Transformer
	out_name_c          string
	out_name_js         string
	stats_lines         int // size of backend generated source code in lines
	stats_bytes         int // size of backend generated source code in bytes
	nr_errors           int // accumulated error count of scanner, parser, checker, and builder
	nr_warnings         int // accumulated warning count of scanner, parser, checker, and builder
	nr_notices          int // accumulated notice count of scanner, parser, checker, and builder
	pref                &pref.Preferences
	module_search_paths []string
	parsed_files        []&ast.File
	cached_msvc         MsvcResult
	table               &ast.Table
	ccoptions           CcompilerOptions
// Note: changes in mod `builtin` force invalidation of every other .v file
	mod_invalidates_paths map[string][]string // changes in mod `os`, invalidate only .v files, that do `import os`
	mod_invalidates_mods  map[string][]string // changes in mod `os`, force invalidation of mods, that do `import os`
	path_invalidates_mods map[string][]string // changes in a .v file from `os`, invalidates `os`

fn (Builder) cc #

fn (mut v Builder) cc()

fn (Builder) cc_msvc #

fn (mut v Builder) cc_msvc()

fn (Builder) dump_c_options #

fn (b &Builder) dump_c_options(all_args []string)

fn (Builder) dump_files #

fn (b &Builder) dump_files(files []string)

fn (Builder) dump_modules #

fn (b &Builder) dump_modules(mods []string)

fn (Builder) error_with_pos #

fn (b &Builder) error_with_pos(s string, fpath string, pos token.Pos) errors.Error

fn (Builder) find_module_path #

fn (b &Builder) find_module_path(mod string, fpath string) ?string

TODO: try to merge this & util.module functions to create a reliable multi use function. see comments in util/module.v

fn (Builder) find_win_cc #

fn (mut v Builder) find_win_cc() ?

fn (Builder) front_and_middle_stages #

fn (mut b Builder) front_and_middle_stages(v_files []string) ?

fn (Builder) front_stages #

fn (mut b Builder) front_stages(v_files []string) ?

fn (Builder) get_builtin_files #

fn (v Builder) get_builtin_files() []string

fn (Builder) get_user_files #

fn (v &Builder) get_user_files() []string

fn (Builder) get_vtmp_filename #

fn (mut b Builder) get_vtmp_filename(base_file_name string, postfix string) string

fn (Builder) import_graph #

fn (b &Builder) import_graph() &depgraph.DepGraph

graph of all imported modules

fn (Builder) info #

fn (b Builder) info(s string)

fn (Builder) log #

fn (b Builder) log(s string)

fn (Builder) middle_stages #

fn (mut b Builder) middle_stages() ?

fn (Builder) parse_imports #

fn (mut b Builder) parse_imports()

parse all deps from already parsed files

fn (Builder) print_warnings_and_errors #

fn (mut b Builder) print_warnings_and_errors()

fn (Builder) rebuild_modules #

fn (mut b Builder) rebuild_modules()

fn (Builder) resolve_deps #

fn (mut b Builder) resolve_deps()

fn (Builder) set_module_lookup_paths #

fn (mut v Builder) set_module_lookup_paths()

'strings' => 'VROOT/vlib/strings' 'installed_mod' => '~/.vmodules/installed_mod' 'local_mod' => '/path/to/current/dir/local_mod'

fn (Builder) show_total_warns_and_errors_stats #

fn (b &Builder) show_total_warns_and_errors_stats()

fn (Builder) v_files_from_dir #

fn (b Builder) v_files_from_dir(dir string) []string