1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

native: support passing a directory, instead of just a .v file (#12512)

This commit is contained in:
pancake 2021-11-19 09:30:46 +01:00 committed by GitHub
parent 76cf11e6b5
commit 9eac656e55
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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')