From 60ce938149c66ac5fb314db86ecab5b2c4c70994 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Tue, 14 Jul 2020 18:27:11 +0200 Subject: [PATCH] builder: make builtin, strconv, os work with `v build-module` --- .github/workflows/ci.yml | 5 +++++ vlib/v/builder/compile.v | 10 +++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 706e3687d9..cc2a392d94 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -168,6 +168,11 @@ jobs: run: ./v -o vprod -prod cmd/v && ./vprod test-fixed - name: 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 run: | exit diff --git a/vlib/v/builder/compile.v b/vlib/v/builder/compile.v index dac716be64..8edf129306 100644 --- a/vlib/v/builder/compile.v +++ b/vlib/v/builder/compile.v @@ -127,13 +127,16 @@ fn (mut v Builder) set_module_lookup_paths() { } 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 if v.pref.is_verbose { println('skipping builtin modules for builtin.o') } return [] } + */ // println('get_builtin_files() lookuppath:') // println(v.pref.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.') } -pub fn (v Builder) get_user_files() []string { - if v.pref.path == 'vlib/builtin' { +pub fn (v &Builder) get_user_files() []string { + if v.pref.path in ['vlib/builtin', 'vlib/strconv'] { // get_builtin_files() has already added the builtin files: + v.log('Skipping user files.') return [] } mut dir := v.pref.path