Skip to content
Snippets Groups Projects
Unverified Commit 357e9512 authored by Cam Saul's avatar Cam Saul Committed by GitHub
Browse files

Merge releases v0.33.5-v0.33.7.1 into master

parents 0b9c7fb3 4405ca70
No related branches found
No related tags found
No related merge requests found
......@@ -9,8 +9,6 @@
.DS_Store
.\#*
.eastwood
.eastwood
.idea/
.idea/
.nrepl-port
.vscode
......@@ -31,10 +29,12 @@
/classes
/coverage
/crate-*
/cypress
/deploy/artifacts/*
/docs/uberdoc.html
/lein-plugins/*/target
/local/src
/local/src
/locales/metabase-*.pot
/modules/drivers/*/target
/node_modules/
......@@ -43,9 +43,11 @@
/reset-password-artifacts
/resources/frontend_client/app/dist/
/resources/frontend_client/app/locales
/resources/frontend_client/app/locales
/resources/frontend_client/embed.html
/resources/frontend_client/index.html
/resources/frontend_client/public.html
/resources/namespaces.edn
/resources/sample-dataset.db.trace.db
/resources/version.properties
/screenshots
......@@ -67,8 +69,3 @@ profiles.clj
target/checksum.txt
xcshareddata
xcuserdata
/resources/frontend_client/app/locales
*.iml
.idea/
/local/src
/cypress
......@@ -80,9 +80,10 @@
(deftest field-filter-test
(testing "Date ranges"
(is (= "[{$match: {$and: [{\"date\": {$gte: ISODate(\"2019-12-08\")}}, {\"date\": {$lt: ISODate(\"2019-12-12\")}}]}}]"
(substitute {:date (field-filter "date" :date/range "past5days")}
["[{$match: " (param :date) "}]"]))))
(mt/with-clock #t "2019-12-13T12:00:00.000Z[UTC]"
(is (= "[{$match: {$and: [{\"date\": {$gte: ISODate(\"2019-12-08\")}}, {\"date\": {$lt: ISODate(\"2019-12-12\")}}]}}]"
(substitute {:date (field-filter "date" :date/range "past5days")}
["[{$match: " (param :date) "}]"])))))
(testing "multiple values"
(doseq [[message v] {"values are a vector of numbers" [1 2 3]
"comma-separated numbers" (comma-separated-numbers [1 2 3])}]
......
......@@ -260,7 +260,8 @@
:repl
[:include-all-drivers
{:jvm-opts ["-Duser.timezone=UTC"]}] ; so running the tests doesn't give you different answers
;; so running the tests doesn't give you different answers
{:jvm-opts ["-Duser.timezone=UTC"]}]
:bikeshed
[:include-all-drivers
......@@ -317,8 +318,9 @@
;; build the uberjar with `lein uberjar`
:uberjar
{:auto-clean true
:aot :all}
{:auto-clean true
:aot :all
:omit-source true}
;; lein strip-and-compress my-plugin.jar [path/to/metabase.jar]
;; strips classes from my-plugin.jar that already exist in other JAR and recompresses with higher compression ratio.
......
......@@ -6,15 +6,17 @@
[set :as set]
[string :as str]
[walk :as walk]]
[clojure.java.classpath :as classpath]
[clojure.java
[classpath :as classpath]
[io :as io]]
[clojure.math.numeric-tower :as math]
[clojure.tools.logging :as log]
[clojure.tools.namespace.find :as ns-find]
[clojure.tools.reader.edn :as edn]
[colorize.core :as colorize]
[flatland.ordered.map :refer [ordered-map]]
[medley.core :as m]
[metabase.config :as config]
[metabase.plugins.classloader :as classloader]
[metabase.util.i18n :refer [trs tru]]
[ring.util.codec :as codec]
[weavejester.dependency :as dep])
......@@ -149,7 +151,7 @@
(catch Throwable _ false)))
(defn ^:deprecated rpartial
"Like `partial`, but applies additional args *before* BOUND-ARGS.
"Like `partial`, but applies additional args *before* `bound-args`.
Inspired by [`-rpartial` from dash.el](https://github.com/magnars/dash.el#-rpartial-fn-rest-args)
((partial - 5) 8) -> (- 5 8) -> -3
......@@ -454,22 +456,37 @@
(or (id object-or-id)
(throw (Exception. (tru "Not something with an ID: {0}" object-or-id)))))
(defn- namespace-symbs* []
(for [ns-symb (ns-find/find-namespaces (concat (classpath/system-classpath)
(classpath/classpath (classloader/the-classloader))))
:when (and (.startsWith (name ns-symb) "metabase.")
(not (.contains (name ns-symb) "test")))]
ns-symb))
(defn- metabase-namespace-symbs* []
(vec (sort (for [ns-symb (ns-find/find-namespaces (classpath/system-classpath))
:when (and (.startsWith (name ns-symb) "metabase.")
(not (.contains (name ns-symb) "test")))]
ns-symb))))
(def ^:private namespace-symbs-filename "namespaces.edn")
(when *compile-files*
(let [filename (str "resources/" namespace-symbs-filename)]
(printf "Saving list of Metabase namespaces to %s...\n" filename)
(spit filename (with-out-str (pprint (metabase-namespace-symbs*))))))
(def metabase-namespace-symbols
"Delay to a vector of symbols of all Metabase namespaces, excluding test namespaces.
This is intended for use by various routines that load related namespaces, such as task and events initialization.
Using `ns-find/find-namespaces` is fairly slow, and can take as much as half a second to iterate over the thousand
or so namespaces that are part of the Metabase project; use this instead for a massive performance increase."
;; We want to give JARs in the ./plugins directory a chance to load. At one point we have this as a future so it
;; start looking for things in the background while other stuff is happening but that meant plugins couldn't
;; introduce new Metabase namespaces such as drivers.
(delay (vec (namespace-symbs*))))
"Delay to a vector of symbols of all Metabase namespaces, excluding test namespaces. This is intended for use by
various routines that load related namespaces, such as task and events initialization."
;; When building the uberjar we'll determine the symbols ahead of time ans save to an EDN file which will speed up
;; initialization a bit and also fix an issue where the sequence would be empty if `:omit-source` was enabled.
;; `ns-find` looks for Clojure source files.
;;
;; Use a delay for dev runs since `ns-find` is slow and can take several seconds or more
(if config/is-prod?
(delay
(try
(log/info (trs "Reading Metabase namespaces from {0}" namespace-symbs-filename))
(edn/read-string (slurp (io/resource namespace-symbs-filename)))
(catch Throwable e
(log/error e (trs "Failed to read Metabase namespaces from {0}" namespace-symbs-filename))
(metabase-namespace-symbs*))))
(delay
(metabase-namespace-symbs*))))
(def ^java.util.regex.Pattern uuid-regex
"A regular expression for matching canonical string representations of UUIDs."
......
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