mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
tools: support v should-compile-all folder/
, where folder/
contains project subfolders (containing v.mod files and multiple top level .v files)
This commit is contained in:
parent
2112bb82eb
commit
8902f7dda0
1 changed files with 21 additions and 0 deletions
|
@ -33,12 +33,21 @@ fn main() {
|
|||
}
|
||||
mut executables := []string{}
|
||||
mut failed_commands := []string{}
|
||||
mut project_folders := map[string]bool{}
|
||||
for idx, example in files {
|
||||
folder_of_example := os.dir(example)
|
||||
if os.is_file(os.join_path_single(folder_of_example, '.skip_should_compile_all')) {
|
||||
log.info('>>> skipping file: ${example}, because a `.skip_should_compile_all` file is present next to it.')
|
||||
continue
|
||||
}
|
||||
if project_folders[folder_of_example] {
|
||||
continue
|
||||
}
|
||||
if os.is_file(os.join_path_single(folder_of_example, 'v.mod')) {
|
||||
log.info('>>> delaying compilation of entire project folder ${folder_of_example} ...')
|
||||
project_folders[folder_of_example] = true
|
||||
continue
|
||||
}
|
||||
cmd := '${os.quoted_path(@VEXE)} ${os.quoted_path(example)}'
|
||||
log.info('> compiling ${idx + 1:4}/${files.len:-4}: ${cmd}')
|
||||
if 0 != os.system(cmd) {
|
||||
|
@ -47,6 +56,18 @@ fn main() {
|
|||
executables << executable_name(example)
|
||||
}
|
||||
}
|
||||
mut pfi := 0
|
||||
for pf, _ in project_folders {
|
||||
exe_path := os.join_path(pf, os.file_name(pf) + exe_extension)
|
||||
cmd := '${os.quoted_path(@VEXE)} -o ${exe_path} ${pf}'
|
||||
log.info('> compiling project ${pfi + 1:4}/${project_folders.len:-4}: ${cmd}')
|
||||
if 0 != os.system(cmd) {
|
||||
failed_commands << cmd
|
||||
} else {
|
||||
executables << exe_path
|
||||
}
|
||||
pfi++
|
||||
}
|
||||
if should_clean {
|
||||
log.info('Removing ${executables.len} successfully build executables...')
|
||||
for f in executables {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue