mirror of
https://github.com/vlang/v.git
synced 2025-09-17 11:26:17 -04:00
v.builder: fix compiling code, that imports modules from both src/modules
and modules
(#19437)
This commit is contained in:
parent
e7aa6a1870
commit
07bd94fa14
@ -214,11 +214,14 @@ pub fn (mut v Builder) set_module_lookup_paths() {
|
|||||||
if v.pref.is_verbose {
|
if v.pref.is_verbose {
|
||||||
println('x: "${x}"')
|
println('x: "${x}"')
|
||||||
}
|
}
|
||||||
|
|
||||||
if os.exists(os.join_path(v.compiled_dir, 'src/modules')) {
|
if os.exists(os.join_path(v.compiled_dir, 'src/modules')) {
|
||||||
v.module_search_paths << os.join_path(v.compiled_dir, 'src/modules')
|
v.module_search_paths << os.join_path(v.compiled_dir, 'src/modules')
|
||||||
} else {
|
}
|
||||||
|
if os.exists(os.join_path(v.compiled_dir, 'modules')) {
|
||||||
v.module_search_paths << os.join_path(v.compiled_dir, 'modules')
|
v.module_search_paths << os.join_path(v.compiled_dir, 'modules')
|
||||||
}
|
}
|
||||||
|
|
||||||
v.module_search_paths << v.pref.lookup_path
|
v.module_search_paths << v.pref.lookup_path
|
||||||
if v.pref.is_verbose {
|
if v.pref.is_verbose {
|
||||||
v.log('v.module_search_paths:')
|
v.log('v.module_search_paths:')
|
||||||
|
@ -27,5 +27,5 @@ fn test_projects_should_run() {
|
|||||||
assert res.trim_space() == 'v0'
|
assert res.trim_space() == 'v0'
|
||||||
|
|
||||||
res2 := vrun_ok('run', vroot_path('vlib/v/tests/testdata/modules_in_src/'))
|
res2 := vrun_ok('run', vroot_path('vlib/v/tests/testdata/modules_in_src/'))
|
||||||
assert res2.trim_space() == 'somemodule'
|
assert res2.trim_space() == 'somemodule somemoduletwo'
|
||||||
}
|
}
|
||||||
|
7
vlib/v/tests/testdata/modules_in_src/modules/somemoduletwo/somemoduletwo.v
vendored
Normal file
7
vlib/v/tests/testdata/modules_in_src/modules/somemoduletwo/somemoduletwo.v
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
module somemoduletwo
|
||||||
|
|
||||||
|
const name = 'somemoduletwo'
|
||||||
|
|
||||||
|
pub fn name() string {
|
||||||
|
return somemoduletwo.name
|
||||||
|
}
|
@ -1,7 +1,8 @@
|
|||||||
module main
|
module main
|
||||||
|
|
||||||
import somemodule
|
import somemodule
|
||||||
|
import somemoduletwo
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
println(somemodule.name())
|
println('${somemodule.name()} ${somemoduletwo.name()}')
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user