Skip to content

Commit 27ea51f

Browse files
committed
docs: Fix building docs, and update ddox.
1 parent 50c7eb4 commit 27ea51f

File tree

66 files changed

+470
-214
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+470
-214
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ Update from `vibe-d:core` to `vibe-core`, and various other improvements.
2323
- **Tests:** Fixed: USE_UNIT_THREADED envar doen't actually use unit-threaded.
2424
- **Tests:** Better diagnostics when using alternate `dub.selections.json`. (@SingingBush)
2525
- **Docs:** Add documentation and CI-related policies to `.travis.yml`.
26+
- **Docs:** Update modified ddox from 0.16.6 to 0.16.12.
2627
- **Internal:** [#212](https://github.com/mysql-d/mysql-native/issues/212):
2728
Add [.editorconfig](https://editorconfig.org/) file. (@schveiguy)
2829

build-docs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
#!/bin/sh
2+
3+
# Please use DMD 2.077.1 or below when building the documentation.
4+
#
5+
# DMD 2.078.0 and up causes lots of duplicated symbols in the documentation.
6+
# (See: https://github.com/rejectedsoftware/ddox/issues/208 )
7+
#
8+
# DMD 2.086.0 and up cause errors when building the docs because
9+
# gen-package-version and Scriptlike need updated.
10+
211
rdmd --build-only -c -Isource -Dddocs_tmp -X -Xfdocs/docs.json -version=MySQLDocs --force source/mysql/package.d
312
rm -rf docs_tmp
413
rm source/mysql/package.o

build-docs.bat

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
@echo off
2+
3+
rem Please use DMD 2.077.1 or below when building the documentation.
4+
rem
5+
rem DMD 2.078.0 and up causes lots of duplicated symbols in the documentation.
6+
rem (See: https://github.com/rejectedsoftware/ddox/issues/208 )
7+
rem
8+
rem DMD 2.086.0 and up cause errors when building the docs because
9+
rem gen-package-version and Scriptlike need updated.
10+
211
rdmd --build-only -c -Isource -Dddocs_tmp -X -Xfdocs/docs.json -version=MySQLDocs --force source/mysql/package.d
312
rmdir /S /Q docs_tmp > NUL 2> NUL
413
del source\mysql\package.obj

ddox/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
/ddox
33
/__*
44
node_modules
5+
ddox-test-library
56
test/screenshots/*.diff.png
67
test/screenshots/*.fail.png
78
tests/*/test.json

ddox/.travis.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
language: d
2-
services:
3-
- docker
2+
d: dmd-2.078.1
43
addons:
54
apt:
65
packages:
76
- libevent-dev
87
- libssl-dev
9-
- pkg-config
10-
- zlib1g-dev
118

129
script: ./travis-ci.sh

ddox/README-mysql-native.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
This copy of DDOX is included in the mysql-native repository for
22
mysql-native's convenience.
33

4-
This is based on DDOX's 'v0.16.6' tag, with the following changes:
4+
This is based on DDOX's 'v0.16.12' tag, with the following changes:
55

66
- Added this 'README-mysql-native.txt' file.
77

8-
- Modified 'dub.sdl' to include the version identifier 'VibeUseOpenSSL11' so
9-
it will succesfully link on my machine (Workaround DDOX Issue #186)
10-
118
- Modified 'layout.dt' and 'ddox.layout.dt' for mysql-native's purposes.
129
(Workaround DDOX Issue #88)
1310

ddox/dub.sdl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ license "MIT"
66

77
dependency "vibe-d:web" version=">=0.7.31 <0.9.0"
88
dependency "hyphenate" version="~>1.1.0"
9-
dependency "libdparse" version="~>0.7.0"
9+
dependency "libdparse" version="~>0.8.0"
1010

11-
versions "JsonLineNumbers" "VibeUseOpenSSL11"
11+
configuration "application" {
12+
targetType "executable"
13+
// Temporarily disabled to work around dlang/dub#1407
14+
// mainSourceFile "source/app.d"
15+
versions "JsonLineNumbers" "VibeNoSSL"
16+
}
17+
18+
configuration "library" {
19+
targetType "library"
20+
excludedSourceFiles "source/app.d"
21+
}

ddox/dub.selections.json

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
{
22
"fileVersion": 1,
33
"versions": {
4-
"botan": "1.12.9",
4+
"botan": "1.12.10",
55
"botan-math": "1.0.3",
6-
"diet-ng": "1.4.3",
7-
"eventcore": "0.8.17",
6+
"diet-ng": "1.5.0",
7+
"eventcore": "0.8.35",
88
"hyphenate": "1.1.1",
99
"libasync": "0.8.3",
10-
"libdparse": "0.7.1",
10+
"libdparse": "0.8.7",
1111
"libevent": "2.0.2+2.0.16",
12-
"memutils": "0.4.9",
13-
"openssl": "1.1.5+1.0.1g",
14-
"taggedalgebraic": "0.10.7",
15-
"vibe-core": "1.2.0",
16-
"vibe-d": "0.8.1"
12+
"memutils": "0.4.11",
13+
"mir-linux-kernel": "1.0.0",
14+
"openssl": "1.1.6+1.0.1g",
15+
"stdx-allocator": "2.77.2",
16+
"taggedalgebraic": "0.10.11",
17+
"vibe-core": "1.4.0",
18+
"vibe-d": "0.8.4"
1719
}
1820
}

ddox/source/ddox/api.d

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ string getAttributeString(Declaration decl, AttributeStringKind kind)
247247

248248
enum AttributeStringKind { normal, functionPrefix, functionSuffix }
249249

250-
string[] declStyleClasses(Declaration decl)
250+
auto declStyleClasses(Declaration decl)
251251
{
252252
string[] ret;
253253
ret ~= decl.protection.to!string().toLower();
@@ -257,7 +257,7 @@ string[] declStyleClasses(Declaration decl)
257257
if (tdecl.type.attributes.canFind("@property")) ret ~= "property";
258258
if (tdecl.type.attributes.canFind("static")) ret ~= "static";
259259
}
260-
return ret;
260+
return ret.join(" ");
261261
}
262262

263263
string formatType()(CachedType type, scope string delegate(in Entity) link_to, bool include_code_tags = true)
@@ -380,6 +380,10 @@ void renderTemplateArgs(R)(ref R output, Declaration decl, scope string delegate
380380
output.put(' ');
381381
}
382382
output.put(arg.name);
383+
if (arg.specValue.length) {
384+
output.highlightDCode(" : ");
385+
output.highlightDCode(arg.specValue);
386+
}
383387
if (arg.defaultValue.length) {
384388
output.highlightDCode(" = ");
385389
output.highlightDCode(arg.defaultValue);

ddox/source/ddox/ddoc.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ class DdocComment {
207207

208208
foreach (s; m_sections) {
209209
if (display_section && !display_section(s.name)) continue;
210-
parseSection(dst, s.name, s.lines, context, hlevel, allmacros);
210+
parseSection(dst, s.name, s.lines.dup, context, hlevel, allmacros);
211211
}
212212
}
213213

ddox/source/ddox/entities.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ final class TemplateDeclaration : Declaration {
507507
}
508508

509509
final class TemplateParameterDeclaration : TypedDeclaration {
510-
string defaultValue;
510+
string defaultValue, specValue;
511511

512512
override @property string kindCaption() const { return "Template parameter"; }
513513
override @property TemplateParameterDeclaration dup() { auto ret = new TemplateParameterDeclaration(parent, name); ret.copyFrom(this); ret.type = type; return ret; }

ddox/source/ddox/htmlgenerator.d

Lines changed: 42 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import vibe.core.stream;
2424
import vibe.data.json;
2525
import vibe.inet.path;
2626
import vibe.http.server;
27-
import vibe.stream.wrapper : StreamOutputRange;
27+
import vibe.stream.wrapper : streamOutputRange;
2828
import diet.html;
2929
import diet.traits : dietTraits;
3030

@@ -40,7 +40,7 @@ import diet.traits : dietTraits;
4040
version (Windows) version = CaseInsensitiveFS;
4141
else version (OSX) version = CaseInsensitiveFS;
4242

43-
void generateHtmlDocs(Path dst_path, Package root, GeneratorSettings settings = null)
43+
void generateHtmlDocs(NativePath dst_path, Package root, GeneratorSettings settings = null)
4444
{
4545
import std.algorithm : splitter;
4646
import vibe.web.common : adjustMethodStyle;
@@ -151,15 +151,20 @@ void generateHtmlDocs(Path dst_path, Package root, GeneratorSettings settings =
151151
}
152152
}
153153

154-
void writeHashedFile(Path filename, scope void delegate(OutputStream) del)
154+
void writeHashedFile(NativePath filename, scope void delegate(OutputStream) del)
155155
{
156+
import std.range : drop, walkLength;
156157
import vibe.stream.memory;
158+
157159
assert(filename.startsWith(dst_path));
158160

159161
auto str = createMemoryOutputStream();
160162
del(str);
161163
auto h = md5Of(str.data).toHexString.idup;
162-
auto relfilename = filename[dst_path.length .. $].toString();
164+
version (Have_vibe_core)
165+
auto relfilename = NativePath(filename.bySegment.drop(dst_path.bySegment.walkLength)).toString();
166+
else
167+
auto relfilename = NativePath(filename.bySegment.drop(dst_path.bySegment.walkLength), false).toString();
163168
auto ph = relfilename in file_hashes;
164169
if (!ph || *ph != h) {
165170
//logInfo("do write %s", filename);
@@ -168,26 +173,28 @@ void generateHtmlDocs(Path dst_path, Package root, GeneratorSettings settings =
168173
new_file_hashes[relfilename] = h;
169174
}
170175

171-
void visitModule(Module mod, Path pack_path)
176+
void visitModule(Module mod, NativePath pack_path)
172177
{
173-
auto modpath = pack_path ~ PathEntry(mod.name);
178+
import std.range : walkLength;
179+
180+
auto modpath = pack_path ~ NativePath.Segment(mod.name);
174181
if (!existsFile(modpath)) createDirectory(modpath);
175182
logInfo("Generating module: %s", mod.qualifiedName);
176-
writeHashedFile(pack_path ~ PathEntry(mod.name~".html"), (stream) {
177-
generateModulePage(stream, root, mod, settings, ent => linkTo(ent, pack_path.length-dst_path.length));
183+
writeHashedFile(pack_path ~ NativePath.Segment(mod.name~".html"), (stream) {
184+
generateModulePage(stream, root, mod, settings, ent => linkTo(ent, pack_path.bySegment.walkLength-dst_path.bySegment.walkLength));
178185
});
179186

180187
DocGroup[][string] pages;
181188
collectChildren(mod, pages);
182189
foreach (name, decls; pages)
183-
writeHashedFile(modpath ~ PathEntry(name~".html"), (stream) {
184-
generateDeclPage(stream, root, mod, name, decls, settings, ent => linkTo(ent, modpath.length-dst_path.length));
190+
writeHashedFile(modpath ~ NativePath.Segment(name~".html"), (stream) {
191+
generateDeclPage(stream, root, mod, name, decls, settings, ent => linkTo(ent, modpath.bySegment.walkLength-dst_path.bySegment.walkLength));
185192
});
186193
}
187194

188-
void visitPackage(Package p, Path path)
195+
void visitPackage(Package p, NativePath path)
189196
{
190-
auto packpath = p.parent ? path ~ PathEntry(p.name) : path;
197+
auto packpath = p.parent ? path ~ NativePath.Segment(p.name) : path;
191198
if( !packpath.empty && !existsFile(packpath) ) createDirectory(packpath);
192199
foreach( sp; p.packages ) visitPackage(sp, packpath);
193200
foreach( m; p.modules ) visitModule(m, packpath);
@@ -197,15 +204,15 @@ void generateHtmlDocs(Path dst_path, Package root, GeneratorSettings settings =
197204

198205
if( !dst_path.empty && !existsFile(dst_path) ) createDirectory(dst_path);
199206

200-
writeHashedFile(dst_path ~ PathEntry("index.html"), (stream) {
207+
writeHashedFile(dst_path ~ NativePath.Segment("index.html"), (stream) {
201208
generateApiIndex(stream, root, settings, ent => linkTo(ent, 0));
202209
});
203210

204211
writeHashedFile(dst_path ~ "symbols.js", (stream) {
205212
generateSymbolsJS(stream, root, settings, ent => linkTo(ent, 0));
206213
});
207214

208-
writeHashedFile(dst_path ~ PathEntry("sitemap.xml"), (stream) {
215+
writeHashedFile(dst_path ~ NativePath.Segment("sitemap.xml"), (stream) {
209216
generateSitemap(stream, root, settings, ent => linkTo(ent, 0));
210217
});
211218

@@ -214,7 +221,7 @@ void generateHtmlDocs(Path dst_path, Package root, GeneratorSettings settings =
214221
// delete obsolete files
215222
foreach (f; file_hashes.byKey)
216223
if (f !in new_file_hashes) {
217-
try removeFile(dst_path ~ Path(f));
224+
try removeFile(dst_path ~ NativePath(f));
218225
catch (Exception e) logWarn("Failed to remove obsolete file '%s': %s", f, e.msg);
219226
}
220227

@@ -252,7 +259,8 @@ struct DdoxDietTraits(HTMLOutputStyle htmlStyle) {
252259
enum HTMLOutputStyle htmlOutputStyle = htmlStyle;
253260
}
254261

255-
void generateSitemap(OutputStream dst, Package root_package, GeneratorSettings settings, string delegate(in Entity) link_to, HTTPServerRequest req = null)
262+
void generateSitemap(OutputStream)(OutputStream dst, Package root_package, GeneratorSettings settings, string delegate(in Entity) link_to, HTTPServerRequest req = null)
263+
if (isOutputStream!OutputStream)
256264
{
257265
dst.write("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
258266
dst.write("<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n");
@@ -266,10 +274,13 @@ void generateSitemap(OutputStream dst, Package root_package, GeneratorSettings s
266274

267275
void writeEntityRec(Entity ent){
268276
import std.string;
269-
if( !cast(Package)ent || ent is root_package ){
277+
if (!cast(Package)ent || ent is root_package) {
270278
auto link = link_to(ent);
271-
if( indexOf(link, '#') < 0 ) // ignore URLs with anchors
272-
writeEntry((settings.siteUrl ~ Path(link)).toString());
279+
if (indexOf(link, '#') < 0) { // ignore URLs with anchors
280+
auto p = InetPath(link);
281+
p.normalize();
282+
writeEntry((settings.siteUrl ~ p).toString());
283+
}
273284
}
274285
ent.iterateChildren((ch){ writeEntityRec(ch); return true; });
275286
}
@@ -280,13 +291,14 @@ void generateSitemap(OutputStream dst, Package root_package, GeneratorSettings s
280291
dst.flush();
281292
}
282293

283-
void generateSymbolsJS(OutputStream dst, Package root_package, GeneratorSettings settings, string delegate(in Entity) link_to)
294+
void generateSymbolsJS(OutputStream)(OutputStream dst, Package root_package, GeneratorSettings settings, string delegate(in Entity) link_to)
295+
if (isOutputStream!OutputStream)
284296
{
285297
import std.typecons : Tuple, tuple;
286298

287299
bool[Tuple!(Entity, CachedString)] visited;
288300

289-
auto rng = StreamOutputRange(dst);
301+
auto rng = streamOutputRange(dst);
290302

291303
void writeEntry(Entity ent) {
292304
auto key = tuple(ent.parent, ent.name);
@@ -316,15 +328,16 @@ void generateSymbolsJS(OutputStream dst, Package root_package, GeneratorSettings
316328
rng.put("];\n");
317329
}
318330

319-
void generateApiIndex(OutputStream dst, Package root_package, GeneratorSettings settings, string delegate(in Entity) link_to, HTTPServerRequest req = null)
331+
void generateApiIndex(OutputStream)(OutputStream dst, Package root_package, GeneratorSettings settings, string delegate(in Entity) link_to, HTTPServerRequest req = null)
332+
if (isOutputStream!OutputStream)
320333
{
321334
auto info = new DocPageInfo;
322335
info.linkTo = link_to;
323336
info.settings = settings;
324337
info.rootPackage = root_package;
325338
info.node = root_package;
326339

327-
auto rng = StreamOutputRange(dst);
340+
auto rng = streamOutputRange(dst);
328341
final switch (settings.htmlOutputStyle)
329342
{
330343
foreach (htmlOutputStyle; EnumMembers!HTMLOutputStyle)
@@ -336,7 +349,8 @@ void generateApiIndex(OutputStream dst, Package root_package, GeneratorSettings
336349
}
337350
}
338351

339-
void generateModulePage(OutputStream dst, Package root_package, Module mod, GeneratorSettings settings, string delegate(in Entity) link_to, HTTPServerRequest req = null)
352+
void generateModulePage(OutputStream)(OutputStream dst, Package root_package, Module mod, GeneratorSettings settings, string delegate(in Entity) link_to, HTTPServerRequest req = null)
353+
if (isOutputStream!OutputStream)
340354
{
341355
auto info = new DocPageInfo;
342356
info.linkTo = link_to;
@@ -346,7 +360,7 @@ void generateModulePage(OutputStream dst, Package root_package, Module mod, Gene
346360
info.node = mod;
347361
info.docGroups = null;
348362

349-
auto rng = StreamOutputRange(dst);
363+
auto rng = streamOutputRange(dst);
350364
final switch (settings.htmlOutputStyle)
351365
{
352366
foreach (htmlOutputStyle; EnumMembers!HTMLOutputStyle)
@@ -358,7 +372,8 @@ void generateModulePage(OutputStream dst, Package root_package, Module mod, Gene
358372
}
359373
}
360374

361-
void generateDeclPage(OutputStream dst, Package root_package, Module mod, string nested_name, DocGroup[] docgroups, GeneratorSettings settings, string delegate(in Entity) link_to, HTTPServerRequest req = null)
375+
void generateDeclPage(OutputStream)(OutputStream dst, Package root_package, Module mod, string nested_name, DocGroup[] docgroups, GeneratorSettings settings, string delegate(in Entity) link_to, HTTPServerRequest req = null)
376+
if (isOutputStream!OutputStream)
362377
{
363378
import std.algorithm : sort;
364379

@@ -372,7 +387,7 @@ void generateDeclPage(OutputStream dst, Package root_package, Module mod, string
372387
sort!((a, b) => cmpKind(a.members[0], b.members[0]))(info.docGroups);
373388
info.nestedName = nested_name;
374389

375-
auto rng = StreamOutputRange(dst);
390+
auto rng = streamOutputRange(dst);
376391
final switch (settings.htmlOutputStyle)
377392
{
378393
foreach (htmlOutputStyle; EnumMembers!HTMLOutputStyle)

ddox/source/ddox/main.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ int cmdGenerateHtml(string[] args)
5353
if( auto ret = setupGeneratorInput(args, gensettings, pack) )
5454
return ret;
5555

56-
generateHtmlDocs(Path(args[3]), pack, gensettings);
56+
generateHtmlDocs(NativePath(args[3]), pack, gensettings);
5757
return 0;
5858
}
5959

0 commit comments

Comments
 (0)