tools,v.doc: move vlib/v/doc/ to cmd/tools/vdoc/doc/ to reduce the runtime of the CI runs, when v doc is changed (#23483)

This commit is contained in:
Delyan Angelov 2025-01-16 14:40:28 +02:00 committed by GitHub
parent c6809844bd
commit 40b574b409
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 29 additions and 29 deletions

View File

@ -188,7 +188,7 @@ tests in the main V repository, for example:
> [!NOTE] > [!NOTE]
The VDOC test vdoc_file_test.v now also supports VAUTOFIX, which is The VDOC test vdoc_file_test.v now also supports VAUTOFIX, which is
useful, if you change anything inside cmd/tools/vdoc or vlib/v/doc/, useful, if you change anything inside cmd/tools/vdoc,
or inside the modules that it depends on (like markdown). or inside the modules that it depends on (like markdown).
After such changes, just run this command *2 times*, and commit the After such changes, just run this command *2 times*, and commit the
resulting changes in `cmd/tools/vdoc/testdata` as well: resulting changes in `cmd/tools/vdoc/testdata` as well:

View File

@ -536,28 +536,28 @@ pub fn generate(input_path string, pub_only bool, with_comments bool, platform P
if platform == .js { if platform == .js {
return error('vdoc: Platform `${platform}` is not supported.') return error('vdoc: Platform `${platform}` is not supported.')
} }
mut doc := new(input_path) mut d := new(input_path)
doc.pub_only = pub_only d.pub_only = pub_only
doc.with_comments = with_comments d.with_comments = with_comments
doc.filter_symbol_names = filter_symbol_names.filter(it.len != 0) d.filter_symbol_names = filter_symbol_names.filter(it.len != 0)
doc.prefs.os = if platform == .auto { d.prefs.os = if platform == .auto {
pref.get_host_os() pref.get_host_os()
} else { } else {
unsafe { pref.OS(int(platform)) } unsafe { pref.OS(int(platform)) }
} }
doc.generate()! d.generate()!
return doc return d
} }
// generate_with_pos has the same function as the `generate` function but // generate_with_pos has the same function as the `generate` function but
// accepts an offset-based position and enables the comments by default. // accepts an offset-based position and enables the comments by default.
pub fn generate_with_pos(input_path string, filename string, pos int) !Doc { pub fn generate_with_pos(input_path string, filename string, pos int) !Doc {
mut doc := new(input_path) mut d := new(input_path)
doc.pub_only = false d.pub_only = false
doc.with_comments = true d.with_comments = true
doc.with_pos = true d.with_pos = true
doc.filename = filename d.filename = filename
doc.pos = pos d.pos = pos
doc.generate()! d.generate()!
return doc return d
} }

View File

@ -43,5 +43,5 @@ fn test_get_parent_mod_normal_cases() {
assert get_parent_mod(os.join_path(@VMODROOT, 'vlib', 'os', 'os.v'))? == 'os' assert get_parent_mod(os.join_path(@VMODROOT, 'vlib', 'os', 'os.v'))? == 'os'
assert get_parent_mod(os.join_path(@VMODROOT, 'cmd'))? == '' assert get_parent_mod(os.join_path(@VMODROOT, 'cmd'))? == ''
assert get_parent_mod(os.join_path(@VMODROOT, 'cmd', 'tools', 'modules', 'testing', assert get_parent_mod(os.join_path(@VMODROOT, 'cmd', 'tools', 'modules', 'testing',
'common.v'))? == 'testing' 'common.v'))? == 'tools.modules.testing'
} }

View File

@ -1,5 +1,5 @@
// import v.ast // import v.ast
import v.doc import doc
// fn test_generate_with_pos() {} // fn test_generate_with_pos() {}
// fn test_generate() {} // fn test_generate() {}

View File

