mirror of
https://github.com/vlang/v.git
synced 2025-09-13 22:42:26 +03:00
tools: fix already installed detection when running v install --once without args (#19838)
This commit is contained in:
parent
e1312d053a
commit
744b92a844
2 changed files with 6 additions and 2 deletions
|
@ -49,14 +49,17 @@ fn test_install_dependencies_in_module_dir() {
|
||||||
}
|
}
|
||||||
assert v_mod.dependencies == ['markdown', 'pcre', 'https://github.com/spytheman/vtray']
|
assert v_mod.dependencies == ['markdown', 'pcre', 'https://github.com/spytheman/vtray']
|
||||||
// Run `v install`
|
// Run `v install`
|
||||||
res := os.execute_or_exit('${v} install')
|
mut res := os.execute_or_exit('${v} install --once')
|
||||||
assert res.output.contains('Detected v.mod file inside the project directory. Using it...'), res.output
|
assert res.output.contains('Detected v.mod file inside the project directory. Using it...'), res.output
|
||||||
assert res.output.contains('Installing `markdown`'), res.output
|
assert res.output.contains('Installing `markdown`'), res.output
|
||||||
assert res.output.contains('Installing `pcre`'), res.output
|
assert res.output.contains('Installing `pcre`'), res.output
|
||||||
assert res.output.contains('Installing `vtray`'), res.output
|
assert res.output.contains('Installing `vtray`'), res.output
|
||||||
|
|
||||||
assert get_mod_name(os.join_path(test_path, 'markdown', 'v.mod')) == 'markdown'
|
assert get_mod_name(os.join_path(test_path, 'markdown', 'v.mod')) == 'markdown'
|
||||||
assert get_mod_name(os.join_path(test_path, 'pcre', 'v.mod')) == 'pcre'
|
assert get_mod_name(os.join_path(test_path, 'pcre', 'v.mod')) == 'pcre'
|
||||||
assert get_mod_name(os.join_path(test_path, 'vtray', 'v.mod')) == 'vtray'
|
assert get_mod_name(os.join_path(test_path, 'vtray', 'v.mod')) == 'vtray'
|
||||||
|
res = os.execute_or_exit('${v} install --once')
|
||||||
|
assert res.output.contains('All modules are already installed.'), res.output
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_resolve_external_dependencies_during_module_install() {
|
fn test_resolve_external_dependencies_during_module_install() {
|
||||||
|
|
|
@ -43,6 +43,7 @@ fn vpm_install(query []string) {
|
||||||
vpm_log(@FILE_LINE, @FN, 'Installed modules: ${installed_modules}')
|
vpm_log(@FILE_LINE, @FN, 'Installed modules: ${installed_modules}')
|
||||||
|
|
||||||
if installed_modules.len > 0 && settings.is_once {
|
if installed_modules.len > 0 && settings.is_once {
|
||||||
|
num_to_install := vpm_modules.len + external_modules.len
|
||||||
mut already_installed := []string{}
|
mut already_installed := []string{}
|
||||||
if external_modules.len > 0 {
|
if external_modules.len > 0 {
|
||||||
mut i_deleted := []int{}
|
mut i_deleted := []int{}
|
||||||
|
@ -70,7 +71,7 @@ fn vpm_install(query []string) {
|
||||||
}
|
}
|
||||||
if already_installed.len > 0 {
|
if already_installed.len > 0 {
|
||||||
verbose_println('Already installed modules: ${already_installed}')
|
verbose_println('Already installed modules: ${already_installed}')
|
||||||
if already_installed.len == query.len {
|
if already_installed.len == num_to_install {
|
||||||
println('All modules are already installed.')
|
println('All modules are already installed.')
|
||||||
exit(0)
|
exit(0)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue