Start a Cargo workspace and generate documentation for it
This commit is contained in:
parent
429e4a3063
commit
0ec5b74851
|
@ -14,6 +14,7 @@
|
||||||
/demo/server/Rocket.toml
|
/demo/server/Rocket.toml
|
||||||
Cargo.lock
|
Cargo.lock
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
target
|
||||||
|
|
||||||
# Editors
|
# Editors
|
||||||
*.swp
|
*.swp
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
[workspace]
|
||||||
|
members = [
|
||||||
|
"font-renderer",
|
||||||
|
"partitioner",
|
||||||
|
"path-utils",
|
||||||
|
"demo/server",
|
||||||
|
"utils/frontend",
|
||||||
|
"utils/gamma-lut",
|
||||||
|
]
|
|
@ -1,24 +1,27 @@
|
||||||
const {spawn} = require('child_process');
|
const {spawn} = require('child_process');
|
||||||
|
const process = require('process');
|
||||||
|
|
||||||
class RustdocPlugin {
|
class RustdocPlugin {
|
||||||
constructor(options) {
|
constructor(options) {
|
||||||
this.options = Object.assign({
|
this.options = Object.assign({directories: [], flags: {}}, options);
|
||||||
directories: [],
|
|
||||||
onBeforeSetup: Function.prototype,
|
|
||||||
onBeforeAddPartials: Function.prototype,
|
|
||||||
onBeforeCompile: Function.prototype,
|
|
||||||
onBeforeRender: Function.prototype,
|
|
||||||
onBeforeSave: Function.prototype,
|
|
||||||
onDone: Function.prototype
|
|
||||||
}, options);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
apply(compiler) {
|
apply(compiler) {
|
||||||
compiler.plugin("make", (compilation, done) => {
|
let rustdocFlags = [];
|
||||||
|
for (let key in this.options.flags) {
|
||||||
|
if (this.options.flags.hasOwnProperty(key))
|
||||||
|
rustdocFlags.push("--" + key + "=" + this.options.flags[key]);
|
||||||
|
}
|
||||||
|
rustdocFlags = rustdocFlags.join(" ");
|
||||||
|
|
||||||
|
compiler.plugin('after-compile', (compilation, done) => {
|
||||||
let directoriesLeft = this.options.directories.length;
|
let directoriesLeft = this.options.directories.length;
|
||||||
for (const directory of this.options.directories) {
|
for (const directory of this.options.directories) {
|
||||||
console.log("Building documentation for `" + directory + "`...");
|
console.log("Building documentation for `" + directory + "`...");
|
||||||
const cargo = spawn("cargo", ["doc"], {cwd: directory});
|
const cargo = spawn("cargo", ["doc", "--no-deps"], {
|
||||||
|
cwd: directory,
|
||||||
|
env: Object.assign({RUSTDOCFLAGS: rustdocFlags}, process.env),
|
||||||
|
});
|
||||||
cargo.stdout.setEncoding('utf8');
|
cargo.stdout.setEncoding('utf8');
|
||||||
cargo.stderr.setEncoding('utf8');
|
cargo.stderr.setEncoding('utf8');
|
||||||
cargo.stdout.on('data', data => console.log(data));
|
cargo.stdout.on('data', data => console.log(data));
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
body {
|
||||||
|
padding: 0 !important;
|
||||||
|
}
|
||||||
|
h1,
|
||||||
|
h2,
|
||||||
|
h3
|
||||||
|
h4,
|
||||||
|
.sidebar,
|
||||||
|
a.source,
|
||||||
|
.search-input,
|
||||||
|
.content table :not(code) > a,
|
||||||
|
.collapse-toggle,
|
||||||
|
ul.item-list > li > .out-of-band {
|
||||||
|
font-family: inherit !important;
|
||||||
|
}
|
||||||
|
.content {
|
||||||
|
padding: 0 15px 0 0 !important;
|
||||||
|
}
|
||||||
|
nav.navbar {
|
||||||
|
max-width: inherit !important;
|
||||||
|
border: none !important;
|
||||||
|
margin: 0 !important;
|
||||||
|
}
|
||||||
|
nav.sidebar {
|
||||||
|
top: auto !important;
|
||||||
|
}
|
||||||
|
img {
|
||||||
|
max-width: inherit !important;
|
||||||
|
}
|
|
@ -181,6 +181,7 @@ button > svg path {
|
||||||
margin: 2px 0 0;
|
margin: 2px 0 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Arrow
|
* Arrow
|
||||||
*
|
*
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
{{>partials/navbar.html isDoc=true}}
|
|
@ -0,0 +1,2 @@
|
||||||
|
{{>partials/header.html}}
|
||||||
|
<link rel="stylesheet" href="/css/pathfinder-doc.css">
|
|
@ -1,4 +1,4 @@
|
||||||
<nav class="navbar navbar-expand-sm navbar-dark bg-dark">
|
<nav class="navbar sticky-top navbar-expand-sm navbar-dark bg-dark">
|
||||||
<a class="navbar-brand" href="/">
|
<a class="navbar-brand" href="/">
|
||||||
<img id="pf-navbar-logo" alt="" src="/svg/demo/logo" width="30" class="mr-2">
|
<img id="pf-navbar-logo" alt="" src="/svg/demo/logo" width="30" class="mr-2">
|
||||||
Pathfinder
|
Pathfinder
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
<a class="dropdown-item" href="/demo/3d">3D</a>
|
<a class="dropdown-item" href="/demo/3d">3D</a>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item {{#if isDoc}}active{{/if}}">
|
||||||
<a class="nav-link" href="/doc/api">Documentation</a>
|
<a class="nav-link" href="/doc/api">Documentation</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item dropdown {{#if isTool}}active{{/if}}">
|
<li class="nav-item dropdown {{#if isTool}}active{{/if}}">
|
||||||
|
|
|
@ -2,6 +2,9 @@ const Handlebars = require('handlebars');
|
||||||
const HandlebarsPlugin = require('handlebars-webpack-plugin');
|
const HandlebarsPlugin = require('handlebars-webpack-plugin');
|
||||||
const RustdocPlugin = require('rustdoc-webpack-plugin');
|
const RustdocPlugin = require('rustdoc-webpack-plugin');
|
||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
const cwd = fs.realpathSync(".");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
devtool: 'inline-source-map',
|
devtool: 'inline-source-map',
|
||||||
|
@ -51,7 +54,11 @@ module.exports = {
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
new RustdocPlugin({
|
new RustdocPlugin({
|
||||||
directories: ["../../font-renderer"],
|
directories: [fs.realpathSync("../..")],
|
||||||
|
flags: {
|
||||||
|
'html-in-header': path.join(cwd, "doc-header.html"),
|
||||||
|
'html-before-content': path.join(cwd, "doc-before-content.html"),
|
||||||
|
},
|
||||||
}),
|
}),
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,9 +80,9 @@ static STATIC_3D_DEMO_PATH: &'static str = "../client/3d-demo.html";
|
||||||
static STATIC_TOOLS_BENCHMARK_PATH: &'static str = "../client/benchmark.html";
|
static STATIC_TOOLS_BENCHMARK_PATH: &'static str = "../client/benchmark.html";
|
||||||
static STATIC_TOOLS_REFERENCE_TEST_PATH: &'static str = "../client/reference-test.html";
|
static STATIC_TOOLS_REFERENCE_TEST_PATH: &'static str = "../client/reference-test.html";
|
||||||
static STATIC_TOOLS_MESH_DEBUGGER_PATH: &'static str = "../client/mesh-debugger.html";
|
static STATIC_TOOLS_MESH_DEBUGGER_PATH: &'static str = "../client/mesh-debugger.html";
|
||||||
static STATIC_DOC_API_PATH: &'static str = "../../font-renderer/target/doc";
|
static STATIC_DOC_API_PATH: &'static str = "../../target/doc";
|
||||||
static STATIC_CSS_BOOTSTRAP_PATH: &'static str = "../client/node_modules/bootstrap/dist/css";
|
static STATIC_CSS_BOOTSTRAP_PATH: &'static str = "../client/node_modules/bootstrap/dist/css";
|
||||||
static STATIC_CSS_PATHFINDER_PATH: &'static str = "../client/css/pathfinder.css";
|
static STATIC_CSS_PATH: &'static str = "../client/css";
|
||||||
static STATIC_JS_BOOTSTRAP_PATH: &'static str = "../client/node_modules/bootstrap/dist/js";
|
static STATIC_JS_BOOTSTRAP_PATH: &'static str = "../client/node_modules/bootstrap/dist/js";
|
||||||
static STATIC_JS_JQUERY_PATH: &'static str = "../client/node_modules/jquery/dist";
|
static STATIC_JS_JQUERY_PATH: &'static str = "../client/node_modules/jquery/dist";
|
||||||
static STATIC_JS_POPPER_JS_PATH: &'static str = "../client/node_modules/popper.js/dist/umd";
|
static STATIC_JS_POPPER_JS_PATH: &'static str = "../client/node_modules/popper.js/dist/umd";
|
||||||
|
@ -94,7 +94,7 @@ static STATIC_DATA_PATH: &'static str = "../../resources/data";
|
||||||
static STATIC_TEST_DATA_PATH: &'static str = "../../resources/tests";
|
static STATIC_TEST_DATA_PATH: &'static str = "../../resources/tests";
|
||||||
static STATIC_TEXTURES_PATH: &'static str = "../../resources/textures";
|
static STATIC_TEXTURES_PATH: &'static str = "../../resources/textures";
|
||||||
|
|
||||||
static STATIC_DOC_API_INDEX_URI: &'static str = "/doc/api/pathfinder_font_renderer/index.html";
|
static STATIC_DOC_API_INDEX_URI: &'static str = "/doc/api/pathfinder/index.html";
|
||||||
|
|
||||||
static BUILTIN_FONTS: [(&'static str, &'static str); 4] = [
|
static BUILTIN_FONTS: [(&'static str, &'static str); 4] = [
|
||||||
("open-sans", "../../resources/fonts/open-sans/OpenSans-Regular.ttf"),
|
("open-sans", "../../resources/fonts/open-sans/OpenSans-Regular.ttf"),
|
||||||
|
@ -694,9 +694,9 @@ fn static_doc_api(file: PathBuf) -> Option<NamedFile> {
|
||||||
fn static_css_bootstrap(file: PathBuf) -> Option<NamedFile> {
|
fn static_css_bootstrap(file: PathBuf) -> Option<NamedFile> {
|
||||||
NamedFile::open(Path::new(STATIC_CSS_BOOTSTRAP_PATH).join(file)).ok()
|
NamedFile::open(Path::new(STATIC_CSS_BOOTSTRAP_PATH).join(file)).ok()
|
||||||
}
|
}
|
||||||
#[get("/css/pathfinder.css")]
|
#[get("/css/<file>")]
|
||||||
fn static_css_pathfinder_css() -> io::Result<NamedFile> {
|
fn static_css(file: String) -> Option<NamedFile> {
|
||||||
NamedFile::open(STATIC_CSS_PATHFINDER_PATH)
|
NamedFile::open(Path::new(STATIC_CSS_PATH).join(file)).ok()
|
||||||
}
|
}
|
||||||
#[get("/js/bootstrap/<file..>")]
|
#[get("/js/bootstrap/<file..>")]
|
||||||
fn static_js_bootstrap(file: PathBuf) -> Option<NamedFile> {
|
fn static_js_bootstrap(file: PathBuf) -> Option<NamedFile> {
|
||||||
|
@ -800,8 +800,8 @@ fn main() {
|
||||||
static_tools_mesh_debugger,
|
static_tools_mesh_debugger,
|
||||||
static_doc_api_index,
|
static_doc_api_index,
|
||||||
static_doc_api,
|
static_doc_api,
|
||||||
|
static_css,
|
||||||
static_css_bootstrap,
|
static_css_bootstrap,
|
||||||
static_css_pathfinder_css,
|
|
||||||
static_js_bootstrap,
|
static_js_bootstrap,
|
||||||
static_js_jquery,
|
static_js_jquery,
|
||||||
static_js_popper_js,
|
static_js_popper_js,
|
||||||
|
|
|
@ -9,7 +9,7 @@ name = "pathfinder_partitioner"
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bincode = "0.8"
|
bincode = "0.8"
|
||||||
bit-vec = "0.4"
|
bit-vec = "0.4"
|
||||||
byteorder = "1.1"
|
byteorder = "1.2"
|
||||||
env_logger = "0.4"
|
env_logger = "0.4"
|
||||||
euclid = "0.15"
|
euclid = "0.15"
|
||||||
half = "1.0"
|
half = "1.0"
|
||||||
|
|
Loading…
Reference in New Issue