-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Also check for bases when deciding if an import is a library or not. * Changed from ffil and ddir in switch-ws to via. * 0.2.20-SNAPSHOT #22
- Loading branch information
1 parent
7e7db4f
commit 3b64a09
Showing
19 changed files
with
77 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 8 additions & 7 deletions
15
components/workspace/src/polylith/clj/core/workspace/enrich/lib_imports.clj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,24 @@ | ||
(ns ^:no-doc polylith.clj.core.workspace.enrich.lib-imports | ||
(:require [clojure.string :as str])) | ||
|
||
(defn library? [import suffixed-top-ns interface-names] | ||
(defn library? [import suffixed-top-ns brick-names] | ||
(if (str/starts-with? import suffixed-top-ns) | ||
(let [interface-ns (subs import (count suffixed-top-ns)) | ||
index (str/index-of interface-ns ".") | ||
interface (if (nil? index) | ||
interface-ns | ||
(subs interface-ns 0 index))] | ||
(not (contains? interface-names interface))) | ||
(not (contains? brick-names interface))) | ||
true)) | ||
|
||
(defn lib-imports-source [suffixed-top-ns interface-names brick source-key] | ||
(vec (sort (filter #(library? % suffixed-top-ns interface-names) | ||
(defn lib-imports-source [suffixed-top-ns brick-names brick source-key] | ||
(vec (sort (filter #(library? % suffixed-top-ns brick-names) | ||
(set (mapcat :imports (-> brick :namespaces source-key))))))) | ||
|
||
(defn lib-imports [suffixed-top-ns interface-names brick] | ||
(let [src (lib-imports-source suffixed-top-ns interface-names brick :src) | ||
test (lib-imports-source suffixed-top-ns interface-names brick :test)] | ||
(defn lib-imports [suffixed-top-ns interface-names base-names brick] | ||
(let [brick-names (set (concat interface-names base-names)) | ||
src (lib-imports-source suffixed-top-ns brick-names brick :src) | ||
test (lib-imports-source suffixed-top-ns brick-names brick :test)] | ||
(cond-> {} | ||
(seq src) (assoc :src src) | ||
(seq test) (assoc :test test)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.