mirror of
https://github.com/roc-lang/roc.git
synced 2025-07-23 14:35:12 +00:00
Provide roc_cache_dir everywhere
This commit is contained in:
parent
13bed30411
commit
721841fa1f
41 changed files with 303 additions and 114 deletions
|
@ -14,6 +14,7 @@ use roc_load::docs::{DocEntry, TypeAnnotation};
|
|||
use roc_load::docs::{Documentation, ModuleDocumentation, RecordField};
|
||||
use roc_load::{ExecutionMode, LoadConfig, LoadedModule, LoadingProblem, Threading};
|
||||
use roc_module::symbol::{IdentIdsByModule, Interns, ModuleId};
|
||||
use roc_packaging::cache::{self, RocCacheDir};
|
||||
use roc_parse::ident::{parse_ident, Ident};
|
||||
use roc_parse::state::State;
|
||||
use roc_region::all::Region;
|
||||
|
@ -452,6 +453,9 @@ fn render_sidebar<'a, I: Iterator<Item = (&'a ModuleDocumentation, Vec<String>)>
|
|||
|
||||
pub fn load_modules_for_files(filenames: Vec<PathBuf>) -> Vec<LoadedModule> {
|
||||
let arena = Bump::new();
|
||||
let roc_cache_dir = cache::roc_cache_dir().unwrap_or_else(|| {
|
||||
todo!("Gracefully handle not being able to find default Roc cache dir.")
|
||||
});
|
||||
let mut modules = Vec::with_capacity(filenames.len());
|
||||
|
||||
for filename in filenames {
|
||||
|
@ -462,7 +466,13 @@ pub fn load_modules_for_files(filenames: Vec<PathBuf>) -> Vec<LoadedModule> {
|
|||
threading: Threading::AllAvailable,
|
||||
exec_mode: ExecutionMode::Check,
|
||||
};
|
||||
match roc_load::load_and_typecheck(&arena, filename, Default::default(), load_config) {
|
||||
match roc_load::load_and_typecheck(
|
||||
&arena,
|
||||
filename,
|
||||
Default::default(),
|
||||
RocCacheDir::Persistent(roc_cache_dir.as_path()),
|
||||
load_config,
|
||||
) {
|
||||
Ok(loaded) => modules.push(loaded),
|
||||
Err(LoadingProblem::FormattedReport(report)) => {
|
||||
eprintln!("{}", report);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue