mirror of
https://github.com/vlang/v.git
synced 2025-09-18 11:56:57 -04:00
v.builder: support injected options with newlines, coming from #flag
directives, when -no-rsp
is used
This commit is contained in:
parent
75658415f1
commit
c16cde7b83
@ -657,7 +657,11 @@ pub fn (mut v Builder) cc() {
|
|||||||
//
|
//
|
||||||
all_args := v.all_args(v.ccoptions)
|
all_args := v.all_args(v.ccoptions)
|
||||||
v.dump_c_options(all_args)
|
v.dump_c_options(all_args)
|
||||||
str_args := all_args.join(' ')
|
str_args := if v.pref.no_rsp {
|
||||||
|
all_args.join(' ').replace('\n', ' ')
|
||||||
|
} else {
|
||||||
|
all_args.join(' ')
|
||||||
|
}
|
||||||
mut cmd := '${v.quote_compiler_name(ccompiler)} ${str_args}'
|
mut cmd := '${v.quote_compiler_name(ccompiler)} ${str_args}'
|
||||||
mut response_file := ''
|
mut response_file := ''
|
||||||
mut response_file_content := str_args
|
mut response_file_content := str_args
|
||||||
@ -666,21 +670,13 @@ pub fn (mut v Builder) cc() {
|
|||||||
response_file_content = str_args.replace('\\', '\\\\')
|
response_file_content = str_args.replace('\\', '\\\\')
|
||||||
rspexpr := '@${response_file}'
|
rspexpr := '@${response_file}'
|
||||||
cmd = '${v.quote_compiler_name(ccompiler)} ${os.quoted_path(rspexpr)}'
|
cmd = '${v.quote_compiler_name(ccompiler)} ${os.quoted_path(rspexpr)}'
|
||||||
$if windows {
|
write_response_file(response_file, response_file_content)
|
||||||
os.write_file_array(response_file, string_to_ansi_not_null_terminated(response_file_content)) or {
|
if !v.ccoptions.debug_mode {
|
||||||
verror('Unable to write to C response file "${response_file}"')
|
v.pref.cleanup_files << response_file
|
||||||
}
|
|
||||||
} $else {
|
|
||||||
os.write_file(response_file, response_file_content) or {
|
|
||||||
verror('Unable to write to C response file "${response_file}"')
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !v.ccoptions.debug_mode {
|
if !v.ccoptions.debug_mode {
|
||||||
v.pref.cleanup_files << v.out_name_c
|
v.pref.cleanup_files << v.out_name_c
|
||||||
if !v.pref.no_rsp {
|
|
||||||
v.pref.cleanup_files << response_file
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
$if windows {
|
$if windows {
|
||||||
if v.ccoptions.cc == .tcc {
|
if v.ccoptions.cc == .tcc {
|
||||||
@ -1177,3 +1173,19 @@ pub fn (mut v Builder) quote_compiler_name(name string) string {
|
|||||||
}
|
}
|
||||||
return os.quoted_path(name)
|
return os.quoted_path(name)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn write_response_file(response_file string, response_file_content string) {
|
||||||
|
$if windows {
|
||||||
|
os.write_file_array(response_file, string_to_ansi_not_null_terminated(response_file_content)) or {
|
||||||
|
write_response_file_error(response_file_content, err)
|
||||||
|
}
|
||||||
|
} $else {
|
||||||
|
os.write_file(response_file, response_file_content) or {
|
||||||
|
write_response_file_error(response_file_content, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn write_response_file_error(response_file string, err IError) {
|
||||||
|
verror('Unable to write to C response file "${response_file}", error: ${err}')
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user