Fix post-AOT cleanup to use package-based deletion heuristic.
We had it so every .class file had to correspond with a .clj file in src/, but sometimes there are outliers that don't match up. So instead we now ensure that there's a directory in src/ that matches the package of each .class file.
This commit is contained in:
parent
b837ebc20a
commit
e66622a8e2
1 changed files with 7 additions and 9 deletions
|
@ -177,21 +177,19 @@
|
||||||
"NUL"
|
"NUL"
|
||||||
"/dev/null")))
|
"/dev/null")))
|
||||||
|
|
||||||
(defn- has-corresponding-src?
|
(defn- has-source-package?
|
||||||
"Test if the given class file path exists in the source folder."
|
"Test if the class file's package exists as a directory in :source-path."
|
||||||
[project f]
|
[project f]
|
||||||
(.exists (file (:source-path project)
|
(.isDirectory (doto (file (.replace (.getParent f)
|
||||||
(-> (.getAbsolutePath f)
|
(:compile-path project)
|
||||||
(.replaceAll "\\$\\w*\\.class$" ".clj")
|
(:source-path project)))
|
||||||
(.replaceAll "__init\\.class$" ".clj")
|
println)))
|
||||||
(.replaceAll "\\.class$" ".clj")
|
|
||||||
(.replace (str (:compile-path project) "/") "")))))
|
|
||||||
|
|
||||||
(defn delete-non-project-classes [project]
|
(defn delete-non-project-classes [project]
|
||||||
(when (and (not= :all (:aot project))
|
(when (and (not= :all (:aot project))
|
||||||
(not (:keep-non-project-classes project)))
|
(not (:keep-non-project-classes project)))
|
||||||
(doseq [f (file-seq (file (:compile-path project)))
|
(doseq [f (file-seq (file (:compile-path project)))
|
||||||
:when (and (.isFile f) (not (has-corresponding-src? project f)))]
|
:when (and (.isFile f) (not (has-source-package? project f)))]
|
||||||
(.delete f))))
|
(.delete f))))
|
||||||
|
|
||||||
(defn- status [code msg]
|
(defn- status [code msg]
|
||||||
|
|
Loading…
Reference in a new issue