diff --git a/.github/workflows/clojure.yml b/.github/workflows/clojure.yml index ff122e0..15d1d17 100644 --- a/.github/workflows/clojure.yml +++ b/.github/workflows/clojure.yml @@ -18,13 +18,16 @@ jobs: os: [ubuntu-latest] container: - image: clojure:openjdk-${{ matrix.jdk_version }}-tools-deps + image: clojure:openjdk-${{ matrix.jdk_version }}-lein steps: - - uses: actions/checkout@v4 - - name: Version - run: clj --version - - name: Prepare Deps - run: clj -P - - name: Test, Write POM, Build - run: clj -T:build jar + - uses: actions/checkout@v2 + - name: Info + run: lein version + - name: Package + run: | + lein deps + lein compile + lein uberjar + - name: Tests + run: lein test diff --git a/.gitignore b/.gitignore index 23e0252..da3d4bb 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ .clj-kondo/ /.cpcache/ *.jar +/.lein-* .lsp/ /.nrepl-port pom.xml diff --git a/build.clj b/build.clj deleted file mode 100644 index 02fe6b4..0000000 --- a/build.clj +++ /dev/null @@ -1,105 +0,0 @@ -(ns build - "Clean: - clj -T:build clean - - Test: - clj -T:build test - - Test, Write POM, Build JAR: - clj -T:build jar - - Deploy to Clojars: - CLOJARS_USERNAME=username - CLOJARS_PASSWORD=clojars-token - clj -T:build deploy" - (:refer-clojure :exclude [test]) - (:require [clojure.tools.build.api :as b] - [deps-deploy.deps-deploy :as dd])) - -(def project - "Project Metadata" - {:description "A library of functions to enhance clojure.core." - :lib 'com.github.wdhowe/clj-contrib - :version "1.0.0" - :license "Eclipse Public License" - :license-url "http://www.eclipse.org/legal/epl-v20.html" - :author "Bill Howe" - :url "https://github.com/wdhowe/clj-contrib" - :git-repo "wdhowe/clj-contrib" - :class-dir "target/classes"}) - -(defn- pom-template - [version] - (let [git-repo (:git-repo project) - url (:url project)] - [[:description (:description project)] - [:url url] - [:licenses - [:license - [:name (:license project)] - [:url (:license-url project)]]] - [:developers - [:developer - [:name (:author project)]]] - [:scm - [:url url] - [:connection (format "scm:git:%s.git" url)] - [:developerConnection (format "scm:git:ssh:git@github.com:%s.git" git-repo)] - [:tag (str "v" version)]]])) - -(defn- jar-opts - [opts] - (let [version (:version project) - lib (:lib project)] - (assoc opts - :basis (b/create-basis {}) - :class-dir (:class-dir project) - :jar-file (format "target/%s-%s.jar" lib version) - :lib lib - :pom-data (pom-template version) - :src-dirs ["src"] - :target "target" - :version version))) - -(defn clean - "Remove build directory." - [_] - (b/delete {:path "target"})) - -(defn test - "Run all the tests." - [opts] - (let [basis (b/create-basis {:aliases [:test]}) - cmds (b/java-command - {:basis basis - :main 'clojure.main - :main-args ["-m" "cognitect.test-runner"]}) - {:keys [exit]} (b/process cmds)] - (when-not (zero? exit) (throw (ex-info "Tests failed" {})))) - opts) - -(defn jar - "Run the CI pipeline of: tests, write pom, and build the JAR." - [opts] - (test opts) - (clean nil) - (let [opts (jar-opts opts)] - (println "\nWriting pom.xml...") - (b/write-pom opts) - (println "\nCopying source...") - (b/copy-dir {:src-dirs ["resources" "src"] - :target-dir (:class-dir project)}) - (println "\nBuilding JAR" (:jar-file opts) "...") - (b/jar opts) - (println (format "Created %s" (:jar-file opts)))) - opts) - -(defn deploy - "Deploy the JAR to Clojars." - [opts] - (let [{:keys [jar-file] :as opts} - (jar-opts opts)] - (dd/deploy {:installer :remote - :artifact (b/resolve-path jar-file) - :pom-file (b/pom-path (select-keys opts [:lib :class-dir]))})) - opts) diff --git a/deps.edn b/deps.edn index 8b7bb58..2b5be0c 100644 --- a/deps.edn +++ b/deps.edn @@ -1,23 +1,6 @@ {;; Dependencies - :deps {org.clojure/clojure {:mvn/version "1.11.1"} + :deps {org.clojure/clojure {:mvn/version "1.11.2"} org.clojure/core.async {:mvn/version "1.6.681"}} ;; File system paths - :paths ["src" "resources"] - - ;; clj cli aliases - :aliases - {;; See build.clj for details of the :build alias. - :build {:deps {io.github.clojure/tools.build {:mvn/version "0.9.6"} - slipset/deps-deploy {:mvn/version "0.2.2"}} - :ns-default build} - - ;; Run tests: clj -X:test - :test {:extra-paths ["test"] - :extra-deps {org.clojure/test.check {:mvn/version "1.1.1"} - io.github.cognitect-labs/test-runner {:git/tag "v0.5.1" :git/sha "dfb30dd"}} - :exec-fn cognitect.test-runner.api/test} - - ;; Upgrade outdated deps: clj -M:outdated :upgrade true - :outdated {:deps {com.github.liquidz/antq {:mvn/version "RELEASE"}} - :main-opts ["-m" "antq.core"]}}} \ No newline at end of file + :paths ["src"]} diff --git a/project.clj b/project.clj new file mode 100644 index 0000000..3cf05eb --- /dev/null +++ b/project.clj @@ -0,0 +1,17 @@ +(defproject clj-contrib "0.1.0" + + ;;; Project Metadata + :description "A library of functions to enhance clojure.core." + :url "https://github.com/wdhowe/clj-contrib" + :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0" + :url "https://www.eclipse.org/legal/epl-2.0/"} + + ;;; Dependencies, Plugins + :dependencies [[org.clojure/clojure "1.11.2"] + [org.clojure/core.async "1.6.681"]] + + ;;; Profiles + :profiles {:uberjar {:aot :all}} + + ;;; Running Project Code + :repl-options {:init-ns clj-contrib.core})