From dd24e8a63ee8872280682e01ecc777dfba074423 Mon Sep 17 00:00:00 2001 From: Artem Yurchenko Date: Sun, 25 Jun 2023 21:31:39 +0200 Subject: [PATCH] vpm: fix installation of mixed modules (#18545) --- cmd/tools/vpm.v | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/cmd/tools/vpm.v b/cmd/tools/vpm.v index 5b195016a0..57110d2e43 100644 --- a/cmd/tools/vpm.v +++ b/cmd/tools/vpm.v @@ -88,24 +88,31 @@ fn main() { manifest := vmod.from_file('./v.mod') or { panic(err) } module_names = manifest.dependencies.clone() } - mut source := Source.vpm - if module_names.all(it.starts_with('https://')) { - source = Source.git - } + if '--once' in options { module_names = vpm_once_filter(module_names) + if module_names.len == 0 { return } } - if '--git' in options { - source = Source.git - } - if '--hg' in options { - source = Source.hg + + external_module_names := module_names.filter(it.starts_with('https://')) + vpm_module_names := module_names.filter(it !in external_module_names) + + if vpm_module_names.len > 0 { + vpm_install(vpm_module_names, Source.vpm) } - vpm_install(module_names, source) + if external_module_names.len > 0 { + mut external_source := Source.git + + if '--hg' in options { + external_source = Source.hg + } + + vpm_install(external_module_names, external_source) + } } 'update' { vpm_update(module_names)