Skip to content

Commit 313f097

Browse files
authored
Only build currently active drivers (metabase#17262)
Only build currently active drivers Update `all-drivers` fn so that it only "finds" drivers that have either a `project.clj` or `deps.edn` file (i.e. some build file), and ignores the directory otherwise. This is to deal with cached artifacts hanging around between builds in a shared executor type environment (ex: CircleCI), where even though the checkout won't bring in some driver directory that doesn't exist on the target branch, some other files (such as `pom.xml` or a `target` directory), might still be hanging around
1 parent 63d5dbf commit 313f097

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

bin/build-drivers/src/build_drivers.clj

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@
22
"Entrypoint for `bin/build-drivers.sh`. Builds all drivers, if needed."
33
(:require [build-drivers.build-driver :as build-driver]
44
[clojure.java.io :as io]
5-
[metabuild-common.core :as u]))
5+
[metabuild-common.core :as u])
6+
(:import java.io.File))
67

78
(defn- all-drivers []
89
(->> (.listFiles (io/file (u/filename u/project-root-directory "modules" "drivers")))
9-
(filter #(.isDirectory %)) ;; watch for errant DS_Store files on os_x
10+
(filter (fn [^File d]
11+
(and (.isDirectory d) ;; watch for errant DS_Store files on os_x
12+
;; only consider a directory to be a driver if it contains a lein or deps build file
13+
(some true? (map (fn [f]
14+
(.exists (io/file d f))) ["project.clj" "deps.edn"])))))
1015
(map (comp keyword #(.getName %)))))
1116

1217
(defn build-drivers! [edition]

0 commit comments

Comments
 (0)