FIX Remaking moved or deleted files
3 files changed, 127 insertions(+), 117 deletions(-)

M README.md
M README.org
M src/pds/pds.ml
M README.md +116 -108
@@ 2,63 2,64 @@ 
 
 # Table of Contents
 
-1.  [About](#org02965e4)
-    1.  [Why Does This Exist?](#org294dbf8)
-2.  [Parallelism](#orgf516fe7)
-3.  [Content Hash Based Builds](#orgf880858)
-4.  [Terminology](#org7942aee)
-5.  [Projects](#orga86e50d)
-    1.  [Ocaml](#orge1b151f)
-    2.  [Third-party](#org4b0ac75)
-6.  [Dependencies](#orgbe9552e)
-7.  [Configuration](#orgdbf0f73)
-    1.  [Configuration Variables For Projects](#orgd33ba2b)
-    2.  [Configuration Variables For Tests](#orgcd63039)
-    3.  [Outputting the configuration](#org4064847)
-8.  [Produced Files](#orgeeca028)
-9.  [Documentation](#org8fce142)
-10. [Selectors](#org218b391)
-11. [Changelog](#orge07e873)
-    1.  [1.0.0](#orgabf8e18)
-    2.  [1.1.0](#org2823268)
-    3.  [2.0.0](#org80b5904)
-    4.  [3.0.0](#org1c16cfa)
-    5.  [3.0.1](#org547ee4e)
-    6.  [3.0.2](#org4e29cbf)
-    7.  [3.0.3](#org9a6a4e9)
-    8.  [3.0.4](#org3de5ad8)
-    9.  [3.1.0](#orgdb15021)
-    10. [3.1.1](#org0f81934)
-    11. [4.11](#org857cd2d)
-    12. [4.12](#org0d8a259)
-    13. [4.13](#orgcf52e1d)
-    14. [5.14](#orgcae44c0)
-    15. [5.15](#orgdfaec27)
-    16. [5.16](#orgd18ee2a)
-    17. [5.17 (bug release)](#org8465c9e)
-    18. [5.18](#org7219af1)
-    19. [5.19](#org785beb4)
-    20. [6.20](#org5c4f0b6)
-    21. [5.21](#orgabd4261)
-    22. [5.22](#orge892d05)
-    23. [5.23](#org68ab407)
-    24. [5.24](#org9a3b6fb)
-    25. [5.25](#orgb6db298)
-    26. [5.26 (bug release)](#org826e4b5)
-    27. [5.27](#orgd1360dd)
-    28. [5.28](#org37927e3)
-    29. [5.29](#orgd7e4b38)
-    30. [6.43](#orge80dc14)
-    31. [6.44](#org8371d9e)
-    32. [6.45](#org335bbc6)
-    33. [6.46](#org6113200)
-    34. [6.47](#org0b074fc)
-    35. [6.48](#org6b172de)
-    36. [6.49](#orgc49bf2b)
-    37. [6.50](#orgc7a8aa1)
+1.  [About](#org4dc0d9e)
+    1.  [Why Does This Exist?](#org41a5fb5)
+2.  [Parallelism](#org2258f2d)
+3.  [Content Hash Based Builds](#org8a6351a)
+4.  [Terminology](#orga794655)
+5.  [Projects](#org967e68b)
+    1.  [Ocaml](#orgfb424a7)
+    2.  [Third-party](#orgc02f0aa)
+6.  [Dependencies](#org85cb810)
+7.  [Configuration](#org29323c2)
+    1.  [Configuration Variables For Projects](#org19b641a)
+    2.  [Configuration Variables For Tests](#org13fd860)
+    3.  [Outputting the configuration](#orge541245)
+8.  [Produced Files](#org8817d43)
+9.  [Documentation](#org52ed257)
+10. [Selectors](#org3c7801f)
+11. [Changelog](#orgca16c02)
+    1.  [1.0.0](#orgdcbf21c)
+    2.  [1.1.0](#orge4f6afb)
+    3.  [2.0.0](#org4776ce2)
+    4.  [3.0.0](#orgd59b0df)
+    5.  [3.0.1](#org2ee99b2)
+    6.  [3.0.2](#org268ddd0)
+    7.  [3.0.3](#orgd634407)
+    8.  [3.0.4](#org31942e6)
+    9.  [3.1.0](#org9522437)
+    10. [3.1.1](#org3564963)
+    11. [4.11](#orgae49dc5)
+    12. [4.12](#org37bf520)
+    13. [4.13](#org93db06e)
+    14. [5.14](#org2eb5e2c)
+    15. [5.15](#org2854eaf)
+    16. [5.16](#orgbf53e76)
+    17. [5.17 (bug release)](#orgf32538f)
+    18. [5.18](#orgb33dbbd)
+    19. [5.19](#org7cc9e29)
+    20. [6.20](#orgd981a1f)
+    21. [5.21](#org9cbf555)
+    22. [5.22](#org20b52e5)
+    23. [5.23](#orgdc58736)
+    24. [5.24](#org9b1f4d4)
+    25. [5.25](#orgaa03264)
+    26. [5.26 (bug release)](#org35de4c8)
+    27. [5.27](#orge109571)
+    28. [5.28](#org9cc2577)
+    29. [5.29](#org818774c)
+    30. [6.43](#org92322e5)
+    31. [6.44](#org7c34947)
+    32. [6.45](#orgae864ef)
+    33. [6.46](#orge7620f0)
+    34. [6.47](#org3d0beb4)
+    35. [6.48](#org896a043)
+    36. [6.49](#orge84fd1c)
+    37. [6.50](#orgaeb25de)
+    38. [6.51](#org6dc86ee)
 
 
-<a id="org02965e4"></a>
+<a id="org4dc0d9e"></a>
 
 # About
 

          
@@ 125,7 126,7 @@ the `build` directory, for example `buil
 `build/test-release`.
 
 
-<a id="org294dbf8"></a>
+<a id="org41a5fb5"></a>
 
 ## Why Does This Exist?
 

          
@@ 138,7 139,7 @@ the existing tooling then you should be 
 meant to be non-intrusive.
 
 
-<a id="orgf516fe7"></a>
+<a id="org2258f2d"></a>
 
 # Parallelism
 

          
@@ 158,7 159,7 @@ the source of the `units Foo and Bar mak
 error.
 
 
-<a id="orgf880858"></a>
+<a id="org8a6351a"></a>
 
 # Content Hash Based Builds
 

          
@@ 178,7 179,7 @@ of the build configuration, this ensure 
 that causes a rebuild.
 
 
-<a id="org7942aee"></a>
+<a id="orga794655"></a>
 
 # Terminology
 

          
@@ 190,7 191,7 @@ that causes a rebuild.
     `library`, this applies only to ocaml projects..
 
 
-<a id="orga86e50d"></a>
+<a id="org967e68b"></a>
 
 # Projects
 

          
@@ 201,7 202,7 @@ interface, which is `release`, `debug`, 
 and `clean`.
 
 
-<a id="orge1b151f"></a>
+<a id="orgfb424a7"></a>
 
 ## Ocaml
 

          
@@ 252,7 253,7 @@ generated.
 </table>
 
 
-<a id="org4b0ac75"></a>
+<a id="orgc02f0aa"></a>
 
 ## Third-party
 

          
@@ 260,7 261,7 @@ Third party projects do not have a `Make
 to have one which corresponds to the pds interface.
 
 
-<a id="orgbe9552e"></a>
+<a id="org85cb810"></a>
 
 # Dependencies
 

          
@@ 271,7 272,7 @@ compiled before its dependent project an
 as a dependency in the dependents `Makefile`.
 
 
-<a id="orgdbf0f73"></a>
+<a id="org29323c2"></a>
 
 # Configuration
 

          
@@ 325,7 326,7 @@ An example of building the example direc
     install = false
 
 
-<a id="orgd33ba2b"></a>
+<a id="org19b641a"></a>
 
 ## Configuration Variables For Projects
 

          
@@ 475,7 476,7 @@ 5.  `src.<project>.<option>`
 The same precedence applies to test builds.
 
 
-<a id="orgcd63039"></a>
+<a id="org13fd860"></a>
 
 ## Configuration Variables For Tests
 

          
@@ 490,7 491,7 @@ 2.  `global.test-<build_type>.<option>`
 3.  `tests.<project>.<option>`
 
 
-<a id="org4064847"></a>
+<a id="orge541245"></a>
 
 ## Outputting the configuration
 

          
@@ 547,7 548,7 @@ output looks like the following:
 </table>
 
 
-<a id="orgeeca028"></a>
+<a id="org8817d43"></a>
 
 # Produced Files
 

          
@@ 560,7 561,7 @@ ignored in the form of a `.gitignore`.
     Ocamlrules.mk.in
 
 
-<a id="org8fce142"></a>
+<a id="org52ed257"></a>
 
 # Documentation
 

          
@@ 574,7 575,7 @@ also be set for `ocamldoc` by modifying 
 `extra_makefile_lines`.
 
 
-<a id="org218b391"></a>
+<a id="org3c7801f"></a>
 
 # Selectors
 

          
@@ 618,12 619,12 @@ The order of precedence is that the sele
 checked, then the selector for a release.
 
 
-<a id="orge07e873"></a>
+<a id="orgca16c02"></a>
 
 # Changelog
 
 
-<a id="orgabf8e18"></a>
+<a id="orgdcbf21c"></a>
 
 ## 1.0.0
 

          
@@ 632,7 633,7 @@ checked, then the selector for a release
 -   Support running tests.
 
 
-<a id="org2823268"></a>
+<a id="orge4f6afb"></a>
 
 ## 1.1.0
 

          
@@ 641,7 642,7 @@ checked, then the selector for a release
     is useful if a tool needs to be built that will be used to compile a project.
 
 
-<a id="org80b5904"></a>
+<a id="org4776ce2"></a>
 
 ## 2.0.0
 

          
@@ 650,7 651,7 @@ checked, then the selector for a release
 -   Fill out the documentation more.
 
 
-<a id="org1c16cfa"></a>
+<a id="orgd59b0df"></a>
 
 ## 3.0.0
 

          
@@ 658,7 659,7 @@ checked, then the selector for a release
     understands both installing and uninstalling projects.
 
 
-<a id="org547ee4e"></a>
+<a id="org2ee99b2"></a>
 
 ## 3.0.1
 

          
@@ 666,14 667,14 @@ checked, then the selector for a release
     after using hll to make the package.
 
 
-<a id="org4e29cbf"></a>
+<a id="org268ddd0"></a>
 
 ## 3.0.2
 
 -   Expand the hll config to pass opam-linter.
 
 
-<a id="org9a6a4e9"></a>
+<a id="orgd634407"></a>
 
 ## 3.0.3
 

          
@@ 681,7 682,7 @@ checked, then the selector for a release
 -   Specify which version of ocaml pds works with.
 
 
-<a id="org3de5ad8"></a>
+<a id="org31942e6"></a>
 
 ## 3.0.4
 

          
@@ 689,7 690,7 @@ checked, then the selector for a release
 -   Remove examples.
 
 
-<a id="orgdb15021"></a>
+<a id="org9522437"></a>
 
 ## 3.1.0
 

          
@@ 697,14 698,14 @@ checked, then the selector for a release
 -   Install `.cmi` files.
 
 
-<a id="org0f81934"></a>
+<a id="org3564963"></a>
 
 ## 3.1.1
 
 -   Fix a bug in generating docs when the project has no dependencies.
 
 
-<a id="org857cd2d"></a>
+<a id="orgae49dc5"></a>
 
 ## 4.11
 

          
@@ 715,21 716,21 @@ checked, then the selector for a release
     name of the output.
 
 
-<a id="org0d8a259"></a>
+<a id="org37bf520"></a>
 
 ## 4.12
 
 -   Include tests directories in formatted output.
 
 
-<a id="orgcf52e1d"></a>
+<a id="org93db06e"></a>
 
 ## 4.13
 
 -   Make a better error message for the install key, which is required.
 
 
-<a id="orgcae44c0"></a>
+<a id="org2eb5e2c"></a>
 
 ## 5.14
 

          
@@ 739,7 740,7 @@ checked, then the selector for a release
 -   Remove PACK support.  Building PACKs is no longer supported.
 
 
-<a id="orgdfaec27"></a>
+<a id="org2854eaf"></a>
 
 ## 5.15
 

          
@@ 747,14 748,14 @@ checked, then the selector for a release
 -   Add a changelog and back fill it.
 
 
-<a id="orgd18ee2a"></a>
+<a id="orgbf53e76"></a>
 
 ## 5.16
 
 -   Fix bug in cleanup logic which concatenated multiple deps
 
 
-<a id="org8465c9e"></a>
+<a id="orgf32538f"></a>
 
 ## 5.17 (bug release)
 

          
@@ 765,7 766,7 @@ checked, then the selector for a release
     first then the .cmo and .cmx are generated.
 
 
-<a id="org7219af1"></a>
+<a id="orgb33dbbd"></a>
 
 ## 5.18
 

          
@@ 778,7 779,7 @@ checked, then the selector for a release
     it.  This solves it by serializing the build for those cases.
 
 
-<a id="org785beb4"></a>
+<a id="org7cc9e29"></a>
 
 ## 5.19
 

          
@@ 786,14 787,14 @@ checked, then the selector for a release
     installs `.cmi` files for all `.ml` files.
 
 
-<a id="org5c4f0b6"></a>
+<a id="orgd981a1f"></a>
 
 ## 6.20
 
 -   Removed the `-custom` option from default byte code builds.
 
 
-<a id="orgabd4261"></a>
+<a id="org9cbf555"></a>
 
 ## 5.21
 

          
@@ 801,7 802,7 @@ checked, then the selector for a release
     them to be overridden.
 
 
-<a id="orge892d05"></a>
+<a id="org20b52e5"></a>
 
 ## 5.22
 

          
@@ 809,28 810,28 @@ checked, then the selector for a release
 -   Tests compile with `OCAML*_LINK_OPTS` just like regular builds.
 
 
-<a id="org68ab407"></a>
+<a id="orgdc58736"></a>
 
 ## 5.23
 
 -   Fix typo in PARALLEL
 
 
-<a id="org9a3b6fb"></a>
+<a id="org9b1f4d4"></a>
 
 ## 5.24
 
 -   Build cmti files and install them for every library.
 
 
-<a id="orgb6db298"></a>
+<a id="orgaa03264"></a>
 
 ## 5.25
 
 -   Support adding linkopts to the META file.
 
 
-<a id="org826e4b5"></a>
+<a id="org35de4c8"></a>
 
 ## 5.26 (bug release)
 

          
@@ 838,14 839,14 @@ checked, then the selector for a release
 -   Add some tests.
 
 
-<a id="orgd1360dd"></a>
+<a id="orge109571"></a>
 
 ## 5.27
 
 -   Fix bug in section name for the selector.
 
 
-<a id="org37927e3"></a>
+<a id="org9cc2577"></a>
 
 ## 5.28
 

          
@@ 853,7 854,7 @@ checked, then the selector for a release
     were not properly looked up.
 
 
-<a id="orgd7e4b38"></a>
+<a id="org818774c"></a>
 
 ## 5.29
 

          
@@ 862,59 863,66 @@ checked, then the selector for a release
     worked).
 
 
-<a id="orge80dc14"></a>
+<a id="org92322e5"></a>
 
 ## 6.43
 
 -   Move to content based hashing.
 
 
-<a id="org8371d9e"></a>
+<a id="org7c34947"></a>
 
 ## 6.44
 
 -   Fix install directive
 
 
-<a id="org335bbc6"></a>
+<a id="orgae864ef"></a>
 
 ## 6.45
 
 -   Better sqlite error reporting
 
 
-<a id="org6113200"></a>
+<a id="orge7620f0"></a>
 
 ## 6.46
 
 -   strftime usage that works on Alpine
 
 
-<a id="org0b074fc"></a>
+<a id="org3d0beb4"></a>
 
 ## 6.47
 
 -   Another instance of strftime
 
 
-<a id="org6b172de"></a>
+<a id="org896a043"></a>
 
 ## 6.48
 
 -   Fix bugs in testing outputs.
 
 
-<a id="orgc49bf2b"></a>
+<a id="orge84fd1c"></a>
 
 ## 6.49
 
 -   Improve performance 10x by batching database operations.
 
 
-<a id="orgc7a8aa1"></a>
+<a id="orgaeb25de"></a>
 
 ## 6.50
 
 -   Fix handling file renames or deletes.  Pds would remake the file, thinking
     that its hash had been changed, when in reality it didn't exist.
 
+
+<a id="org6dc86ee"></a>
+
+## 6.51
+
+-   Remove target files from build dir when a file is deleted
+

          
M README.org +2 -0
@@ 435,3 435,5 @@ checked, then the selector for a release
 ** 6.50
 - Fix handling file renames or deletes.  Pds would remake the file, thinking
   that its hash had been changed, when in reality it didn't exist.
+** 6.51
+- Remove target files from build dir when a file is deleted

          
M src/pds/pds.ml +9 -9
@@ 374,11 374,11 @@ module Hash_db = struct
 
   let remove_deleted_files srcs tests paths =
     let build_class_of_path =
-      (* Given a string like "srcs/foo/bar" we want "srcs" *)
+      (* Given a string like "src/foo/bar" we want "src" *)
       CCFun.(CCString.rev %> Filename.basename %> CCString.rev)
     in
     let build_name_of_path =
-      (* Given a string like "srcs/foo/bar" we want "foo" *)
+      (* Given a string like "src/foo/bar" we want "foo" *)
       CCFun.(CCString.rev %> Filename.dirname %> Filename.basename %> CCString.rev)
     in
     let srcs_map =

          
@@ 398,12 398,12 @@ module Hash_db = struct
     CCList.iter
       (fun fname ->
         match (build_class_of_path fname, build_name_of_path fname) with
-        | "srcs", build_name -> (
+        | "src", build_name -> (
             match String_map.find_opt build_name srcs_map with
             | Some builds ->
                 (* Found builds, clean up the matching files in the builds.  We
-                  are assuming that files looke like "base_name."  So foo.ml
-                  would be foo.* *)
+                   are assuming that files look like "base_name."  So foo.ml
+                   would be foo.* *)
                 CCList.iter
                   (fun { Build.Src.build_type; _ } -> cleanup_files build_type build_name fname)
                   builds

          
@@ 415,8 415,8 @@ module Hash_db = struct
             match String_map.find_opt build_name tests_map with
             | Some builds ->
                 (* Found builds, clean up the matching files in the builds.  We
-                  are assuming that files looke like "base_name."  So foo.ml
-                  would be foo.* *)
+                   are assuming that files look like "base_name."  So foo.ml
+                   would be foo.* *)
                 CCList.iter
                   (fun { Build.Test.build_type; _ } ->
                     cleanup_files ("test-" ^ build_type) build_name fname)

          
@@ 529,8 529,8 @@ module Hash_db = struct
     let stmt =
       Sqlite3.prepare
         db
-        "select lr.path from last_run as lr left join hashes on hashes.path = lr.path where \
-         hashes.path is null"
+        "select hashes.path from hashes left join last_run as lr on hashes.path = lr.path where \
+         lr.path is null"
     in
     let rc, rows =
       Sqlite3.fold