builder: make builtin, strconv, os work with `v build-module`

pull/5825/head
Alexander Medvednikov 2020-07-14 18:27:11 +02:00
parent 5ad957f270
commit 60ce938149
2 changed files with 12 additions and 3 deletions

View File

@ -168,6 +168,11 @@ jobs:
run: ./v -o vprod -prod cmd/v && ./vprod test-fixed run: ./v -o vprod -prod cmd/v && ./vprod test-fixed
- name: Build examples - name: Build examples
run: ./v build-examples run: ./v build-examples
- name: Build modules
run: |
./v build-module vlib/os
./v build-module vlib/builtin
./v build-module vlib/strconv
- name: x64 machine code generation - name: x64 machine code generation
run: | run: |
exit exit

View File

@ -127,13 +127,16 @@ fn (mut v Builder) set_module_lookup_paths() {
} }
pub fn (v Builder) get_builtin_files() []string { pub fn (v Builder) get_builtin_files() []string {
if v.pref.build_mode == .build_module && v.pref.path == 'vlib/builtin' { // .contains('builtin/' + location { /*
// if v.pref.build_mode == .build_module && v.pref.path == 'vlib/builtin' { // .contains('builtin/' + location {
if v.pref.build_mode == .build_module && v.pref.path == 'vlib/strconv' { // .contains('builtin/' + location {
// We are already building builtin.o, no need to import them again // We are already building builtin.o, no need to import them again
if v.pref.is_verbose { if v.pref.is_verbose {
println('skipping builtin modules for builtin.o') println('skipping builtin modules for builtin.o')
} }
return [] return []
} }
*/
// println('get_builtin_files() lookuppath:') // println('get_builtin_files() lookuppath:')
// println(v.pref.lookup_path) // println(v.pref.lookup_path)
// Lookup for built-in folder in lookup path. // Lookup for built-in folder in lookup path.
@ -163,9 +166,10 @@ Did you forget to add vlib to the path? (Use @vlib for default vlib)')
panic('Unreachable code reached.') panic('Unreachable code reached.')
} }
pub fn (v Builder) get_user_files() []string { pub fn (v &Builder) get_user_files() []string {
if v.pref.path == 'vlib/builtin' { if v.pref.path in ['vlib/builtin', 'vlib/strconv'] {
// get_builtin_files() has already added the builtin files: // get_builtin_files() has already added the builtin files:
v.log('Skipping user files.')
return [] return []
} }
mut dir := v.pref.path mut dir := v.pref.path