diff --git a/readme.md b/readme.md index ab92282..0de0271 100644 --- a/readme.md +++ b/readme.md @@ -322,7 +322,7 @@ example cmd-line # link to bases/cmd-line/src/se/example/cmd-line ``` -If we have a look at some of the generated files, we first find *systems/cmd-line/src/se/example/cmd_line/core.clj*: +If we have a look at some of the generated files, we first find *bases/cmd-line/src/se/example/cmd_line/core.clj*: ```clojure (ns se.example.cmd-line.core (:gen-class)) @@ -332,7 +332,7 @@ If we have a look at some of the generated files, we first find *systems/cmd-lin (println "Hello world!")) ``` -...with its corresponding test *systems/cmd-line/test/se/example/cmd_line/core_test.clj*: +...with its corresponding test *bases/cmd-line/test/se/example/cmd_line/core_test.clj*: ```clojure (ns se.example.cmd-line.core-test (:require [clojure.test :refer :all] @@ -372,8 +372,8 @@ Changed bases: cmd-line Changed systems: cmd-line Compiling workspace interfaces -Created /Users/joakimtengstrand/Dropbox/Polylith/doc-script/example/interfaces/target/interfaces-1.0.jar -Wrote /Users/joakimtengstrand/Dropbox/Polylith/doc-script/example/interfaces/pom.xml +Created /Users/joakimtengstrand/IdeaProjects/example/interfaces/target/interfaces-1.0.jar +Wrote /Users/joakimtengstrand/IdeaProjects/example/interfaces/pom.xml Installed jar and pom into local repo. Compiling bases/cmd-line @@ -389,8 +389,8 @@ Ran 1 tests containing 1 assertions. 0 failures, 0 errors. Building systems/cmd-line -Created /Users/joakimtengstrand/Dropbox/Polylith/doc-script/example/systems/cmd-line/target/cmd-line-0.1.jar -Created /Users/joakimtengstrand/Dropbox/Polylith/doc-script/example/systems/cmd-line/target/cmd-line-0.1-standalone.jar +Created /Users/joakimtengstrand/IdeaProjects/example/systems/cmd-line/target/cmd-line-0.1.jar +Created /Users/joakimtengstrand/IdeaProjects/example/systems/cmd-line/target/cmd-line-0.1-standalone.jar set :last-success in .polylith/time.edn @@ -673,9 +673,9 @@ Now we have a *cmd-line* base and a *user* component: $ lein polylith info interfaces: - user * + user components: - user * + user bases: cmd-line systems: @@ -683,7 +683,7 @@ systems: cmd-line -> base environments: development - user * -> component + user -> component cmd-line -> base ``` @@ -1232,26 +1232,24 @@ Finally you push your changes (5) and then the same plugin code will be executed To understand how the plugin figures out what components and bases that have changed we can start by looking at the [diff](#diff) command: ``` $ lein polylith diff -interfaces/src/se/example/address/interface.clj + interfaces/src/se/example/address/interface.clj systems/cmd-line/src/se/example/user/core.clj systems/cmd-line/project.clj components/address/src/se/example/address/interface.clj components/address/src/se/example/address/core.clj + components/address/readme.md components/address/test/se/example/address/core_test.clj components/address/project.clj components/user/src/se/example/user/core.clj components/user/project.clj - bases/cmd-line/project.clj environments/development/src/se/example/address/interface.clj environments/development/src/se/example/address/core.clj environments/development/src/se/example/user/core.clj environments/development/interfaces/se/example/address/interface.clj - environments/development/development.iml environments/development/docs/address-readme.md environments/development/project-files/systems/cmd-line-project.clj environments/development/project-files/components/address-project.clj environments/development/project-files/components/user-project.clj - environments/development/project-files/bases/cmd-line-project.clj environments/development/test/se/example/address/core_test.clj environments/development/project.clj ``` @@ -1340,17 +1338,17 @@ components: address-fake * > address user * bases: - cmd-line * + cmd-line (*) systems: cmd-line * - address * -> component - user * -> component - cmd-line * -> base + address * -> component + user * -> component + cmd-line (*) -> base environments: development - address * -> component - user * -> component - cmd-line * -> base + address * -> component + user * -> component + cmd-line (*) -> base ``` Now create the *cmd-line-test* system using the *cmd-line* base and then add *user* and *address-fake* to it: diff --git a/src/leiningen/polylith/cmd/add.clj b/src/leiningen/polylith/cmd/add.clj index 7fae449..1a12ef4 100644 --- a/src/leiningen/polylith/cmd/add.clj +++ b/src/leiningen/polylith/cmd/add.clj @@ -4,20 +4,20 @@ [leiningen.polylith.utils :as utils])) (defn system-components [ws-path top-dir system] - (let [dir (shared/full-name top-dir "/" "") - components (shared/all-components ws-path) + (let [dir (shared/full-name top-dir "/" "") + components (shared/all-components ws-path) directories (file/directories (str ws-path "/systems/" system "/src/" dir))] - (filterv #(contains? components %) (map shared/path->file directories)))) + (filterv #(contains? components %) (map #(shared/link->entity ws-path %) directories)))) (defn used-interface [ws-path top-dir system component] - (let [interface (shared/interface-of ws-path top-dir component) - components (system-components ws-path top-dir system) + (let [interface (shared/interface-of ws-path top-dir component) + components (system-components ws-path top-dir system) component-interfaces (map #(vector (shared/interface-of ws-path top-dir %) %) components)] (first (filter #(= interface (first %)) component-interfaces)))) (defn validate [ws-path top-dir system component] (let [components (shared/all-components ws-path) - systems (shared/all-systems ws-path) + systems (shared/all-systems ws-path) [interface comp] (used-interface ws-path top-dir system component)] (cond (utils/is-empty-str? component) [false "Missing component name."] @@ -28,18 +28,14 @@ :else [true]))) (defn add-component-to-system [ws-path top-dir component system] - (let [component-dir (shared/full-dir-name top-dir component) - system-dir (shared/full-dir-name top-dir system) + (let [system-dir (shared/full-dir-name top-dir system) relative-parent-path (shared/relative-parent-path system-dir) relative-component-path (str relative-parent-path "components/" component) system-path (str ws-path "/systems/" system) interface (shared/interface-of ws-path top-dir component) interface-dir (shared/full-dir-name top-dir interface)] - (when (not= interface component) - (file/create-symlink (str system-path "/src/" interface-dir) - (str relative-component-path "/src/" interface-dir))) - (file/create-symlink (str system-path "/src/" component-dir) - (str relative-component-path "/src/" component-dir)) + (file/create-symlink (str system-path "/src/" interface-dir) + (str relative-component-path "/src/" interface-dir)) (file/create-symlink (str system-path "/resources/" component) (str "../../../components/" component "/resources/" component)))) diff --git a/src/leiningen/polylith/cmd/create/component.clj b/src/leiningen/polylith/cmd/create/component.clj index 16b4aaf..0dbbf0b 100644 --- a/src/leiningen/polylith/cmd/create/component.clj +++ b/src/leiningen/polylith/cmd/create/component.clj @@ -2,32 +2,32 @@ (:require [clojure.string :as str] [leiningen.polylith.cmd.create.interface :as create-ifc] [leiningen.polylith.cmd.shared :as shared] - [leiningen.polylith.file :as file])) + [leiningen.polylith.file :as file] + [clojure.set :as set])) (defn create-dev-links? [ws-path top-dir dev-dir interface] - (let [dir (str ws-path "/environments/" dev-dir "/src/" top-dir) + (let [dir (str ws-path "/environments/" dev-dir "/src/" top-dir) entities (set (file/directory-names dir))] (not (contains? entities interface)))) (defn used-by-component [ws-path top-dir dev-dir interface] - (let [dir (str ws-path "/environments/" dev-dir "/src/" top-dir) - entities (set (file/directory-names dir)) - component (first (filter #(= interface (shared/interface-of ws-path top-dir %)) entities))] - component)) + (let [dir (str ws-path "/environments/" dev-dir "/src/" top-dir) + paths (file/directories dir) + entities (set (map #(shared/link->entity ws-path %) paths)) + components (set/intersection entities (shared/all-components ws-path))] + (first (filter #(= interface (shared/interface-of ws-path top-dir %)) components)))) (defn create-dev-links! [ws-path dev-dir component interface-dir component-dir] - (let [root (str ws-path "/environments/" dev-dir) - relative-parent-path (shared/relative-parent-path component-dir) - path (str "../../../components/" component) + (let [root (str ws-path "/environments/" dev-dir) + relative-parent-path (shared/relative-parent-path component-dir) + path (str "../../../components/" component) relative-component-path (str relative-parent-path "components/" component)] (file/create-symlink (str root "/docs/" component "-readme.md") (str path "/readme.md")) (file/create-symlink (str root "/project-files/components/" component "-project.clj") (str "../" path "/project.clj")) - (file/create-symlink (str root "/src/" component-dir) - (str relative-component-path "/src/" component-dir)) - (file/create-symlink (str root "/test/" component-dir) - (str relative-component-path "/test/" component-dir)) + (file/create-symlink (str root "/test/" interface-dir) + (str relative-component-path "/test/" interface-dir)) (file/create-symlink (str root "/src/" interface-dir) (str relative-component-path "/src/" interface-dir)) (file/create-symlink (str root "/resources/" component) @@ -39,16 +39,15 @@ component-dir (shared/full-dir-name top-dir component) comp-root-dir (str ws-path "/components/" component) interface-ns-name (shared/full-name top-ns "." interface) - component-ns-name (shared/full-name top-ns "." component) project-ns (shared/full-name top-ns "/" component) interfaces-dependencies (shared/full-name top-ns "/" "interfaces") delegate-content [(str "(ns " interface-ns-name ".interface") - (str " (:require [" component-ns-name ".core :as core]))") + (str " (:require [" interface-ns-name ".core :as core]))") "" ";; delegate to the implementations..." "(defn add-two [x]" " (core/add-two x))"] - core-content [(str "(ns " component-ns-name ".core)") + core-content [(str "(ns " interface-ns-name ".core)") "" ";; add your functions here..." "(defn add-two [x]" @@ -56,7 +55,7 @@ doc-content [(str "# " component " component") "" "add documentation here..."] - test-content [(str "(ns " component-ns-name ".core-test") + test-content [(str "(ns " interface-ns-name ".core-test") (str " (:require [clojure.test :refer :all]") (str " [" interface-ns-name ".interface :as " component "]))") "" @@ -75,13 +74,13 @@ (file/create-file (str comp-root-dir "/resources/.keep") [""]) (file/create-dir (str comp-root-dir "/resources/" component)) (file/create-file (str comp-root-dir "/resources/" component "/.keep") [""]) - (shared/create-src-dirs! ws-path (str "components/" component "/src") [interface-dir component-dir]) - (shared/create-src-dirs! ws-path (str "components/" component "/test") [component-dir]) + (shared/create-src-dirs! ws-path (str "components/" component "/src") [interface-dir]) + (shared/create-src-dirs! ws-path (str "components/" component "/test") [interface-dir]) (file/create-file (str comp-root-dir "/project.clj") project-content) (file/create-file (str comp-root-dir "/readme.md") doc-content) (file/create-file (str comp-root-dir "/src/" interface-dir "/interface.clj") delegate-content) - (file/create-file (str comp-root-dir "/src/" component-dir "/core.clj") core-content) - (file/create-file (str comp-root-dir "/test/" component-dir "/core_test.clj") test-content) + (file/create-file (str comp-root-dir "/src/" interface-dir "/core.clj") core-content) + (file/create-file (str comp-root-dir "/test/" interface-dir "/core_test.clj") test-content) (when-not (file/file-exists (str ws-path "/interfaces/src/" interface-dir)) (create-ifc/create-interface ws-path top-dir top-ns interface)) diff --git a/src/leiningen/polylith/cmd/delete/component.clj b/src/leiningen/polylith/cmd/delete/component.clj index 6cf2ceb..1d65e86 100644 --- a/src/leiningen/polylith/cmd/delete/component.clj +++ b/src/leiningen/polylith/cmd/delete/component.clj @@ -5,16 +5,16 @@ (defn delete-env-interface [ws-path top-dir env interface] (file/delete-dir (str ws-path "/environments/" env "/src/" (shared/full-dir-name top-dir interface)))) -(defn delete-env-component [ws-path top-dir env component] +(defn delete-env-component [ws-path top-dir env component interface] (let [root-dir (str ws-path "/environments/" env)] - (file/delete-file! (str root-dir "/src/" (shared/full-dir-name top-dir component))) - (file/delete-file! (str root-dir "/test/" (shared/full-dir-name top-dir component))) + (file/delete-file! (str root-dir "/src/" (shared/full-dir-name top-dir interface))) + (file/delete-file! (str root-dir "/test/" (shared/full-dir-name top-dir interface))) (file/delete-file! (str root-dir "/docs/" component "-readme.md")) (file/delete-file! (str root-dir "/project-files/components/" component "-project.clj")) (file/delete-file! (str root-dir "/resources/" component)))) -(defn delete-system-component [ws-path top-dir system component] - (file/delete-file! (str ws-path "/systems/" system "/src/" (shared/full-dir-name top-dir component))) +(defn delete-system-component [ws-path top-dir system component interface] + (file/delete-file! (str ws-path "/systems/" system "/src/" (shared/full-dir-name top-dir interface))) (file/delete-file! (str ws-path "/systems/" system "/resources/" component))) (defn delete [ws-path top-dir component] @@ -27,8 +27,8 @@ (file/delete-dir (str ws-path "/interfaces/src/" (shared/full-dir-name top-dir interface)))) (file/delete-dir (str ws-path "/components/" component)) (doseq [system systems] - (delete-system-component ws-path top-dir system component)) + (delete-system-component ws-path top-dir system component interface)) (doseq [env environments] - (delete-env-component ws-path top-dir env component) + (delete-env-component ws-path top-dir env component interface) (when (not= component interface) (delete-env-interface ws-path top-dir env interface))))) diff --git a/src/leiningen/polylith/cmd/deps.clj b/src/leiningen/polylith/cmd/deps.clj index f4782c0..496b8a0 100644 --- a/src/leiningen/polylith/cmd/deps.clj +++ b/src/leiningen/polylith/cmd/deps.clj @@ -123,8 +123,8 @@ (let [content (file/read-file (str file))] (imported-interfaces content interface-ns->interface))) -(defn ifc-deps [ws-path top-dir entity-type entity entity-dir interface-ns->interface] - (let [dir (str ws-path "/" entity-type "/" entity "/src/" (shared/full-dir-name top-dir entity-dir)) +(defn ifc-deps [ws-path top-dir entity-type entity interface-ns->interface] + (let [dir (str ws-path "/" entity-type "/" entity "/src/" top-dir) files (filterv #(str/ends-with? % ".clj") (file/files dir))] (vec (mapcat #(imported-comp-deps % interface-ns->interface) files)))) @@ -140,12 +140,9 @@ (let [dir (if (= "" top-dir) "" (str "/" top-dir)) interfaces-dir (str ws-path "/interfaces/src" dir) interface-ns->interface (interface-ns->interface-map interfaces-dir) - ifc-component-deps (mapv (fn [[component interface]] (vector component - (ifc-deps ws-path top-dir "components" component interface interface-ns->interface))) - (unique-interfaces ws-path top-dir used-components)) - comp-ifc-deps (mapv #(vector % (ifc-deps ws-path top-dir "components" % % interface-ns->interface)) used-components) - base-ifc-deps (mapv #(vector % (ifc-deps ws-path top-dir "bases" % % interface-ns->interface)) used-bases)] - (reduce ->deps (sorted-map) (concat ifc-component-deps comp-ifc-deps base-ifc-deps)))) + comp-ifc-deps (mapv #(vector % (ifc-deps ws-path top-dir "components" % interface-ns->interface)) used-components) + base-ifc-deps (mapv #(vector % (ifc-deps ws-path top-dir "bases" % interface-ns->interface)) used-bases)] + (reduce ->deps (sorted-map) (concat comp-ifc-deps base-ifc-deps)))) (defn component-dependencies ([ws-path top-dir] diff --git a/src/leiningen/polylith/cmd/info.clj b/src/leiningen/polylith/cmd/info.clj index 3afd61b..bfb93ae 100644 --- a/src/leiningen/polylith/cmd/info.clj +++ b/src/leiningen/polylith/cmd/info.clj @@ -38,7 +38,7 @@ (let [path (file/file->real-path file) changed-base (changed-base? ws-path path changed-bases changed-entities-by-ref) changed-component (changed-component? ws-path path changed-components changed-entities-by-ref)] - {:name (file/path->dir-name path) + {:name (shared/link->entity ws-path (file/file path)) :type (cond (:base? changed-base) "-> base" (:component? changed-component) "-> component" @@ -52,19 +52,19 @@ (:component? changed-component) (:changed-by-ref? changed-component) :else false)})) -(defn keep? [entity-path bases components] +(defn keep? [entity-path bases interfaces] (let [entity (file/path->dir-name entity-path)] (or (contains? bases entity) - (contains? components entity)))) + (contains? interfaces entity)))) -(defn system-links [ws-path top-dir system bases components changed-bases changed-components changed-entities-by-ref] +(defn system-links [ws-path top-dir system bases interfaces changed-bases changed-components changed-entities-by-ref] (let [dir (if (zero? (count top-dir)) "/src" (str "/src/" top-dir)) - entity-paths (file/directories (str ws-path "/systems/" system dir))] + entity-paths (vec (file/directories (str ws-path "/systems/" system dir)))] (mapv #(changed? ws-path % changed-bases changed-components changed-entities-by-ref) - (filter #(keep? % bases components) entity-paths)))) + (filter #(keep? % bases interfaces) entity-paths)))) -(defn systems-info [ws-path top-dir systems bases components changed-bases changed-components changed-entities-by-ref] - (into {} (mapv (juxt identity #(system-links ws-path top-dir % bases components changed-bases changed-components changed-entities-by-ref)) systems))) +(defn systems-info [ws-path top-dir systems bases interfaces changed-bases changed-components changed-entities-by-ref] + (into {} (mapv (juxt identity #(system-links ws-path top-dir % bases interfaces changed-bases changed-components changed-entities-by-ref)) systems))) (defn any-changes? [systems-info system] (or (some true? (map :changed? (systems-info system))) false)) @@ -142,11 +142,12 @@ (let [systems (shared/all-systems ws-path) environments (shared/all-environments ws-path) bases (shared/all-bases ws-path) + interfaces (shared/all-interfaces ws-path top-dir) components (shared/all-components ws-path) ch-bases (changed-bases nil paths bases) ch-components (changed-components nil paths components) changed-entities (set (concat ch-bases ch-components)) - infos (systems-info ws-path top-dir systems bases components ch-bases ch-components #{}) + infos (systems-info ws-path top-dir systems bases interfaces ch-bases ch-components #{}) envs (environments-info ws-path top-dir environments ch-bases ch-components #{})] (set (concat (environments-deps ws-path top-dir changed-entities envs) (environments-deps ws-path top-dir changed-entities infos))))) @@ -170,8 +171,8 @@ (let [systems (shared/all-systems ws-path) environments (shared/all-environments ws-path) bases (shared/all-bases ws-path) - components (shared/all-components ws-path) - sinfos (systems-info ws-path top-dir systems bases components #{} #{} #{}) + interfaces (shared/all-interfaces ws-path top-dir) + sinfos (systems-info ws-path top-dir systems bases interfaces #{} #{} #{}) einfos (environments-info ws-path top-dir environments #{} #{} #{}) res1 (envs->circular-deps ws-path top-dir sinfos) res2 (envs->circular-deps ws-path top-dir einfos) @@ -192,7 +193,7 @@ top-dir (shared/all-systems ws-path) (shared/all-bases ws-path) - (shared/all-components ws-path) + (shared/all-interfaces ws-path top-dir) (changed-bases ws-path paths) (changed-components ws-path paths) (all-indirect-changes ws-path top-dir paths)) @@ -224,7 +225,7 @@ :changed-systems-dir (all-changed-systems-dir paths) :changed-entities-by-ref ch-entities-by-ref :circular-dependencies (circular-dependencies ws-path top-dir) - :systems-info (systems-info ws-path top-dir systems bases components ch-bases ch-components ch-entities-by-ref) + :systems-info (systems-info ws-path top-dir systems bases interfaces ch-bases ch-components ch-entities-by-ref) :environments-info (environments-info ws-path top-dir environments ch-bases ch-components ch-entities-by-ref)})) (defn print-entity diff --git a/src/leiningen/polylith/cmd/shared.clj b/src/leiningen/polylith/cmd/shared.clj index a95d525..a5f47c2 100644 --- a/src/leiningen/polylith/cmd/shared.clj +++ b/src/leiningen/polylith/cmd/shared.clj @@ -167,10 +167,17 @@ (assoc m interface (conj (m interface) component)) (assoc m interface [component]))) +(defn link->entity [ws-path path] + (try + (nth (str/split (subs (file/file->real-path path) + (count ws-path)) #"/") + 2) + (catch Exception _))) + (defn used-entities ([ws-path top-dir type system-or-env] (let [path (str ws-path "/" type "/" system-or-env "/src/" top-dir)] - (set (file/directory-names path)))) + (set (map #(link->entity ws-path %) (file/directories path))))) ([ws-path top-dir system-or-env] (set (concat (used-entities ws-path top-dir "systems" system-or-env) (used-entities ws-path top-dir "environments" system-or-env)))) diff --git a/src/leiningen/polylith/cmd/sync/components.clj b/src/leiningen/polylith/cmd/sync/components.clj index 357d7e8..03d856e 100644 --- a/src/leiningen/polylith/cmd/sync/components.clj +++ b/src/leiningen/polylith/cmd/sync/components.clj @@ -19,7 +19,7 @@ (defn add-missing-components-to-system! [ws-path top-dir system] (let [system-path (str ws-path "/systems/" system) src-path (str system-path "/src/" top-dir) - entities (set (file/directory-names src-path)) + entities (set (map #(shared/link->entity ws-path %) (file/directories src-path))) all-bases (shared/all-bases ws-path) all-components (shared/all-components ws-path) all-interfaces (shared/all-interfaces ws-path top-dir) diff --git a/test/leiningen/polylith/cmd/add_test.clj b/test/leiningen/polylith/cmd/add_test.clj index 63f8bf8..513f02e 100644 --- a/test/leiningen/polylith/cmd/add_test.clj +++ b/test/leiningen/polylith/cmd/add_test.clj @@ -64,15 +64,14 @@ "components/comp1/src" "components/comp1/src/my" "components/comp1/src/my/company" - "components/comp1/src/my/company/comp1" - "components/comp1/src/my/company/comp1/core.clj" "components/comp1/src/my/company/ifc1" + "components/comp1/src/my/company/ifc1/core.clj" "components/comp1/src/my/company/ifc1/interface.clj" "components/comp1/test" "components/comp1/test/my" "components/comp1/test/my/company" - "components/comp1/test/my/company/comp1" - "components/comp1/test/my/company/comp1/core_test.clj" + "components/comp1/test/my/company/ifc1" + "components/comp1/test/my/company/ifc1/core_test.clj" "environments" "environments/development" "environments/development/docs" @@ -105,17 +104,16 @@ "environments/development/src/my/company" "environments/development/src/my/company/base1" "environments/development/src/my/company/base1/core.clj" - "environments/development/src/my/company/comp1" - "environments/development/src/my/company/comp1/core.clj" "environments/development/src/my/company/ifc1" + "environments/development/src/my/company/ifc1/core.clj" "environments/development/src/my/company/ifc1/interface.clj" "environments/development/test" "environments/development/test/my" "environments/development/test/my/company" "environments/development/test/my/company/base1" "environments/development/test/my/company/base1/core_test.clj" - "environments/development/test/my/company/comp1" - "environments/development/test/my/company/comp1/core_test.clj" + "environments/development/test/my/company/ifc1" + "environments/development/test/my/company/ifc1/core_test.clj" "interfaces" "interfaces/project.clj" "interfaces/src" @@ -143,9 +141,8 @@ "systems/sys1/src/my/company" "systems/sys1/src/my/company/base1" "systems/sys1/src/my/company/base1/core.clj" - "systems/sys1/src/my/company/comp1" - "systems/sys1/src/my/company/comp1/core.clj" "systems/sys1/src/my/company/ifc1" + "systems/sys1/src/my/company/ifc1/core.clj" "systems/sys1/src/my/company/ifc1/interface.clj"} (set (file/relative-paths ws-dir))))))) @@ -213,15 +210,14 @@ "components/comp-1/src" "components/comp-1/src/my" "components/comp-1/src/my/company" - "components/comp-1/src/my/company/comp_1" - "components/comp-1/src/my/company/comp_1/core.clj" "components/comp-1/src/my/company/ifc_1" + "components/comp-1/src/my/company/ifc_1/core.clj" "components/comp-1/src/my/company/ifc_1/interface.clj" "components/comp-1/test" "components/comp-1/test/my" "components/comp-1/test/my/company" - "components/comp-1/test/my/company/comp_1" - "components/comp-1/test/my/company/comp_1/core_test.clj" + "components/comp-1/test/my/company/ifc_1" + "components/comp-1/test/my/company/ifc_1/core_test.clj" "components/comp-2" "components/comp-2/project.clj" "components/comp-2/readme.md" @@ -232,15 +228,14 @@ "components/comp-2/src" "components/comp-2/src/my" "components/comp-2/src/my/company" - "components/comp-2/src/my/company/comp_2" - "components/comp-2/src/my/company/comp_2/core.clj" "components/comp-2/src/my/company/ifc_1" + "components/comp-2/src/my/company/ifc_1/core.clj" "components/comp-2/src/my/company/ifc_1/interface.clj" "components/comp-2/test" "components/comp-2/test/my" "components/comp-2/test/my/company" - "components/comp-2/test/my/company/comp_2" - "components/comp-2/test/my/company/comp_2/core_test.clj" + "components/comp-2/test/my/company/ifc_1" + "components/comp-2/test/my/company/ifc_1/core_test.clj" "environments" "environments/development" "environments/development/docs" @@ -273,17 +268,18 @@ "environments/development/src/my/company" "environments/development/src/my/company/base_1" "environments/development/src/my/company/base_1/core.clj" - "environments/development/src/my/company/comp_1" - "environments/development/src/my/company/comp_1/core.clj" "environments/development/src/my/company/ifc_1" + "environments/development/src/my/company/ifc_1/core.clj" "environments/development/src/my/company/ifc_1/interface.clj" "environments/development/test" "environments/development/test/my" "environments/development/test/my/company" "environments/development/test/my/company/base_1" "environments/development/test/my/company/base_1/core_test.clj" - "environments/development/test/my/company/comp_1" - "environments/development/test/my/company/comp_1/core_test.clj" + "environments/development/test/my/company/ifc_1" + "environments/development/test/my/company/ifc_1/core_test.clj" + "images" + "images/logo.png" "interfaces" "interfaces/project.clj" "interfaces/src" @@ -291,8 +287,6 @@ "interfaces/src/my/company" "interfaces/src/my/company/ifc_1" "interfaces/src/my/company/ifc_1/interface.clj" - "images" - "images/logo.png" "project.clj" "readme.md" "systems" @@ -311,8 +305,7 @@ "systems/sys-1/src/my/company" "systems/sys-1/src/my/company/base_1" "systems/sys-1/src/my/company/base_1/core.clj" - "systems/sys-1/src/my/company/comp_1" - "systems/sys-1/src/my/company/comp_1/core.clj" "systems/sys-1/src/my/company/ifc_1" + "systems/sys-1/src/my/company/ifc_1/core.clj" "systems/sys-1/src/my/company/ifc_1/interface.clj"} (set (file/relative-paths ws-dir))))))) diff --git a/test/leiningen/polylith/cmd/build_test.clj b/test/leiningen/polylith/cmd/build_test.clj index 6e6693c..b05242c 100644 --- a/test/leiningen/polylith/cmd/build_test.clj +++ b/test/leiningen/polylith/cmd/build_test.clj @@ -249,7 +249,7 @@ (helper/execute-polylith project "add" "component1" "system1") (helper/execute-polylith project "add" "component2" "system1") (helper/execute-polylith project "add" "component3" "system1") - (file/replace-file! (str ws-dir "/components/component1/src/my/company/component1/core.clj") core1-content) + (file/replace-file! (str ws-dir "/components/component1/src/my/company/interface1/core.clj") core1-content) (file/replace-file! (str ws-dir "/components/component2/src/my/company/component2/core.clj") core2-content) (file/replace-file! (str ws-dir "/components/component3/src/my/company/component3/core.clj") core3-content) (file/replace-file! (str ws-dir "/bases/base1/src/my/company/base1/core.clj") base1-content) @@ -263,7 +263,7 @@ time/current-time fake-current-time] (let [ws-dir (str @helper/root-dir "/ws1") project (helper/settings ws-dir "my.company") - core1-content ["(ns my.company.component1.core" + core1-content ["(ns my.company.interface1.core" " (:require [my.company.component3.interface :as component3]))" "(defn add-two [x]" " (component3/add-two x))"] @@ -288,7 +288,7 @@ (helper/execute-polylith project "add" "component1" "system1") (helper/execute-polylith project "add" "component2" "system1") (helper/execute-polylith project "add" "component3" "system1") - (file/replace-file! (str ws-dir "/components/component1/src/my/company/component1/core.clj") core1-content) + (file/replace-file! (str ws-dir "/components/component1/src/my/company/interface1/core.clj") core1-content) (file/replace-file! (str ws-dir "/components/component2/src/my/company/component2/core.clj") core2-content) (file/replace-file! (str ws-dir "/components/component3/src/my/company/component3/core.clj") core3-content) (file/replace-file! (str ws-dir "/bases/base1/src/my/company/base1/core.clj") base1-content) diff --git a/test/leiningen/polylith/cmd/compile_test.clj b/test/leiningen/polylith/cmd/compile_test.clj index 5e4de99..4068645 100644 --- a/test/leiningen/polylith/cmd/compile_test.clj +++ b/test/leiningen/polylith/cmd/compile_test.clj @@ -16,9 +16,9 @@ (* @time-atom 1200)) (deftest polylith-compile--with-print-argument--print-tests - (with-redefs [file/current-path (fn [] @helper/root-dir) + (with-redefs [file/current-path (fn [] @helper/root-dir) leiningen.polylith.cmd.shared/sh fake-fn - time/current-time fake-current-time] + time/current-time fake-current-time] (let [ws-dir (str @helper/root-dir "/ws1") project (helper/settings ws-dir "my.company") output (with-out-str @@ -40,7 +40,7 @@ (deftest polylith-compile--cyclic-dependencies-with-namespace--print-info (with-redefs [file/current-path (fn [] @helper/root-dir) - time/current-time fake-current-time] + time/current-time fake-current-time] (let [ws-dir (str @helper/root-dir "/ws1") project (helper/settings ws-dir "my.company") core1-content ["(ns my.company.component1.core" @@ -68,7 +68,7 @@ (helper/execute-polylith project "add" "component1" "system1") (helper/execute-polylith project "add" "component2" "system1") (helper/execute-polylith project "add" "component3" "system1") - (file/replace-file! (str ws-dir "/components/component1/src/my/company/component1/core.clj") core1-content) + (file/replace-file! (str ws-dir "/components/component1/src/my/company/interface1/core.clj") core1-content) (file/replace-file! (str ws-dir "/components/component2/src/my/company/component2/core.clj") core2-content) (file/replace-file! (str ws-dir "/components/component3/src/my/company/component3/core.clj") core3-content) (file/replace-file! (str ws-dir "/bases/base1/src/my/company/base1/core.clj") base1-content) diff --git a/test/leiningen/polylith/cmd/create_component_test.clj b/test/leiningen/polylith/cmd/create_component_test.clj index 650b271..e0df6fc 100644 --- a/test/leiningen/polylith/cmd/create_component_test.clj +++ b/test/leiningen/polylith/cmd/create_component_test.clj @@ -325,15 +325,14 @@ "components/log-4j/src" "components/log-4j/src/my" "components/log-4j/src/my/company" - "components/log-4j/src/my/company/log_4j" - "components/log-4j/src/my/company/log_4j/core.clj" "components/log-4j/src/my/company/logg_ing" + "components/log-4j/src/my/company/logg_ing/core.clj" "components/log-4j/src/my/company/logg_ing/interface.clj" "components/log-4j/test" "components/log-4j/test/my" "components/log-4j/test/my/company" - "components/log-4j/test/my/company/log_4j" - "components/log-4j/test/my/company/log_4j/core_test.clj" + "components/log-4j/test/my/company/logg_ing" + "components/log-4j/test/my/company/logg_ing/core_test.clj" "environments" "environments/development" "environments/development/docs" @@ -358,15 +357,14 @@ "environments/development/src" "environments/development/src/my" "environments/development/src/my/company" - "environments/development/src/my/company/log_4j" - "environments/development/src/my/company/log_4j/core.clj" "environments/development/src/my/company/logg_ing" + "environments/development/src/my/company/logg_ing/core.clj" "environments/development/src/my/company/logg_ing/interface.clj" "environments/development/test" "environments/development/test/my" "environments/development/test/my/company" - "environments/development/test/my/company/log_4j" - "environments/development/test/my/company/log_4j/core_test.clj" + "environments/development/test/my/company/logg_ing" + "environments/development/test/my/company/logg_ing/core_test.clj" "interfaces" "interfaces/project.clj" "interfaces/src" @@ -386,20 +384,20 @@ (is (= (helper/interfaces-project-content 'my.company/interfaces) (helper/content ws-dir "interfaces/project.clj"))) - (is (= (src-interface-content 'my.company.logg-ing.interface 'my.company.log-4j.core) + (is (= (src-interface-content 'my.company.logg-ing.interface 'my.company.logg-ing.core) (helper/content ws-dir "components/log-4j/src/my/company/logg_ing/interface.clj"))) - (is (= (src-core-content 'my.company.log-4j.core) - (helper/content ws-dir "components/log-4j/src/my/company/log_4j/core.clj"))) + (is (= (src-core-content 'my.company.logg-ing.core) + (helper/content ws-dir "components/log-4j/src/my/company/logg_ing/core.clj"))) - (is (= (component-core-test-content 'log-4j 'my.company.log-4j.core-test 'my.company.logg-ing.interface) - (helper/content ws-dir "components/log-4j/test/my/company/log_4j/core_test.clj"))) + (is (= (component-core-test-content 'log-4j 'my.company.logg-ing.core-test 'my.company.logg-ing.interface) + (helper/content ws-dir "components/log-4j/test/my/company/logg_ing/core_test.clj"))) - (is (= (src-interface-content 'my.company.logg-ing.interface 'my.company.log-4j.core) + (is (= (src-interface-content 'my.company.logg-ing.interface 'my.company.logg-ing.core) (helper/content ws-dir "environments/development/src/my/company/logg_ing/interface.clj"))) - (is (= (src-core-content 'my.company.log-4j.core) - (helper/content ws-dir "environments/development/src/my/company/log_4j/core.clj"))) + (is (= (src-core-content 'my.company.logg-ing.core) + (helper/content ws-dir "environments/development/src/my/company/logg_ing/core.clj"))) (is (= (interfaces-interface-content 'my.company.logg-ing.interface) (helper/content ws-dir "environments/development/interfaces/my/company/logg_ing/interface.clj"))) @@ -413,8 +411,8 @@ (is (= (helper/component-project-content "log-4j" 'my.company/log-4j 'my.company/interfaces) (helper/content ws-dir "environments/development/project-files/components/log-4j-project.clj"))) - (is (= (component-core-test-content 'log-4j 'my.company.log-4j.core-test 'my.company.logg-ing.interface) - (helper/content ws-dir "environments/development/test/my/company/log_4j/core_test.clj"))) + (is (= (component-core-test-content 'log-4j 'my.company.logg-ing.core-test 'my.company.logg-ing.interface) + (helper/content ws-dir "environments/development/test/my/company/logg_ing/core_test.clj"))) (is (= (development-project-content 'my.company/development) (helper/content ws-dir "environments/development/project.clj"))) @@ -450,15 +448,14 @@ "components/commonslogging/src" "components/commonslogging/src/my" "components/commonslogging/src/my/company" - "components/commonslogging/src/my/company/commonslogging" - "components/commonslogging/src/my/company/commonslogging/core.clj" "components/commonslogging/src/my/company/logging" + "components/commonslogging/src/my/company/logging/core.clj" "components/commonslogging/src/my/company/logging/interface.clj" "components/commonslogging/test" "components/commonslogging/test/my" "components/commonslogging/test/my/company" - "components/commonslogging/test/my/company/commonslogging" - "components/commonslogging/test/my/company/commonslogging/core_test.clj" + "components/commonslogging/test/my/company/logging" + "components/commonslogging/test/my/company/logging/core_test.clj" "components/log4j" "components/log4j/readme.md" "components/log4j/project.clj" @@ -469,15 +466,14 @@ "components/log4j/src" "components/log4j/src/my" "components/log4j/src/my/company" - "components/log4j/src/my/company/log4j" - "components/log4j/src/my/company/log4j/core.clj" "components/log4j/src/my/company/logging" + "components/log4j/src/my/company/logging/core.clj" "components/log4j/src/my/company/logging/interface.clj" "components/log4j/test" "components/log4j/test/my" "components/log4j/test/my/company" - "components/log4j/test/my/company/log4j" - "components/log4j/test/my/company/log4j/core_test.clj" + "components/log4j/test/my/company/logging" + "components/log4j/test/my/company/logging/core_test.clj" "environments" "environments/development" "environments/development/docs" @@ -502,15 +498,14 @@ "environments/development/src" "environments/development/src/my" "environments/development/src/my/company" - "environments/development/src/my/company/log4j" - "environments/development/src/my/company/log4j/core.clj" "environments/development/src/my/company/logging" + "environments/development/src/my/company/logging/core.clj" "environments/development/src/my/company/logging/interface.clj" "environments/development/test" "environments/development/test/my" "environments/development/test/my/company" - "environments/development/test/my/company/log4j" - "environments/development/test/my/company/log4j/core_test.clj" + "environments/development/test/my/company/logging" + "environments/development/test/my/company/logging/core_test.clj" "interfaces" "interfaces/project.clj" "interfaces/src" @@ -530,20 +525,20 @@ (is (= (helper/interfaces-project-content 'my.company/interfaces) (helper/content ws-dir "interfaces/project.clj"))) - (is (= (src-interface-content 'my.company.logging.interface 'my.company.log4j.core) + (is (= (src-interface-content 'my.company.logging.interface 'my.company.logging.core) (helper/content ws-dir "components/log4j/src/my/company/logging/interface.clj"))) - (is (= (src-core-content 'my.company.log4j.core) - (helper/content ws-dir "components/log4j/src/my/company/log4j/core.clj"))) + (is (= (src-core-content 'my.company.logging.core) + (helper/content ws-dir "components/log4j/src/my/company/logging/core.clj"))) - (is (= (component-core-test-content 'log4j 'my.company.log4j.core-test 'my.company.logging.interface) - (helper/content ws-dir "components/log4j/test/my/company/log4j/core_test.clj"))) + (is (= (component-core-test-content 'log4j 'my.company.logging.core-test 'my.company.logging.interface) + (helper/content ws-dir "components/log4j/test/my/company/logging/core_test.clj"))) - (is (= (src-interface-content 'my.company.logging.interface 'my.company.log4j.core) + (is (= (src-interface-content 'my.company.logging.interface 'my.company.logging.core) (helper/content ws-dir "environments/development/src/my/company/logging/interface.clj"))) - (is (= (src-core-content 'my.company.log4j.core) - (helper/content ws-dir "environments/development/src/my/company/log4j/core.clj"))) + (is (= (src-core-content 'my.company.logging.core) + (helper/content ws-dir "environments/development/src/my/company/logging/core.clj"))) (is (= (interfaces-interface-content 'my.company.logging.interface) (helper/content ws-dir "environments/development/interfaces/my/company/logging/interface.clj"))) @@ -557,8 +552,8 @@ (is (= (helper/component-project-content "log4j" 'my.company/log4j 'my.company/interfaces) (helper/content ws-dir "environments/development/project-files/components/log4j-project.clj"))) - (is (= (component-core-test-content 'log4j 'my.company.log4j.core-test 'my.company.logging.interface) - (helper/content ws-dir "environments/development/test/my/company/log4j/core_test.clj"))) + (is (= (component-core-test-content 'log4j 'my.company.logging.core-test 'my.company.logging.interface) + (helper/content ws-dir "environments/development/test/my/company/logging/core_test.clj"))) (is (= (development-project-content 'my.company/development) (helper/content ws-dir "environments/development/project.clj"))) diff --git a/test/leiningen/polylith/cmd/delete_test.clj b/test/leiningen/polylith/cmd/delete_test.clj index c04e944..b1165d2 100644 --- a/test/leiningen/polylith/cmd/delete_test.clj +++ b/test/leiningen/polylith/cmd/delete_test.clj @@ -149,6 +149,8 @@ "environments/development/test/my/company/comp_3/core_test.clj" "environments/development/test/my/company/system_1" "environments/development/test/my/company/system_1/core_test.clj" + "images" + "images/logo.png" "interfaces" "interfaces/project.clj" "interfaces/src" @@ -158,8 +160,6 @@ "interfaces/src/my/company/comp_1/interface.clj" "interfaces/src/my/company/comp_3" "interfaces/src/my/company/comp_3/interface.clj" - "images" - "images/logo.png" "project.clj" "readme.md" "systems" @@ -179,7 +179,6 @@ "systems/system-1/src/my/company/comp_3" "systems/system-1/src/my/company/comp_3/core.clj" "systems/system-1/src/my/company/comp_3/interface.clj" - "systems/system-1/src/my/company/interface_2" "systems/system-1/src/my/company/system_1" "systems/system-1/src/my/company/system_1/core.clj"} (set (file/relative-paths ws-dir))))))) @@ -266,15 +265,14 @@ "components/comp-3/src" "components/comp-3/src/my" "components/comp-3/src/my/company" - "components/comp-3/src/my/company/comp_3" - "components/comp-3/src/my/company/comp_3/core.clj" "components/comp-3/src/my/company/interface_2" + "components/comp-3/src/my/company/interface_2/core.clj" "components/comp-3/src/my/company/interface_2/interface.clj" "components/comp-3/test" "components/comp-3/test/my" "components/comp-3/test/my/company" - "components/comp-3/test/my/company/comp_3" - "components/comp-3/test/my/company/comp_3/core_test.clj" + "components/comp-3/test/my/company/interface_2" + "components/comp-3/test/my/company/interface_2/core_test.clj" "environments" "environments/development" "environments/development/docs" @@ -318,6 +316,8 @@ "environments/development/test/my/company/comp_1/core_test.clj" "environments/development/test/my/company/system_1" "environments/development/test/my/company/system_1/core_test.clj" + "images" + "images/logo.png" "interfaces" "interfaces/project.clj" "interfaces/src" @@ -327,8 +327,6 @@ "interfaces/src/my/company/comp_1/interface.clj" "interfaces/src/my/company/interface_2" "interfaces/src/my/company/interface_2/interface.clj" - "images" - "images/logo.png" "project.clj" "readme.md" "systems" @@ -343,7 +341,6 @@ "systems/system-1/src" "systems/system-1/src/my" "systems/system-1/src/my/company" - "systems/system-1/src/my/company/interface_2" "systems/system-1/src/my/company/system_1" "systems/system-1/src/my/company/system_1/core.clj"} (set (file/relative-paths ws-dir))))))) @@ -419,15 +416,14 @@ "components/component-3/src" "components/component-3/src/my" "components/component-3/src/my/company" - "components/component-3/src/my/company/component_3" - "components/component-3/src/my/company/component_3/core.clj" "components/component-3/src/my/company/interface_1" + "components/component-3/src/my/company/interface_1/core.clj" "components/component-3/src/my/company/interface_1/interface.clj" "components/component-3/test" "components/component-3/test/my" "components/component-3/test/my/company" - "components/component-3/test/my/company/component_3" - "components/component-3/test/my/company/component_3/core_test.clj" + "components/component-3/test/my/company/interface_1" + "components/component-3/test/my/company/interface_1/core_test.clj" "components/component-5" "components/component-5/project.clj" "components/component-5/readme.md" @@ -439,14 +435,13 @@ "components/component-5/src/my" "components/component-5/src/my/company" "components/component-5/src/my/company/component_4" + "components/component-5/src/my/company/component_4/core.clj" "components/component-5/src/my/company/component_4/interface.clj" - "components/component-5/src/my/company/component_5" - "components/component-5/src/my/company/component_5/core.clj" "components/component-5/test" "components/component-5/test/my" "components/component-5/test/my/company" - "components/component-5/test/my/company/component_5" - "components/component-5/test/my/company/component_5/core_test.clj" + "components/component-5/test/my/company/component_4" + "components/component-5/test/my/company/component_4/core_test.clj" "environments" "environments/development" "environments/development/docs" @@ -485,23 +480,23 @@ "environments/development/src/my/company" "environments/development/src/my/company/base_1" "environments/development/src/my/company/base_1/core.clj" - "environments/development/src/my/company/component_3" - "environments/development/src/my/company/component_3/core.clj" "environments/development/src/my/company/component_4" + "environments/development/src/my/company/component_4/core.clj" "environments/development/src/my/company/component_4/interface.clj" - "environments/development/src/my/company/component_5" - "environments/development/src/my/company/component_5/core.clj" "environments/development/src/my/company/interface_1" + "environments/development/src/my/company/interface_1/core.clj" "environments/development/src/my/company/interface_1/interface.clj" "environments/development/test" "environments/development/test/my" "environments/development/test/my/company" "environments/development/test/my/company/base_1" "environments/development/test/my/company/base_1/core_test.clj" - "environments/development/test/my/company/component_3" - "environments/development/test/my/company/component_3/core_test.clj" - "environments/development/test/my/company/component_5" - "environments/development/test/my/company/component_5/core_test.clj" + "environments/development/test/my/company/component_4" + "environments/development/test/my/company/component_4/core_test.clj" + "environments/development/test/my/company/interface_1" + "environments/development/test/my/company/interface_1/core_test.clj" + "images" + "images/logo.png" "interfaces" "interfaces/project.clj" "interfaces/src" @@ -511,8 +506,6 @@ "interfaces/src/my/company/component_4/interface.clj" "interfaces/src/my/company/interface_1" "interfaces/src/my/company/interface_1/interface.clj" - "images" - "images/logo.png" "project.clj" "readme.md" "systems" @@ -528,6 +521,5 @@ "systems/system-1/src/my" "systems/system-1/src/my/company" "systems/system-1/src/my/company/base_1" - "systems/system-1/src/my/company/base_1/core.clj" - "systems/system-1/src/my/company/interface_1"} + "systems/system-1/src/my/company/base_1/core.clj"} (set (file/relative-paths ws-dir))))))) diff --git a/test/leiningen/polylith/cmd/deps_test.clj b/test/leiningen/polylith/cmd/deps_test.clj index ba9bf4d..91a00e3 100644 --- a/test/leiningen/polylith/cmd/deps_test.clj +++ b/test/leiningen/polylith/cmd/deps_test.clj @@ -277,8 +277,8 @@ (helper/execute-polylith project "create" "c" "comp2" "interface1") (helper/execute-polylith project "create" "s" "system1" "system1") (helper/execute-polylith project "add" "comp2" "system1") - (file/replace-file! (str ws-dir "/components/comp1/src/comp1/core.clj") comp1-content) - (file/replace-file! (str ws-dir "/components/comp2/src/comp2/core.clj") comp2-content) + (file/replace-file! (str ws-dir "/components/comp1/src/interface1/core.clj") comp1-content) + (file/replace-file! (str ws-dir "/components/comp2/src/interface1/core.clj") comp2-content) (helper/execute-polylith project "deps" "development" "+function"))] (is (= ["FYI: the component comp2 was created but not added to development because it's interface interface1 was already used by comp1." "comp1:" diff --git a/test/leiningen/polylith/cmd/info_test.clj b/test/leiningen/polylith/cmd/info_test.clj index 27167c8..73484ae 100644 --- a/test/leiningen/polylith/cmd/info_test.clj +++ b/test/leiningen/polylith/cmd/info_test.clj @@ -117,7 +117,7 @@ (helper/execute-polylith project "add" "component1" "system1") (helper/execute-polylith project "add" "component2" "system1") (helper/execute-polylith project "add" "component3" "system1") - (file/replace-file! (str ws-dir "/components/component1/src/my/company/component1/core.clj") core1-content) + (file/replace-file! (str ws-dir "/components/component1/src/my/company/interface1/core.clj") core1-content) (file/replace-file! (str ws-dir "/components/component2/src/my/company/component2/core.clj") core2-content) (file/replace-file! (str ws-dir "/components/component3/src/my/company/component3/core.clj") core3-content) (file/replace-file! (str ws-dir "/bases/base1/src/my/company/base1/core.clj") base1-content) diff --git a/test/leiningen/polylith/cmd/remove_test.clj b/test/leiningen/polylith/cmd/remove_test.clj index 960a679..d67a2fb 100644 --- a/test/leiningen/polylith/cmd/remove_test.clj +++ b/test/leiningen/polylith/cmd/remove_test.clj @@ -67,15 +67,14 @@ "components/comp-2/src" "components/comp-2/src/my" "components/comp-2/src/my/company" - "components/comp-2/src/my/company/comp_2" - "components/comp-2/src/my/company/comp_2/core.clj" "components/comp-2/src/my/company/ifc_2" + "components/comp-2/src/my/company/ifc_2/core.clj" "components/comp-2/src/my/company/ifc_2/interface.clj" "components/comp-2/test" "components/comp-2/test/my" "components/comp-2/test/my/company" - "components/comp-2/test/my/company/comp_2" - "components/comp-2/test/my/company/comp_2/core_test.clj" + "components/comp-2/test/my/company/ifc_2" + "components/comp-2/test/my/company/ifc_2/core_test.clj" "environments" "environments/development" "environments/development/docs" @@ -117,9 +116,8 @@ "environments/development/src/my/company/comp_1" "environments/development/src/my/company/comp_1/core.clj" "environments/development/src/my/company/comp_1/interface.clj" - "environments/development/src/my/company/comp_2" - "environments/development/src/my/company/comp_2/core.clj" "environments/development/src/my/company/ifc_2" + "environments/development/src/my/company/ifc_2/core.clj" "environments/development/src/my/company/ifc_2/interface.clj" "environments/development/test" "environments/development/test/my" @@ -128,8 +126,10 @@ "environments/development/test/my/company/base_1/core_test.clj" "environments/development/test/my/company/comp_1" "environments/development/test/my/company/comp_1/core_test.clj" - "environments/development/test/my/company/comp_2" - "environments/development/test/my/company/comp_2/core_test.clj" + "environments/development/test/my/company/ifc_2" + "environments/development/test/my/company/ifc_2/core_test.clj" + "images" + "images/logo.png" "interfaces" "interfaces/project.clj" "interfaces/src" @@ -139,8 +139,6 @@ "interfaces/src/my/company/comp_1/interface.clj" "interfaces/src/my/company/ifc_2" "interfaces/src/my/company/ifc_2/interface.clj" - "images" - "images/logo.png" "project.clj" "readme.md" "systems" @@ -216,13 +214,12 @@ "components/comp2/resources/comp2" "components/comp2/resources/comp2/.keep" "components/comp2/src" - "components/comp2/src/comp2" - "components/comp2/src/comp2/core.clj" "components/comp2/src/ifc2" + "components/comp2/src/ifc2/core.clj" "components/comp2/src/ifc2/interface.clj" "components/comp2/test" - "components/comp2/test/comp2" - "components/comp2/test/comp2/core_test.clj" + "components/comp2/test/ifc2" + "components/comp2/test/ifc2/core_test.clj" "environments" "environments/development" "environments/development/docs" @@ -260,17 +257,18 @@ "environments/development/src/comp1" "environments/development/src/comp1/core.clj" "environments/development/src/comp1/interface.clj" - "environments/development/src/comp2" - "environments/development/src/comp2/core.clj" "environments/development/src/ifc2" + "environments/development/src/ifc2/core.clj" "environments/development/src/ifc2/interface.clj" "environments/development/test" "environments/development/test/base1" "environments/development/test/base1/core_test.clj" "environments/development/test/comp1" "environments/development/test/comp1/core_test.clj" - "environments/development/test/comp2" - "environments/development/test/comp2/core_test.clj" + "environments/development/test/ifc2" + "environments/development/test/ifc2/core_test.clj" + "images" + "images/logo.png" "interfaces" "interfaces/project.clj" "interfaces/src" @@ -278,8 +276,6 @@ "interfaces/src/comp1/interface.clj" "interfaces/src/ifc2" "interfaces/src/ifc2/interface.clj" - "images" - "images/logo.png" "project.clj" "readme.md" "systems" diff --git a/test/leiningen/polylith/cmd/sync_test.clj b/test/leiningen/polylith/cmd/sync_test.clj index e5f289f..f996760 100644 --- a/test/leiningen/polylith/cmd/sync_test.clj +++ b/test/leiningen/polylith/cmd/sync_test.clj @@ -232,11 +232,8 @@ (helper/execute-polylith project "create" "c" "comp3" "interface3") (helper/execute-polylith project "add" "comp1" "system1") (file/replace-file! (str ws-dir "/bases/base1/src/com/abc/base1/core.clj") base-core-content) - (file/replace-file! (str ws-dir "/components/comp1/src/com/abc/comp1/core.clj") comp1-core-content) - (helper/execute-polylith project "sync" "+deps"))] - - ;; se till att build (och eventuellt något kommando till) stoppar i fallet synkningen failar. - ;; todo: kolla även output + lägg till fler test för fallet när man inte har exakt en implementation av interfacet. + (file/replace-file! (str ws-dir "/components/comp1/src/com/abc/interface1/core.clj") comp1-core-content) + (helper/execute-polylith project "sync"))] (is (= ["Added component 'comp3' to system 'system1'." "Added component 'comp2' to system 'system1'."] @@ -244,17 +241,14 @@ (is (= #{"base1" "base1/core.clj" - "comp1" - "comp1/core.clj" - "comp2" - "comp2/core.clj" - "comp3" - "comp3/core.clj" "interface1" + "interface1/core.clj" "interface1/interface.clj" "interface2" + "interface2/core.clj" "interface2/interface.clj" "interface3" + "interface3/core.clj" "interface3/interface.clj"} (set (file/relative-paths (str ws-dir "/systems/system1/src/com/abc")))))))) @@ -438,9 +432,9 @@ (file/replace-file! (str ws-dir "/components/comp-2b/src/com/abc/comp_2/interface.clj") (comp-ifc "comp-2.interface")) (file/replace-file! (str ws-dir "/components/comp-2/src/com/abc/comp_2/v2/interface.clj") (comp-ifc "comp-2.v2.interface")) (file/replace-file! (str ws-dir "/components/comp-2b/src/com/abc/comp_2/v2/interface.clj") (comp-ifc "comp-2.v2.interface")) - (file/replace-file! (str ws-dir "/components/comp-1/src/com/abc/comp_1/core.clj") (comp-ns "comp-1.core")) + (file/replace-file! (str ws-dir "/components/comp-1/src/com/abc/ifc_1/core.clj") (comp-ns "comp-1.core")) (file/replace-file! (str ws-dir "/components/comp-2/src/com/abc/comp_2/core.clj") (comp-ns "comp-2.core")) - (file/replace-file! (str ws-dir "/components/comp-2b/src/com/abc/comp_2b/core.clj") (comp-ns "comp-2b.core")) + (file/replace-file! (str ws-dir "/components/comp-2b/src/com/abc/comp_2/core.clj") (comp-ns "comp-2b.core")) (helper/execute-polylith project "sync"))] (is (= ["FYI: the component comp-2b was created but not added to development because it's interface comp-2 was already used by comp-2." diff --git a/test/leiningen/polylith/cmd/test_test.clj b/test/leiningen/polylith/cmd/test_test.clj index a2f89f6..dcedb1b 100644 --- a/test/leiningen/polylith/cmd/test_test.clj +++ b/test/leiningen/polylith/cmd/test_test.clj @@ -175,7 +175,7 @@ time/current-time fake-current-time] (let [ws-dir (str @helper/root-dir "/ws1") project (helper/settings ws-dir "my.company") - core1-content ["(ns my.company.component1.core" + core1-content ["(ns my.company.interface1.core" " (:require [my.company.component3.interface :as component3]))" "(defn add-two [x]" " (component3/add-two x))"] @@ -200,7 +200,7 @@ (helper/execute-polylith project "add" "component1" "system1") (helper/execute-polylith project "add" "component2" "system1") (helper/execute-polylith project "add" "component3" "system1") - (file/replace-file! (str ws-dir "/components/component1/src/my/company/component1/core.clj") core1-content) + (file/replace-file! (str ws-dir "/components/component1/src/my/company/interface1/core.clj") core1-content) (file/replace-file! (str ws-dir "/components/component2/src/my/company/component2/core.clj") core2-content) (file/replace-file! (str ws-dir "/components/component3/src/my/company/component3/core.clj") core3-content) (file/replace-file! (str ws-dir "/bases/base1/src/my/company/base1/core.clj") base1-content)