mirror of
https://github.com/ziglang/zig.git
synced 2026-01-20 14:25:16 +00:00
std-docs: include builtin module in sources.tar
Now that `-femit-docs` includes all modules, including the builtin module, in the generated source tarball, it makes sense to apply the same logic to the std-docs server. std-docs constructs its own tarball, so a different approach is needed to achieve the same end result.
This commit is contained in:
parent
424dd17b6c
commit
3fb6bb1449
@ -177,6 +177,26 @@ fn serveSourcesTar(request: *std.http.Server.Request, context: *Context) !void {
|
||||
try w.writeFile(file);
|
||||
try w.writeByteNTimes(0, padding);
|
||||
}
|
||||
|
||||
{
|
||||
// Since this command is JIT compiled, the builtin module available in
|
||||
// this source file corresponds to the user's host system.
|
||||
const builtin_zig = @embedFile("builtin");
|
||||
|
||||
var file_header = std.tar.output.Header.init();
|
||||
file_header.typeflag = .regular;
|
||||
try file_header.setPath("builtin", "builtin.zig");
|
||||
try file_header.setSize(builtin_zig.len);
|
||||
try file_header.updateChecksum();
|
||||
try w.writeAll(std.mem.asBytes(&file_header));
|
||||
try w.writeAll(builtin_zig);
|
||||
const padding = p: {
|
||||
const remainder = builtin_zig.len % 512;
|
||||
break :p if (remainder > 0) 512 - remainder else 0;
|
||||
};
|
||||
try w.writeByteNTimes(0, padding);
|
||||
}
|
||||
|
||||
// intentionally omitting the pointless trailer
|
||||
//try w.writeByteNTimes(0, 512 * 2);
|
||||
try response.end();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user