tools: move cmd/tools/vdoc/doc to cmd/tools/vdoc/document, so that it can be imported from other programs through -path, without conflicting with the top level doc/ folder in the main repo (#23733)

This commit is contained in:
Delyan Angelov 2025-02-15 23:12:57 +02:00 committed by GitHub
parent 00a08c4fbe
commit 46447f1262
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 18 additions and 20 deletions

View file

@ -1,4 +1,4 @@
module doc
module document
import v.token

View file

@ -1,4 +1,4 @@
module doc
module document
import os
import time

View file

@ -1,4 +1,4 @@
module doc
module document
import os
@ -37,9 +37,7 @@ fn test_get_parent_mod_normal_cases() {
assert err.msg() == 'No V files found.'
'---'
}
// TODO: WTF?
// assert get_parent_mod(os.join_path(@VMODROOT, 'vlib', 'v', 'doc', 'doc.v'))? == 'v.v.doc'
assert get_parent_mod(os.join_path(@VMODROOT, 'vlib', 'v', 'doc'))? == 'v'
assert get_parent_mod(os.join_path(@VMODROOT, 'vlib', 'v', 'token'))? == 'v'
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', 'tools', 'modules', 'testing',

View file

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

View file

@ -1,4 +1,4 @@
module doc
module document
import os
import v.ast

View file

@ -1,4 +1,4 @@
module doc
module document
import os

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -25,7 +25,7 @@ const vroot = os.dir(os.real_path(os.getenv_opt('VEXE') or { @VEXE }))
const essential_list = [
'cmd/tools/vvet/vet_test.v',
'cmd/tools/vdoc/doc/doc_test.v',
'cmd/tools/vdoc/document/doc_test.v',
'vlib/arrays/arrays_test.v',
'vlib/bitfield/bitfield_test.v',
//
@ -130,7 +130,7 @@ const skip_fsanitize_too_slow = [
'cmd/tools/vpm/install_version_input_test.v',
'cmd/tools/vpm/install_version_test.v',
'cmd/tools/vpm/update_test.v',
'cmd/tools/vdoc/doc/doc_test.v',
'cmd/tools/vdoc/document/doc_test.v',
]
const skip_with_fsanitize_memory = [
'do_not_remove',

View file

@ -30,7 +30,7 @@ fn (mut p Preferences) expand_lookup_paths() {
match path {
'@vlib' { expanded_paths << p.vlib }
'@vmodules' { expanded_paths << p.vmodules_paths }
else { expanded_paths << path }
else { expanded_paths << path.replace('@vroot', p.vroot) }
}
}
p.lookup_path = expanded_paths