mirror of
https://github.com/vlang/v.git
synced 2025-09-14 15:02:33 +03:00
compiler: cache modules
This commit is contained in:
parent
f45d3f07ed
commit
52f4f4026b
10 changed files with 422 additions and 242 deletions
|
@ -6,6 +6,10 @@ module main
|
|||
|
||||
import os
|
||||
|
||||
const (
|
||||
v_modules_path = os.home_dir() + '/.vmodules/'
|
||||
)
|
||||
|
||||
// add a module and its deps (module speficic dag method)
|
||||
pub fn(graph mut DepGraph) from_import_tables(import_tables map[string]FileImportTable) {
|
||||
for _, fit in import_tables {
|
||||
|
@ -21,14 +25,20 @@ pub fn(graph mut DepGraph) from_import_tables(import_tables map[string]FileImpor
|
|||
pub fn(graph &DepGraph) imports() []string {
|
||||
mut mods := []string
|
||||
for node in graph.nodes {
|
||||
if node.name == 'main' {
|
||||
continue
|
||||
}
|
||||
mods << node.name
|
||||
}
|
||||
return mods
|
||||
}
|
||||
|
||||
fn (v &V) module_path(mod string) string {
|
||||
// submodule support
|
||||
if mod.contains('.') {
|
||||
//return mod.replace('.', os.PathSeparator)
|
||||
return mod.replace('.', '/')
|
||||
}
|
||||
return mod
|
||||
}
|
||||
|
||||
// 'strings' => 'VROOT/vlib/strings'
|
||||
// 'installed_mod' => '~/.vmodules/installed_mod'
|
||||
// 'local_mod' => '/path/to/current/dir/local_mod'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue