Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tools: fix already installed detection when running v install --once without args #19838

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion cmd/tools/vpm/dependency_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,17 @@ fn test_install_dependencies_in_module_dir() {
}
assert v_mod.dependencies == ['markdown', 'pcre', 'https://github.com/spytheman/vtray']
// 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('Installing `markdown`'), res.output
assert res.output.contains('Installing `pcre`'), 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, 'pcre', 'v.mod')) == 'pcre'
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() {
Expand Down
3 changes: 2 additions & 1 deletion cmd/tools/vpm/install.v
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ fn vpm_install(query []string) {
vpm_log(@FILE_LINE, @FN, 'Installed modules: ${installed_modules}')

if installed_modules.len > 0 && settings.is_once {
num_to_install := vpm_modules.len + external_modules.len
mut already_installed := []string{}
if external_modules.len > 0 {
mut i_deleted := []int{}
Expand Down Expand Up @@ -70,7 +71,7 @@ fn vpm_install(query []string) {
}
if already_installed.len > 0 {
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.')
exit(0)
}
Expand Down