Merge branch 'precompiled-legacy' into https-packages

This commit is contained in:
Richard Feldman 2022-11-24 04:25:54 -05:00
commit f5cb2d73a1
No known key found for this signature in database
GPG key ID: F1F21AA5B1D9E43B
96 changed files with 4063 additions and 1334 deletions

View file

@ -5,9 +5,6 @@ use bumpalo::Bump;
use roc_module::symbol::ModuleId;
use roc_packaging::cache::RocCacheDir;
#[cfg(not(windows))]
const ROC_SKIP_SUBS_CACHE: &str = "ROC_SKIP_SUBS_CACHE";
const SKIP_SUBS_CACHE: bool = {
match option_env!("ROC_SKIP_SUBS_CACHE") {
Some(s) => s.len() == 1 && s.as_bytes()[0] == b'1',
@ -73,6 +70,7 @@ fn write_types_for_module_dummy(output_path: &Path) {
fn write_types_for_module_real(module_id: ModuleId, filename: &str, output_path: &Path) {
use roc_can::module::TypeState;
use roc_load_internal::file::{LoadingProblem, Threading};
use roc_reporting::cli::report_problems;
let arena = Bump::new();
let cwd = std::env::current_dir().unwrap();
@ -92,7 +90,7 @@ fn write_types_for_module_real(module_id: ModuleId, filename: &str, output_path:
Threading::AllAvailable,
);
let module = match res_module {
let mut module = match res_module {
Ok(v) => v,
Err(LoadingProblem::FormattedReport(report)) => {
panic!("{}", report);
@ -102,8 +100,16 @@ fn write_types_for_module_real(module_id: ModuleId, filename: &str, output_path:
}
};
if module.total_problems() > 0 {
panic!("Problems were found! Refusing to build cached subs.\nTry building with {}=1 to see them.", ROC_SKIP_SUBS_CACHE);
let problems = report_problems(
module.total_problems(),
&module.sources,
&module.interns,
&mut module.can_problems,
&mut module.type_problems,
);
if problems.errors + problems.warnings > 0 {
panic!("Problems were found! Refusing to build cached subs.");
}
let subs = module.solved.into_inner();