@@ -300,20 +300,23 @@ pub fn generate_asts<'a>(
300
300
} else {
301
301
(
302
302
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
+ // ),
308
310
None ,
309
311
) ) ,
310
312
Ok ( source_file. interface . as_ref ( ) . map ( |i| {
311
313
(
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" ,
317
320
None ,
318
321
)
319
322
} ) ) ,
@@ -383,6 +386,8 @@ pub fn generate_asts<'a>(
383
386
. collect :: < AHashSet < String > > ( ) ,
384
387
) ;
385
388
389
+ println ! ( "Dirty modules: {:?}" , dirty_modules. len( ) ) ;
390
+
386
391
loop {
387
392
let mut num_checked_modules = 0 ;
388
393
for ( module_name, _ast_path, _iast_path, deps, namespace) in results. iter ( ) {
@@ -546,7 +551,7 @@ pub fn parse_packages(
546
551
modules. insert (
547
552
helpers:: file_path_to_module_name ( & mlmap. to_owned ( ) , & None ) ,
548
553
Module {
549
- source_type : SourceType :: MlMap ( MlMap { dirty : true } ) ,
554
+ source_type : SourceType :: MlMap ( MlMap { dirty : false } ) ,
550
555
deps : deps,
551
556
package : package. to_owned ( ) ,
552
557
} ,
@@ -996,17 +1001,31 @@ pub fn build(path: &str) -> Result<AHashMap<std::string::String, Module>, ()> {
996
1001
let start_compiling = Instant :: now ( ) ;
997
1002
998
1003
let mut compiled_modules = AHashSet :: < String > :: new ( ) ;
1004
+ // println!("Clean modules:");
999
1005
let clean_modules = modules
1000
1006
. iter ( )
1001
1007
. filter_map ( |( module_name, module) | {
1002
1008
if is_dirty ( module) {
1003
1009
None
1004
1010
} else {
1011
+ // println!("> {}", module_name);
1005
1012
Some ( module_name. to_owned ( ) )
1006
1013
}
1007
1014
} )
1008
1015
. collect :: < AHashSet < String > > ( ) ;
1009
1016
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
+
1010
1029
// always clean build
1011
1030
// let clean_modules = AHashSet::<String>::new();
1012
1031
@@ -1018,6 +1037,9 @@ pub fn build(path: &str) -> Result<AHashMap<std::string::String, Module>, ()> {
1018
1037
let total_modules = modules. len ( ) ;
1019
1038
1020
1039
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 ) ) ;
1021
1043
files_current_loop_count = 0 ;
1022
1044
loop_count += 1 ;
1023
1045
@@ -1028,14 +1050,15 @@ pub fn build(path: &str) -> Result<AHashMap<std::string::String, Module>, ()> {
1028
1050
loop_count,
1029
1051
) ;
1030
1052
1031
- modules
1053
+ sorted_modules
1054
+ // .iter()
1032
1055
. par_iter ( )
1033
1056
. map ( |( module_name, module) | {
1034
1057
if module. deps . is_subset ( & compiled_modules)
1035
- && !compiled_modules. contains ( module_name)
1058
+ && !compiled_modules. contains ( * module_name)
1036
1059
{
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 ) ) ) ) ;
1039
1062
}
1040
1063
match module. source_type . to_owned ( ) {
1041
1064
SourceType :: MlMap ( _) => {
@@ -1051,6 +1074,7 @@ pub fn build(path: &str) -> Result<AHashMap<std::string::String, Module>, ()> {
1051
1074
}
1052
1075
SourceType :: SourceFile ( source_file) => {
1053
1076
// compile interface first
1077
+ // println!("Compiling {}...", module_name);
1054
1078
let interface_result = match source_file. interface . to_owned ( ) {
1055
1079
Some ( Interface { path, .. } ) => {
1056
1080
let result = compile_file (
@@ -1068,6 +1092,10 @@ pub fn build(path: &str) -> Result<AHashMap<std::string::String, Module>, ()> {
1068
1092
}
1069
1093
_ => None ,
1070
1094
} ;
1095
+ if let Some ( Err ( error) ) = interface_result. to_owned ( ) {
1096
+ println ! ( "{}" , error) ;
1097
+ panic ! ( "Interface compilation error!" ) ;
1098
+ }
1071
1099
1072
1100
let result = compile_file (
1073
1101
& module. package . name ,
@@ -1081,7 +1109,12 @@ pub fn build(path: &str) -> Result<AHashMap<std::string::String, Module>, ()> {
1081
1109
false ,
1082
1110
) ;
1083
1111
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) )
1085
1118
}
1086
1119
}
1087
1120
} else {
0 commit comments