Make roc_docs responsible for build dir constant

This commit is contained in:
Richard Feldman 2022-05-08 21:37:11 -04:00
parent 437f7dcf8b
commit b7c7bbaf1d
No known key found for this signature in database
GPG key ID: 7E4127D1E4241798
3 changed files with 9 additions and 9 deletions

View file

@ -11,7 +11,7 @@ use roc_mono::ir::OptLevel;
use std::env;
use std::ffi::OsStr;
use std::io;
use std::path::{Path, PathBuf};
use std::path::Path;
use std::process;
use target_lexicon::BinaryFormat;
use target_lexicon::{
@ -239,10 +239,6 @@ pub fn build_app<'a>() -> Command<'a> {
}
}
pub fn docs(files: Vec<PathBuf>) {
roc_docs::generate_docs_html(files, Path::new("./generated-docs"))
}
#[derive(Debug, PartialEq, Eq)]
pub enum BuildConfig {
BuildOnly,

View file

@ -1,10 +1,11 @@
use roc_build::link::LinkType;
use roc_cli::build::check_file;
use roc_cli::{
build_app, docs, format, BuildConfig, FormatMode, Target, CMD_BUILD, CMD_CHECK, CMD_DOCS,
CMD_EDIT, CMD_FORMAT, CMD_REPL, CMD_RUN, CMD_VERSION, DIRECTORY_OR_FILES, FLAG_CHECK, FLAG_LIB,
build_app, format, BuildConfig, FormatMode, Target, CMD_BUILD, CMD_CHECK, CMD_DOCS, CMD_EDIT,
CMD_FORMAT, CMD_REPL, CMD_RUN, CMD_VERSION, DIRECTORY_OR_FILES, FLAG_CHECK, FLAG_LIB,
FLAG_NO_LINK, FLAG_TARGET, FLAG_TIME, ROC_FILE,
};
use roc_docs::generate_docs_html;
use roc_error_macros::user_error;
use roc_load::{LoadingProblem, Threading};
use std::fs::{self, FileType};
@ -193,7 +194,7 @@ fn main() -> io::Result<()> {
roc_files_recursive(os_str.as_os_str(), metadata.file_type(), &mut roc_files)?;
}
docs(roc_files);
generate_docs_html(roc_files);
Ok(0)
}

View file

@ -21,7 +21,10 @@ use std::path::{Path, PathBuf};
mod docs_error;
mod html;
pub fn generate_docs_html(filenames: Vec<PathBuf>, build_dir: &Path) {
const BUILD_DIR: &str = "./generated-docs";
pub fn generate_docs_html(filenames: Vec<PathBuf>) {
let build_dir = Path::new(BUILD_DIR);
let loaded_modules = load_modules_for_files(filenames);
// TODO: get info from a package module; this is all hardcoded for now.