@@ -828,10 +828,14 @@ do_build: (targets: std::vector<std::string>) -> (stuff: full_build_info, exit_c
828
828
transpile_futures: std::vector<std::future<transpile_cpp2_result>> = ();
829
829
cpp2b_parse_futures: std::vector<std::future<cpp2b_source_info>> = ();
830
830
file_hash_futures: std::unordered_map<fs::path, std::future<u64>> = ();
831
+ file_hashes: std::unordered_map<fs::path, u64> = ();
832
+ prev_file_hashes: std::unordered_map<fs::path, u64> = ();
831
833
832
834
transpile_futures.reserve(cpp2_source_files.size());
833
835
cpp2b_parse_futures.reserve(cpp2_source_files.size());
834
836
file_hash_futures.reserve(cpp2_source_files.size());
837
+ file_hashes.reserve(cpp2_source_files.size());
838
+ prev_file_hashes.reserve(cpp2_source_files.size());
835
839
836
840
for cpp2_source_files do(src_file: fs::path) {
837
841
file_hash_futures.insert(std::make_pair(
@@ -846,8 +850,53 @@ do_build: (targets: std::vector<std::string>) -> (stuff: full_build_info, exit_c
846
850
p := entry.first;
847
851
hash_fut := entry.second&;
848
852
hash := hash_fut*.get();
853
+ file_hashes.insert(std::make_pair(p, hash));
854
+ }
855
+
856
+ data_file: std::fstream = (".cache/cpp2/.data", std::ios::binary | std::ios::in);
857
+
858
+ while data_file {
859
+ path_length: u16 = 0;
860
+ data_file >> path_length;
861
+ if !data_file { break; }
862
+
863
+ p: std::string = "";
864
+ p.resize(path_length);
865
+ data_file.read(p.data(), path_length);
866
+ if !data_file { break; }
867
+
868
+ path_hash: u64 = 0;
869
+ data_file.read(reinterpret_cast<*char>(path_hash&), 8);
870
+ if !data_file { break; }
871
+
872
+ prev_file_hashes[fs::path(p)] = path_hash;
873
+ }
874
+
875
+ for file_hashes do(inout entry) {
876
+ p := entry.first;
877
+ hash := entry.second;
878
+
879
+ if prev_file_hashes.contains(p) {
880
+ if prev_file_hashes.at(p) == hash {
881
+ log_info("{} no change", p.generic_string());
882
+ } else {
883
+ log_info("{} changed", p.generic_string());
884
+ }
885
+ } else {
886
+ log_info("new file {}", p.generic_string());
887
+ }
888
+ }
889
+
890
+ data_file.close();
891
+ data_file.open(".cache/cpp2/.data", std::ios::binary | std::ios::out | std::ios::trunc);
892
+
893
+ for file_hashes do(inout entry) {
894
+ p := entry.first.generic_string();
895
+ hash := entry.second;
849
896
850
- log_info("{} hash is {}", p.generic_string(), hash);
897
+ data_file << unsafe_cast<u16>(p.size());
898
+ data_file.write(p.data(), p.size());
899
+ data_file.write(reinterpret_cast<*char>(hash&), 8);
851
900
}
852
901
853
902
for transpile_futures do(inout fut) {
0 commit comments