@ -107,7 +107,7 @@ pub fn merge_doc_comments(comments []DocComment) string {
for key in highlight_keys { for key in highlight_keys {
if ll.starts_with(key) { if ll.starts_with(key) {
comment += '\n\n${key.title()}${l[key.len..]}' comment += '\n\n${key.title()}${l[key.len..]}'
// Workaround for compiling with `v -cstrict -cc gcc vlib/v/doc/doc_test.v` // Workaround for compiling with `v -cstrict -cc gcc cmd/tools/vdoc/doc/doc_test.v`
// and using multiple continue `<label>`. // and using multiple continue `<label>`.
continue_line_loop = true continue_line_loop = true
break break

View File

@ -8,7 +8,7 @@ import markdown
import v.scanner import v.scanner
import v.ast import v.ast
import v.token import v.token
import v.doc import doc
import v.pref import v.pref
import v.util { tabs } import v.util { tabs }

View File

@ -3,7 +3,7 @@ module main
import os import os
import os.cmdline import os.cmdline
import term import term
import v.doc import doc
import v.vmod import v.vmod
const vexe = os.getenv_opt('VEXE') or { @VEXE } const vexe = os.getenv_opt('VEXE') or { @VEXE }

View File

@ -1,7 +1,7 @@
module main module main
import strings import strings
import v.doc import doc
fn (vd &VDoc) gen_markdown(d doc.Doc, with_toc bool) string { fn (vd &VDoc) gen_markdown(d doc.Doc, with_toc bool) string {
cfg := vd.cfg cfg := vd.cfg

View File

@ -1,6 +1,6 @@
module main module main
import v.doc import doc
import v.vmod import v.vmod
import strings import strings
import os import os

View File

@ -1,4 +1,4 @@
module basic module testdata.basic
const source_root = 'temp' // some const const source_root = 'temp' // some const
const another = int(5) const another = int(5)

View File

@ -1,4 +1,4 @@
module basic module testdata.basic
const source_root = 'temp' // some const const source_root = 'temp' // some const
const another = int(5) const another = int(5)

View File

@ -1,6 +1,6 @@
module main module main
import v.doc import doc
@[inline] @[inline]
fn slug(title string) string { fn slug(title string) string {

0
cmd/tools/vdoc/v.mod Normal file
View File

View File

@ -6,7 +6,7 @@ import time
import strings import strings
import sync import sync
import runtime import runtime
import v.doc import doc
import v.vmod import v.vmod
import v.util import v.util
import json import json

View File

@ -25,6 +25,7 @@ const vroot = os.dir(os.real_path(os.getenv_opt('VEXE') or { @VEXE }))
const essential_list = [ const essential_list = [
'cmd/tools/vvet/vet_test.v', 'cmd/tools/vvet/vet_test.v',
'cmd/tools/vdoc/doc/doc_test.v',
'vlib/arrays/arrays_test.v', 'vlib/arrays/arrays_test.v',
'vlib/bitfield/bitfield_test.v', 'vlib/bitfield/bitfield_test.v',
// //
@ -84,7 +85,6 @@ const essential_list = [
'vlib/time/time_test.v', 'vlib/time/time_test.v',
'vlib/toml/tests/toml_test.v', 'vlib/toml/tests/toml_test.v',
'vlib/v/compiler_errors_test.v', 'vlib/v/compiler_errors_test.v',
'vlib/v/doc/doc_test.v',
'vlib/v/eval/interpret_test.v', 'vlib/v/eval/interpret_test.v',
'vlib/v/fmt/fmt_keep_test.v', 'vlib/v/fmt/fmt_keep_test.v',
'vlib/v/fmt/fmt_test.v', 'vlib/v/fmt/fmt_test.v',
@ -114,7 +114,6 @@ const skip_test_files = [
const skip_fsanitize_too_slow = [ const skip_fsanitize_too_slow = [
'do_not_remove', 'do_not_remove',
'vlib/v/compiler_errors_test.v', 'vlib/v/compiler_errors_test.v',
'vlib/v/doc/doc_test.v',
'vlib/v/fmt/fmt_test.v', 'vlib/v/fmt/fmt_test.v',
'vlib/v/fmt/fmt_keep_test.v', 'vlib/v/fmt/fmt_keep_test.v',
'vlib/v/fmt/fmt_vlib_test.v', 'vlib/v/fmt/fmt_vlib_test.v',
@ -131,6 +130,7 @@ const skip_fsanitize_too_slow = [
'cmd/tools/vpm/install_version_input_test.v', 'cmd/tools/vpm/install_version_input_test.v',
'cmd/tools/vpm/install_version_test.v', 'cmd/tools/vpm/install_version_test.v',
'cmd/tools/vpm/update_test.v', 'cmd/tools/vpm/update_test.v',
'cmd/tools/vdoc/doc/doc_test.v',
] ]
const skip_with_fsanitize_memory = [ const skip_with_fsanitize_memory = [
'do_not_remove', 'do_not_remove',