@@ -300,20 +300,23 @@ pub fn generate_asts<'a>(
300300 } else {
301301 (
302302 Ok ( (
303- helpers:: get_ast_path (
304- & source_file. implementation . path ,
305- & module. package . name ,
306- & project_root,
307- ) ,
303+ helpers:: get_basename ( & source_file. implementation . path ) . to_string ( )
304+ + ".ast" ,
305+ // helpers::get_ast_path(
306+ // &source_file.implementation.path,
307+ // &module.package.name,
308+ // &project_root,
309+ // ),
308310 None ,
309311 ) ) ,
310312 Ok ( source_file. interface . as_ref ( ) . map ( |i| {
311313 (
312- helpers:: get_iast_path (
313- & i. path ,
314- & module. package . name ,
315- & project_root,
316- ) ,
314+ // helpers::get_iast_path(
315+ // &i.path,
316+ // &module.package.name,
317+ // &project_root,
318+ // )
319+ helpers:: get_basename ( & i. path ) . to_string ( ) + ".iast" ,
317320 None ,
318321 )
319322 } ) ) ,
@@ -383,6 +386,8 @@ pub fn generate_asts<'a>(
383386 . collect :: < AHashSet < String > > ( ) ,
384387 ) ;
385388
389+ println ! ( "Dirty modules: {:?}" , dirty_modules. len( ) ) ;
390+
386391 loop {
387392 let mut num_checked_modules = 0 ;
388393 for ( module_name, _ast_path, _iast_path, deps, namespace) in results. iter ( ) {
@@ -546,7 +551,7 @@ pub fn parse_packages(
546551 modules. insert (
547552 helpers:: file_path_to_module_name ( & mlmap. to_owned ( ) , & None ) ,
548553 Module {
549- source_type : SourceType :: MlMap ( MlMap { dirty : true } ) ,
554+ source_type : SourceType :: MlMap ( MlMap { dirty : false } ) ,
550555 deps : deps,
551556 package : package. to_owned ( ) ,
552557 } ,
@@ -996,17 +1001,31 @@ pub fn build(path: &str) -> Result<AHashMap<std::string::String, Module>, ()> {
9961001 let start_compiling = Instant :: now ( ) ;
9971002
9981003 let mut compiled_modules = AHashSet :: < String > :: new ( ) ;
1004+ // println!("Clean modules:");
9991005 let clean_modules = modules
10001006 . iter ( )
10011007 . filter_map ( |( module_name, module) | {
10021008 if is_dirty ( module) {
10031009 None
10041010 } else {
1011+ // println!("> {}", module_name);
10051012 Some ( module_name. to_owned ( ) )
10061013 }
10071014 } )
10081015 . collect :: < AHashSet < String > > ( ) ;
10091016
1017+ println ! (
1018+ "Clean modules: {} ({})" ,
1019+ clean_modules. len( ) ,
1020+ clean_modules. len( ) as f64 / modules. len( ) as f64 * 100.0
1021+ ) ;
1022+
1023+ let mut clean_modules_sorted = clean_modules. iter ( ) . collect :: < Vec < & String > > ( ) ;
1024+ clean_modules_sorted. sort_by ( |a, b| a. cmp ( b) ) ;
1025+ clean_modules_sorted. iter ( ) . for_each ( |_module_name| {
1026+ // println!("> {}", module_name);
1027+ } ) ;
1028+
10101029 // always clean build
10111030 // let clean_modules = AHashSet::<String>::new();
10121031
@@ -1018,6 +1037,9 @@ pub fn build(path: &str) -> Result<AHashMap<std::string::String, Module>, ()> {
10181037 let total_modules = modules. len ( ) ;
10191038
10201039 loop {
1040+ let mut sorted_modules = modules. iter ( ) . collect :: < Vec < ( & String , & Module ) > > ( ) ;
1041+ // sort by module name:
1042+ sorted_modules. sort_by ( |a, b| a. 0 . cmp ( b. 0 ) ) ;
10211043 files_current_loop_count = 0 ;
10221044 loop_count += 1 ;
10231045
@@ -1028,14 +1050,15 @@ pub fn build(path: &str) -> Result<AHashMap<std::string::String, Module>, ()> {
10281050 loop_count,
10291051 ) ;
10301052
1031- modules
1053+ sorted_modules
1054+ // .iter()
10321055 . par_iter ( )
10331056 . map ( |( module_name, module) | {
10341057 if module. deps . is_subset ( & compiled_modules)
1035- && !compiled_modules. contains ( module_name)
1058+ && !compiled_modules. contains ( * module_name)
10361059 {
1037- if clean_modules. contains ( module_name) {
1038- return Some ( ( module_name. to_owned ( ) , Ok ( None ) , Some ( Ok ( None ) ) ) ) ;
1060+ if clean_modules. contains ( * module_name) {
1061+ return Some ( ( module_name. to_string ( ) , Ok ( None ) , Some ( Ok ( None ) ) ) ) ;
10391062 }
10401063 match module. source_type . to_owned ( ) {
10411064 SourceType :: MlMap ( _) => {
@@ -1051,6 +1074,7 @@ pub fn build(path: &str) -> Result<AHashMap<std::string::String, Module>, ()> {
10511074 }
10521075 SourceType :: SourceFile ( source_file) => {
10531076 // compile interface first
1077+ // println!("Compiling {}...", module_name);
10541078 let interface_result = match source_file. interface . to_owned ( ) {
10551079 Some ( Interface { path, .. } ) => {
10561080 let result = compile_file (
@@ -1068,6 +1092,10 @@ pub fn build(path: &str) -> Result<AHashMap<std::string::String, Module>, ()> {
10681092 }
10691093 _ => None ,
10701094 } ;
1095+ if let Some ( Err ( error) ) = interface_result. to_owned ( ) {
1096+ println ! ( "{}" , error) ;
1097+ panic ! ( "Interface compilation error!" ) ;
1098+ }
10711099
10721100 let result = compile_file (
10731101 & module. package . name ,
@@ -1081,7 +1109,12 @@ pub fn build(path: &str) -> Result<AHashMap<std::string::String, Module>, ()> {
10811109 false ,
10821110 ) ;
10831111
1084- Some ( ( module_name. to_owned ( ) , result, interface_result) )
1112+ if let Err ( error) = result. to_owned ( ) {
1113+ println ! ( "{}" , error) ;
1114+ panic ! ( "Implementation compilation error!" ) ;
1115+ }
1116+
1117+ Some ( ( module_name. to_string ( ) , result, interface_result) )
10851118 }
10861119 }
10871120 } else {
0 commit comments