diff --git a/deps.edn b/deps.edn index 9635c37bf..13cfa3931 100644 --- a/deps.edn +++ b/deps.edn @@ -17,14 +17,15 @@ :test {:extra-paths ["test"] :exec-fn cognitect.test-runner.api/test :jvm-opts ["-Dhyperfiddle.rcf.generate-tests=true" "-XX:-OmitStackTraceInFastThrow"] ;; https://archive.md/NNt9r - :extra-deps {org.clojure/core.async {:mvn/version "1.6.681"} ; for interop helpers only + :extra-deps {org.clojure/core.async {:mvn/version "1.6.681", :hyperfiddle.electric.cljdoc/include? true} ; for interop helpers only ch.qos.logback/logback-classic {:mvn/version "1.4.14"} io.github.cognitect-labs/test-runner {:git/url "https://github.com/cognitect-labs/test-runner.git" :sha "cc75980b43011773162b485f46f939dc5fba91e4"} org.clojure/test.check {:mvn/version "1.1.1"} - com.datomic/local {:mvn/version "1.0.285"} ; for hyperfiddle.transaction-test - com.datomic/client-cloud {:mvn/version "1.0.130"} ; for hyperfiddle.transaction-test + com.datomic/local {:mvn/version "1.0.285", :hyperfiddle.electric.cljdoc/include? true} ; for hyperfiddle.transaction-test + com.datomic/client-cloud {:mvn/version "1.0.130", :hyperfiddle.electric.cljdoc/include? true} ; for hyperfiddle.transaction-test thheller/shadow-cljs {:mvn/version "2.26.2"} ; for hooks tests - ring/ring-core {:mvn/version "1.11.0"} + ring/ring-core {:mvn/version "1.11.0", :hyperfiddle.electric.cljdoc/include? true} + http-kit/http-kit {:mvn/version "2.5.1", :hyperfiddle.electric.cljdoc/include? true} }} :build {:extra-paths ["src-build"] :ns-default build diff --git a/src-build/build.clj b/src-build/build.clj index 5bced7650..0ff55a6d0 100644 --- a/src-build/build.clj +++ b/src-build/build.clj @@ -1,29 +1,50 @@ (ns build "build electric.jar library artifact" - (:require [clojure.tools.build.api :as b] + (:require [clojure.data.xml :as xml] + [clojure.tools.build.api :as b] + [clojure.tools.build.tasks.write-pom :as wp] + [clojure.tools.deps.util.maven :as maven] [deps-deploy.deps-deploy :as dd])) (def lib 'com.hyperfiddle/electric) (def version (b/git-process {:git-args "describe --tags --long --always --dirty"})) (def basis (b/create-basis {:project "deps.edn"})) +(defn alias-deps [basis alias] (get-in basis [:aliases alias :extra-deps])) + +(defn extend-basis [basis deps] + (b/create-basis (update (:basis-config basis) :extra merge {:deps deps}))) + +(defn cljdoc-deps [deps] + (into {} (filter (fn [[_k v]] (contains? v :hyperfiddle.electric.cljdoc/include?)) deps))) + +(def basis-with-cljdoc-provided-deps (->> (alias-deps basis :test) cljdoc-deps (extend-basis basis))) + (def class-dir "target/classes") (def defaults {:src-pom "src-build/pom-template.xml" :lib lib :class-dir class-dir}) (defn clean [opts] (b/delete {:path "target"})) +(xml/alias-uri 'pom "http://maven.apache.org/POM/4.0.0") + +(let [original @#'wp/to-dep] + (defn to-dep [[lib {:keys [hyperfiddle.electric.cljdoc/include?] :as coord}]] + (cond-> (original [lib coord]) + include? (conj [::pom/scope "provided"])))) + (defn jar [{:keys [version] :or {version version}}] (let [jar-file (format "target/%s-%s.jar" (name lib) version) opts (assoc defaults :version version - :basis basis + :basis basis-with-cljdoc-provided-deps :class-dir class-dir :jar-file jar-file :scm {:tag version} :src-dirs ["src"])] (println "Writing pom.xml") - (b/write-pom opts) + (with-redefs [wp/to-dep to-dep] + (b/write-pom opts)) (println "Copying resources to" class-dir) (b/copy-dir {:src-dirs ["src"], :target-dir class-dir}) (println "Building jar" jar-file) @@ -54,3 +75,21 @@ :class-dir "src" :basis basis :javac-opts ["-source" "8" "-target" "8"]})) + + +;; To run cljdoc analysis locally: +;; 1 - build jar +;; 2 - instal +;; 3 - run next to deps.edn: +;; mkdir -p .cljdoc-preview +;; docker run --rm \ +;; --volume $(pwd) \ +;; --volume "$HOME/.m2:/root/.m2" \ +;; --volume ./.cljdoc-preview \ +;; --platform linux/amd64 \ +;; --entrypoint clojure \ +;; cljdoc/cljdoc -Sforce -M:cli ingest \ +;; --project com.hyperfiddle/electric \ +;; --version $HYPERFIDDLE_ELECTRIC_BUILD +;; --git . \ +;; --rev $(git rev-parse HEAD) diff --git a/src/contrib/datomic_contrib.clj b/src/contrib/datomic_contrib.clj index 6c7e3d8e6..43db20fe5 100644 --- a/src/contrib/datomic_contrib.clj +++ b/src/contrib/datomic_contrib.clj @@ -1,4 +1,4 @@ -(ns contrib.datomic-contrib +(ns ^:no-doc contrib.datomic-contrib (:require [contrib.data :refer [index-by unqualify]] [contrib.datomic-m :as d] [hyperfiddle.electric :as e] ; ? @@ -224,4 +224,4 @@ {20512488927800905 #:db{:id 20512488927800905}, 68459991991856131 #:db{:id 68459991991856131}} nil] - nil) \ No newline at end of file + nil) diff --git a/src/contrib/datomic_contrib_2020.clj b/src/contrib/datomic_contrib_2020.clj index ec52e8a35..59d7de395 100644 --- a/src/contrib/datomic_contrib_2020.clj +++ b/src/contrib/datomic_contrib_2020.clj @@ -1,4 +1,4 @@ -(ns contrib.datomic-contrib-2020 +(ns ^:no-doc contrib.datomic-contrib-2020 (:require [contrib.datomic-contrib :refer [identify]] clojure.set [contrib.data :refer [update-existing]] diff --git a/src/contrib/datomic_m.clj b/src/contrib/datomic_m.clj index 6ba79bab9..6ae24ef7d 100644 --- a/src/contrib/datomic_m.clj +++ b/src/contrib/datomic_m.clj @@ -1,4 +1,4 @@ -(ns contrib.datomic-m +(ns ^:no-doc contrib.datomic-m "datomic compatibility facade" (:require contrib.deptector [clojure.tools.logging :as log] diff --git a/src/contrib/datomic_peer_m.clj b/src/contrib/datomic_peer_m.clj index 4e774a24d..596aa82fe 100644 --- a/src/contrib/datomic_peer_m.clj +++ b/src/contrib/datomic_peer_m.clj @@ -1,4 +1,4 @@ -(ns contrib.datomic-peer-m +(ns ^:no-doc contrib.datomic-peer-m (:import (datomic.db Datum)) (:require [clojure.core.protocols :as ccp :refer [nav]] [clojure.datafy :refer [datafy]] @@ -171,4 +171,4 @@ (defn history [db] (m/sp (d/history db))) -(defn squuid [] (d/squuid)) \ No newline at end of file +(defn squuid [] (d/squuid)) diff --git a/src/contrib/electric_codemirror.cljc b/src/contrib/electric_codemirror.cljc index 091662d5d..3762b8c10 100644 --- a/src/contrib/electric_codemirror.cljc +++ b/src/contrib/electric_codemirror.cljc @@ -1,4 +1,4 @@ -(ns contrib.electric-codemirror +(ns ^:no-doc contrib.electric-codemirror ;; #?(:cljs (:require-macros contrib.electric-codemirror)) (:require [clojure.edn :as edn] diff --git a/src/contrib/test/datomic_peer_mbrainz.clj b/src/contrib/test/datomic_peer_mbrainz.clj index f1b3b059f..7602ee747 100644 --- a/src/contrib/test/datomic_peer_mbrainz.clj +++ b/src/contrib/test/datomic_peer_mbrainz.clj @@ -1,4 +1,4 @@ -(ns contrib.test.datomic-peer-mbrainz +(ns ^:no-doc contrib.test.datomic-peer-mbrainz "Don't use for inline tests, this has external database connection dependency not in-mem" (:require #_[contrib.datomic-contrib :as dx] ; no cycle @@ -47,4 +47,4 @@ not in-mem" :label/type #:db{:id 17592186045475}, :label/country #:db{:id 17592186045691}, :label/startYear 1972} - nil) \ No newline at end of file + nil) diff --git a/src/hyperfiddle/api.cljc b/src/hyperfiddle/api.cljc index ff1746a3e..e40f39d6d 100644 --- a/src/hyperfiddle/api.cljc +++ b/src/hyperfiddle/api.cljc @@ -1,4 +1,4 @@ -(ns hyperfiddle.api +(ns ^:no-doc hyperfiddle.api (:import [hyperfiddle.electric Pending] #?(:cljs [goog.math Long])) (:require clojure.edn diff --git a/src/hyperfiddle/electric/shadow_cljs/hooks3.clj b/src/hyperfiddle/electric/shadow_cljs/hooks3.clj index 6390249db..32154d126 100644 --- a/src/hyperfiddle/electric/shadow_cljs/hooks3.clj +++ b/src/hyperfiddle/electric/shadow_cljs/hooks3.clj @@ -1,4 +1,4 @@ -(ns hyperfiddle.electric.shadow-cljs.hooks3 +(ns ^:no-doc hyperfiddle.electric.shadow-cljs.hooks3 (:require [shadow.build.compiler] [hyperfiddle.electric.impl.lang3 :as lang] [hyperfiddle.electric.impl.cljs-analyzer2 :as cljs-ana])) diff --git a/src/hyperfiddle/electric_fulcro_dom_adapter.cljc b/src/hyperfiddle/electric_fulcro_dom_adapter.cljc index b28a187db..b291120c5 100644 --- a/src/hyperfiddle/electric_fulcro_dom_adapter.cljc +++ b/src/hyperfiddle/electric_fulcro_dom_adapter.cljc @@ -1,5 +1,5 @@ ;; TODO Port to v3 if needed -(ns hyperfiddle.electric-fulcro-dom-adapter +(ns ^:no-doc hyperfiddle.electric-fulcro-dom-adapter (:require [hyperfiddle.electric :as e] [hyperfiddle.electric-dom2] #?(:cljs [goog.object :as gobj]) diff --git a/src/hyperfiddle/popover.cljc b/src/hyperfiddle/popover.cljc index 9215cf49e..a220ea293 100644 --- a/src/hyperfiddle/popover.cljc +++ b/src/hyperfiddle/popover.cljc @@ -1,4 +1,4 @@ -(ns hyperfiddle.popover +(ns ^:no-doc hyperfiddle.popover #?(:cljs (:require-macros hyperfiddle.popover)) (:import [hyperfiddle.electric Pending]) (:require [hyperfiddle.api :as hf] diff --git a/src/hyperfiddle/spool.cljc b/src/hyperfiddle/spool.cljc index 67a0c650a..a998bbbed 100644 --- a/src/hyperfiddle/spool.cljc +++ b/src/hyperfiddle/spool.cljc @@ -1,4 +1,4 @@ -(ns hyperfiddle.spool +(ns ^:no-doc hyperfiddle.spool #?(:cljs (:require-macros hyperfiddle.spool)) (:require [hyperfiddle.electric :as e] [hyperfiddle.incseq :as i] diff --git a/src/hyperfiddle/txn.clj b/src/hyperfiddle/txn.clj index 9573b8348..193fbcca2 100644 --- a/src/hyperfiddle/txn.clj +++ b/src/hyperfiddle/txn.clj @@ -1,4 +1,4 @@ -(ns hyperfiddle.txn +(ns ^:no-doc hyperfiddle.txn (:require [contrib.datomic-contrib-2020 :as dx] [clojure.set :as set] [hyperfiddle.api :as hf] @@ -787,4 +787,4 @@ [[:db/retractEntity 4]]) := [[:db/retractEntity 4]]) -(defn minimal-tx [db tx] tx) \ No newline at end of file +(defn minimal-tx [db tx] tx)