Skip to content
Snippets Groups Projects
Unverified Commit f1319da6 authored by Luis Paolini's avatar Luis Paolini Committed by GitHub
Browse files

Make drivers build in parallel rather than sequentially (#45897)

* Make drivers build in parallel rather than sequentially

* Make the whitespace linter happy

* Add duration to steps
parent de1a0b28
No related branches found
No related tags found
No related merge requests found
......@@ -106,7 +106,8 @@
:or {edition (edition-from-env-var)
steps (keys all-steps)}}]
(let [version (or version
(version-properties/current-snapshot-version edition))]
(version-properties/current-snapshot-version edition))
start-time-ms (System/currentTimeMillis)]
(u/step (format "Running build steps for %s version %s: %s"
(case edition
:oss "Community (OSS) Edition"
......@@ -118,7 +119,8 @@
(throw (ex-info (format "Invalid step: %s" step-name)
{:step step-name
:valid-steps (keys all-steps)})))]]
(step-fn {:version version, :edition edition}))
(step-fn {:version version, :edition edition})
(u/announce "Did %s in %d ms." step-name (- (System/currentTimeMillis) start-time-ms)))
(u/announce "All build steps finished.")))))
(defn build-cli
......
......@@ -22,13 +22,13 @@
(map (comp keyword #(.getName ^File %)))))
(defn build-drivers!
"Build `edition`(`:ee` or `:oss`) versions of *all* the drivers in `modules/drivers`."
"Build `edition`(`:ee` or `:oss`) versions of *all* the drivers in `modules/drivers` in parallel."
[edition]
(let [edition (or edition :oss)]
(assert (#{:oss :ee} edition))
(u/step (format "Building all drivers (%s edition)" (pr-str edition))
(doseq [driver (all-drivers)]
(build-driver/build-driver! driver edition))
(u/step (format "Building all drivers in parallel (%s edition)" (pr-str edition))
(doall ; Force evaluation of pmap
(pmap #(build-driver/build-driver! % edition) (all-drivers)))
(u/announce "Successfully built all drivers."))))
(defn build-drivers
......
(ns build-drivers.copy-source-files
(:require
[build-drivers.common :as c]
[clojure.tools.build.api :as b]
[metabuild-common.core :as u]))
[clojure.java.io :as io]
[metabuild-common.core :as u])
(:import (java.nio.file Files)))
(set! *warn-on-reflection* true)
(defn- copy-files [src-dirs target-dir]
(doseq [src-dir src-dirs]
(let [src (io/file src-dir)
target (io/file target-dir)]
(when (.exists src)
(u/announce "Copying files from %s to %s" src target)
(doseq [file (file-seq src)]
(when (.isFile file)
(let [relative-path (.relativize (.toPath src) (.toPath file))
target-file (io/file target (str relative-path))]
(.mkdirs (.getParentFile target-file))
(Files/copy (.toPath file) (.toPath target-file) (into-array java.nio.file.CopyOption [])))))))))
(defn copy-source-files!
"Copy source files into the build driver JAR."
[driver edition]
......@@ -15,9 +29,7 @@
(assert (every? u/absolute? dirs)
(format "All dirs should be absolute, got: %s" (pr-str dirs)))
(u/announce "Copying files in %s" (pr-str dirs))
(b/copy-dir
{:src-dirs dirs
:target-dir (c/compiled-source-target-dir driver)})
(copy-files dirs (c/compiled-source-target-dir driver))
(u/announce "Copied files in %d directories in %d ms."
(count dirs)
(- (System/currentTimeMillis) start-time-ms)))))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment