Skip to content

Commit

Permalink
Update build
Browse files Browse the repository at this point in the history
  • Loading branch information
hlship committed Jun 15, 2023
1 parent 1006fbc commit 5cad9e2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 53 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Logging from the `com.walmartlabs.lacinia.pedestal.subscriptions` namespace
now is at level TRACE, not DEBUG.

[Closed Issues](https://github.com/walmartlabs/lacinia-pedestal/issues?q=is%3Aclosed+milestone%3A1.2)

## 1.1 -- 14 Jan 2020

Expand Down
66 changes: 16 additions & 50 deletions build.clj
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,21 @@
;; clj -T:build <var>

(ns build
(:require [clojure.tools.build.api :as b]
[deps-deploy.deps-deploy :as d]))
(:require [clojure.tools.build.api :as api]
[net.lewisship.build :as b]))

(def lib 'com.walmartlabs/lacinia-pedestal)
(def version "1.1")
(def version "1.2-beta-1")

(def project-opts
{:project-name lib
:version version})

(def class-dir "target/classes")
(def jar-file (format "target/%s-%s.jar" (name lib) version))
(def copy-srcs ["src" "resources"])

(defn clean
[_]
(b/delete {:path "target"}))
(api/delete {:path "target"}))

(def ^:private graphiql-files
{"graphiql/graphiql.min.js" "graphiql.min.js"
Expand All @@ -39,64 +42,27 @@
(defn prep
"Runs `npm install` and copies necessary files into class-dir."
[_]
(let [{:keys [exit out err] :as process-result}
(b/process {:command-args ["npm" "ci"]
:dir "node"})]
(let [{:keys [exit] :as process-result}
(api/process {:command-args ["npm" "ci"]
:dir "node"})]
(when-not (zero? exit)
(throw (ex-info "npm install failed"
process-result)))
(doseq [[node-path resource-name] graphiql-files
:let [in-path (str "node/node_modules/" node-path)
out-path (str class-dir "/graphiql/" resource-name)]]
(b/copy-file {:src in-path :target out-path}))))
(api/copy-file {:src in-path :target out-path}))))

(defn jar
[_params]
(prep nil)
(let [basis (b/create-basis)]
(b/write-pom {:class-dir class-dir
:lib lib
:version version
:basis basis
:src-pom "templates/pom.xml"
:scm {:url "https://github.com/walmartlabs/lacinia-pedestal"
:connection "scm:git:git://github.com/walmartlabs/lacinia-pedestal.git"
:developerConnection "scm:git:ssh://[email protected]/walmartlabs/lacinia-pedestal.git"
:tag version}
:src-dirs ["src"]
:resource-dirs ["resources"]})
(b/copy-dir {:src-dirs copy-srcs
:target-dir class-dir})
(b/jar {:class-dir class-dir
:jar-file jar-file}))
(println "Created:" jar-file))
(b/create-jar project-opts))

(defn deploy
[_params]
(clean nil)
(jar nil)
(d/deploy {:installer :remote
:artifact jar-file
:pom-file (b/pom-path {:lib lib :class-dir class-dir})
:sign-releases? true
:sign-key-id (or (System/getenv "CLOJARS_GPG_ID")
(throw (RuntimeException. "CLOJARS_GPG_ID environment variable not set")))}))
(b/deploy-jar (jar nil)))

(defn codox
[_params]
(let [basis (b/create-basis {:extra '{:deps {codox/codox {:mvn/version "0.10.8"
:exclusions [org.ow2.asm/asm-all]}}}
:aliases [:dev]})
expression `(do
((requiring-resolve 'codox.main/generate-docs)
{:metadata {:doc/format :markdown}
:source-uri "https://github.com/walmartlabs/lacinia-pedestal/blob/master/{filepath}#L{line}"
:name ~(str lib)
:version ~version
:description "Clojure-native implementation of GraphQL"})
nil)
process-params (b/java-command
{:basis basis
:main "clojure.main"
:main-args ["--eval" (pr-str expression)]})]
(b/process process-params)))
(b/generate-codox project-opts))
9 changes: 6 additions & 3 deletions deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@

:build
{:deps
{io.github.clojure/tools.build {:git/tag "v0.9.4" :git/sha "76b78fe"}
slipset/deps-deploy {:mvn/version "0.2.1"}}
:ns-default build}}}
{io.github.hlship/build-tools {:git/tag "0.9" :git/sha "4efa3c9"}}
:ns-default build}}

:codox/config
{:description "Expose Lacinia GraphQL as Pedestal endpoints"
:source-uri "https://github.com/walmartlabs/lacinia-pedestal/blob/master/{filepath}#L{line}"}}

0 comments on commit 5cad9e2

Please sign in to comment.