Skip to content

Commit

Permalink
add sort for compilable-namespaces for consistency of compilation order
Browse files Browse the repository at this point in the history
  • Loading branch information
Logan Girard authored and Logan Girard committed Dec 31, 2018
1 parent 8584ea6 commit 76dbf7c
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 3 deletions.
6 changes: 5 additions & 1 deletion leiningen-core/pom.xml
Expand Up @@ -14,7 +14,11 @@
</license>
</licenses>
<scm>
<tag>eedfbd673fa8fed03edd6a081f3ba8825ba2bf63</tag>
<connection>scm:git:git://github.com/technomancy/leiningen.git</connection>
<developerConnection>scm:git:ssh://git@github.com/technomancy/leiningen.git</developerConnection>
<tag>8584ea670627528a2c67ba1c8d3236608ad4fa3e
</tag>
<url>https://github.com/technomancy/leiningen</url>
</scm>
<build>
<sourceDirectory>src</sourceDirectory>
Expand Down
2 changes: 1 addition & 1 deletion src/leiningen/compile.clj
Expand Up @@ -33,7 +33,7 @@
"Return a seq of namespaces that are both compilable and that have missing or
out-of-date class files."
[project]
(for [namespace (compilable-namespaces project)
(for [namespace (sort (compilable-namespaces project))
:let [[rel-source source]
(or (first (for [source-path (:source-paths project)
rel-source (map (partial b/path-for namespace) ["clj" "cljc"])
Expand Down
11 changes: 10 additions & 1 deletion test/leiningen/test/compile.clj
Expand Up @@ -4,7 +4,9 @@
[clojure.java.io :only [file]]
[clojure.java.shell :only [with-sh-dir]]
[leiningen.compile]
[leiningen.test.helper :only [sample-project delete-file-recursively
[leiningen.test.helper :only [sample-project
delete-file-recursively
sample-ordered-aot-project
sample-failing-project
sample-reader-cond-project
tricky-name-project
Expand All @@ -31,6 +33,13 @@
(is (.exists (file "test_projects" "sample" "target"
"classes" "nom" "nom" "nom.class"))))

(deftest test-compile-order-sorted
(print (str "Count for compile: " (count (compilable-namespaces sample-ordered-aot-project))))
(is (= 0
(compare
(vec (compilable-namespaces sample-ordered-aot-project))
(vec (sort (compilable-namespaces sample-ordered-aot-project)))))))

(deftest test-compile-regex
(compile more-gen-classes-project "#\"\\.ba.$\"")
(is (.exists (file "test_projects" "more-gen-classes" "target"
Expand Down
2 changes: 2 additions & 0 deletions test/leiningen/test/helper.clj
Expand Up @@ -44,6 +44,8 @@

(def sample-no-aot-project (read-test-project "sample-no-aot"))

(def sample-ordered-aot-project (read-test-project "sample-ordered-aot"))

(def sample-profile-meta-project (read-test-project "sample-profile-meta"))

(def sample-reader-cond-project (read-test-project "sample-reader-cond"))
Expand Down
7 changes: 7 additions & 0 deletions test_projects/sample-ordered-aot/project.clj
@@ -0,0 +1,7 @@
(defproject sample-ordered-aot "0.1.0-SNAPSHOT"
:description "This project is to drive testing of ordered aot compilation."
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.8.0"]]
:aot :all)
@@ -0,0 +1,6 @@
(ns sample-ordered-aot.baz)

(defn baz
"I don't do a whole lot."
[x]
(println x "Hello, World!"))
@@ -0,0 +1,6 @@
(ns sample-ordered-aot.foo)

(defn foo
"I don't do a whole lot."
[x]
(println x "Hello, World!"))

0 comments on commit 76dbf7c

Please sign in to comment.