native: support passing a directory, instead of just a .v file (#12512)
parent
76cf11e6b5
commit
9eac656e55
|
@ -3,6 +3,7 @@ module builder
|
|||
import v.pref
|
||||
import v.util
|
||||
import v.gen.native
|
||||
import os
|
||||
|
||||
pub fn (mut b Builder) build_native(v_files []string, out_file string) {
|
||||
if b.pref.os == .windows {
|
||||
|
@ -10,7 +11,15 @@ pub fn (mut b Builder) build_native(v_files []string, out_file string) {
|
|||
} else if b.pref.os !in [.linux, .macos] {
|
||||
eprintln('Warning: v -native can only generate macOS and Linux binaries for now')
|
||||
}
|
||||
b.front_and_middle_stages(v_files) or { return }
|
||||
mut nvf := []string{}
|
||||
for vf in v_files {
|
||||
if os.is_dir(vf) {
|
||||
nvf << b.v_files_from_dir(vf)
|
||||
} else {
|
||||
nvf << vf
|
||||
}
|
||||
}
|
||||
b.front_and_middle_stages(nvf) or { return }
|
||||
util.timing_start('Native GEN')
|
||||
b.stats_lines, b.stats_bytes = native.gen(b.parsed_files, b.table, out_file, b.pref)
|
||||
util.timing_measure('Native GEN')
|
||||
|
|
Loading…
Reference in New Issue