Skip to content

Commit

Permalink
build: prepare for custom clerk build
Browse files Browse the repository at this point in the history
  • Loading branch information
sritchie committed Sep 6, 2023
1 parent 4408621 commit c0a1079
Show file tree
Hide file tree
Showing 9 changed files with 1,217 additions and 112 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ jobs:
key: gitlibs-${{ hashFiles('deps.edn') }}

- name: Install dependencies
run: clojure -P -M:test:coverage
run: clojure -P -M:test:nextjournal/clerk:coverage

- name: generate coverage report
run: |
CLOVERAGE_VERSION=1.2.4 clojure -M:test:coverage --codecov || :
CLOVERAGE_VERSION=1.2.4 clojure -M:test:nextjournal/clerk:coverage --codecov || :
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
Expand Down
2 changes: 1 addition & 1 deletion bb.edn
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

test:clj
{:doc "Run CLJ tests."
:task (shell "clojure -X:test:runner")}
:task (shell "clojure -X:test:nextjournal/clerk:runner")}

test:cljs
{:doc "Run CLJS tests."
Expand Down
31 changes: 29 additions & 2 deletions build.clj
Original file line number Diff line number Diff line change
@@ -1,12 +1,38 @@
(ns build
"tools.build declarations for the gen.clj library."
(: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 write-pom]))

;; This (the following two forms) comprises a trick I figured out to inject a
;; provided dependency into the pom.xml. This is necessary for
;; https://cljdoc.org/ to process docs from a library like ours that includes
;; namespaces requiring, say, Clerk or SCI, but don't ship with an explicit
;; required dependency on those libraries.

(xml/alias-uri 'pom "http://maven.apache.org/POM/4.0.0")

(alter-var-root
#'write-pom/to-dep
(fn [old]
(fn [[_ {:keys [mvn/scope]} :as pair]]
(cond-> (old pair)
scope
(conj [::pom/scope scope])))))

;; ## Variables

(def lib 'io.github.inferenceql/gen.clj)
(def version "0.1.0")

(def pom-deps
{'io.github.nextjournal/clerk
{:mvn/version "0.14.919"
:mvn/scope "provided"}
'org.babashka/sci
{:mvn/version "0.8.40"
:mvn/scope "provided"}})

(defn- ->version
([] version)
([suffix]
Expand All @@ -18,7 +44,8 @@
(def class-dir "target/classes")
(def basis
(b/create-basis
{:project "deps.edn"}))
{:project "deps.edn"
:extra {:deps pom-deps}}))

(defn ->jar-file [version]
(format "target/%s-%s.jar" (name lib) version))
Expand Down
17 changes: 14 additions & 3 deletions deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,22 @@
:deps
{kixi/stats {:mvn/version "0.5.5"}
org.apache.commons/commons-math3 {:mvn/version "3.6.1"}
org.clojure/clojure {:mvn/version "1.11.1"}}
org.clojure/clojure {:mvn/version "1.11.1"}
org.mentat/clerk-utils {:mvn/version "0.6.0"}}

:aliases
{:nextjournal/clerk
{:extra-paths ["dev" "examples" "examples/src"]
:extra-deps {io.github.nextjournal/clerk {:mvn/version "0.14.919"}}
{:extra-paths ["dev" "examples"]
:extra-deps
{io.github.nextjournal/cas-client
{:git/sha "84ab35c3321c1e51a589fddbeee058aecd055bf8"}
io.github.nextjournal/clerk
{:git/sha "d80187013d7b7b96db3d8b114b8d99f687170668"}

io.github.nextjournal/clerk.render
{:git/url "https://github.com/nextjournal/clerk"
:git/sha "d80187013d7b7b96db3d8b114b8d99f687170668"
:deps/root "render"}}
:exec-fn user/build!}

:cljs
Expand All @@ -19,6 +29,7 @@
:test
{:extra-paths ["test"]
:extra-deps {com.gfredericks/test.chuck {:mvn/version "0.2.14"}
org.babashka/sci {:mvn/version "0.8.40"}
org.clojure/test.check {:mvn/version "1.1.1"}
same/ish {:mvn/version "0.1.6"}}}

Expand Down
79 changes: 0 additions & 79 deletions examples/src/gen/clerk/viewer.clj

This file was deleted.

Loading

0 comments on commit c0a1079

Please sign in to comment.