diff --git a/.github/workflows/graal-tests.yml b/.github/workflows/graal-tests.yml new file mode 100644 index 0000000..14495f4 --- /dev/null +++ b/.github/workflows/graal-tests.yml @@ -0,0 +1,32 @@ +name: Graal tests +on: [push, pull_request] + +jobs: + test: + strategy: + matrix: + java: ['17'] + os: [ubuntu-latest, macOS-latest, windows-latest] + + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - uses: graalvm/setup-graalvm@v1 + with: + version: 'latest' + java-version: ${{ matrix.java }} + components: 'native-image' + github-token: ${{ secrets.GITHUB_TOKEN }} + + - uses: DeLaGuardo/setup-clojure@12.5 + with: + lein: latest + bb: latest + + - uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: deps-${{ hashFiles('deps.edn') }} + restore-keys: deps- + + - run: bb graal-tests diff --git a/.github/workflows/main-tests.yml b/.github/workflows/main-tests.yml new file mode 100644 index 0000000..faa64d6 --- /dev/null +++ b/.github/workflows/main-tests.yml @@ -0,0 +1,30 @@ +name: Main tests +on: [push, pull_request] + +jobs: + tests: + strategy: + matrix: + java: ['17', '18', '19'] + os: [ubuntu-latest] + + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + distribution: 'corretto' + java-version: ${{ matrix.java }} + + - uses: DeLaGuardo/setup-clojure@12.5 + with: + lein: latest + + - uses: actions/cache@v4 + id: cache-deps + with: + path: ~/.m2/repository + key: deps-${{ hashFiles('project.clj') }} + restore-keys: deps- + + - run: lein test-all diff --git a/CHANGELOG.md b/CHANGELOG.md index 2bb5376..06b3053 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -> This project uses [Break Versioning](https://github.com/ptaoussanis/encore/blob/master/BREAK-VERSIONING.md) as of **Aug 16, 2014**. +This project uses Break Versioning (https://www.taoensso.com/break-versioning) ## v3.1.0-beta4 / 2015 Jul 13 @@ -54,7 +54,7 @@ ## v3.0.1 / 2014 Sep 7 - * **FIX**: https://github.com/ptaoussanis/timbre/issues/79. + * **FIX**: https://github.com/taoensso/timbre/issues/79. ## v3.0.0 / 2014 Aug 28 diff --git a/FUNDING.yml b/FUNDING.yml new file mode 100644 index 0000000..964e36a --- /dev/null +++ b/FUNDING.yml @@ -0,0 +1,2 @@ +github: ptaoussanis +custom: "https://www.taoensso.com/clojure" diff --git a/README.md b/README.md index a0790ce..05fbd95 100644 --- a/README.md +++ b/README.md @@ -8,15 +8,9 @@ [com.taoensso/tower "3.1.0-beta4"] ; EOL but stable ``` -> Please consider helping to [support my continued open-source Clojure/Script work]? -> -> Even small contributions can add up + make a big difference to help sustain my time writing, maintaining, and supporting Tower and other Clojure/Script libraries. **Thank you!** -> -> \- Peter Taoussanis +> See [here](https://taoensso.com/clojure/backers) if you're interested in helping support my open-source work, thanks! - Peter Taoussanis -# Tower - -## Clojure/Script i18n & L10n library +# Tower: a Clojure/Script i18n & L10n library The Java platform provides some very capable tools for writing internationalized applications. Unfortunately, they can be... cumbersome. We can do much better in Clojure. @@ -58,7 +52,8 @@ I apologise for the stress/trouble that this might cause, but hope that the pres Add the necessary dependency to your project: ```clojure -[com.taoensso/tower "3.0.2"] +Leiningen: [com.taoensso/tower "3.0.2"] ; or +deps.edn: com.taoensso/tower {:mvn/version "3.0.2"} ``` And setup your namespace imports: @@ -238,25 +233,24 @@ Otherwise, you can reach me at [Taoensso.com]. Happy hacking! ## License Distributed under the [EPL v1.0] \(same as Clojure). -Copyright © 2012-2016 [Peter Taoussanis]. +Copyright © 2012-2020 [Peter Taoussanis]. [Taoensso.com]: https://www.taoensso.com [Peter Taoussanis]: https://www.taoensso.com [@ptaoussanis]: https://www.taoensso.com [More by @ptaoussanis]: https://www.taoensso.com -[Break Version]: https://github.com/ptaoussanis/encore/blob/master/BREAK-VERSIONING.md -[support my continued open-source Clojure/Script work]: http://taoensso.com/clojure/backers +[Break Version]: https://github.com/taoensso/encore/blob/master/BREAK-VERSIONING.md -[CHANGELOG]: https://github.com/ptaoussanis/tower/releases -[API]: http://ptaoussanis.github.io/tower/ -[GitHub issues page]: https://github.com/ptaoussanis/tower/issues -[GitHub contributors page]: https://github.com/ptaoussanis/tower/graphs/contributors +[CHANGELOG]: https://github.com/taoensso/tower/releases +[API]: http://taoensso.github.io/tower/ +[GitHub issues page]: https://github.com/taoensso/tower/issues +[GitHub contributors page]: https://github.com/taoensso/tower/graphs/contributors [EPL v1.0]: https://raw.githubusercontent.com/ptaoussanis/tower/master/LICENSE [Hero]: https://raw.githubusercontent.com/ptaoussanis/tower/master/hero.png "Title" -[Tempura]: https://github.com/ptaoussanis/tempura +[Tempura]: https://github.com/taoensso/tempura [ClojureWerkz-logo]: https://raw.github.com/clojurewerkz/clojurewerkz.org/master/assets/images/logos/clojurewerkz_long_h_50.png [ClojureWerkz]: http://clojurewerkz.org/ diff --git a/bb.edn b/bb.edn new file mode 100644 index 0000000..5721f2a --- /dev/null +++ b/bb.edn @@ -0,0 +1,10 @@ +{:paths ["bb"] + :tasks + {:requires ([graal-tests]) + graal-tests + {:doc "Run Graal native-image tests" + :task + (do + (graal-tests/uberjar) + (graal-tests/native-image) + (graal-tests/run-tests))}}} diff --git a/bb/graal_tests.clj b/bb/graal_tests.clj new file mode 100755 index 0000000..3397ebe --- /dev/null +++ b/bb/graal_tests.clj @@ -0,0 +1,38 @@ +#!/usr/bin/env bb + +(ns graal-tests + (:require + [clojure.string :as str] + [babashka.fs :as fs] + [babashka.process :refer [shell]])) + +(defn uberjar [] + (let [command "lein with-profiles +graal-tests uberjar" + command + (if (fs/windows?) + (if (fs/which "lein") + command + ;; Assume PowerShell powershell module + (str "powershell.exe -command " (pr-str command))) + command)] + + (shell command))) + +(defn executable [dir name] + (-> (fs/glob dir (if (fs/windows?) (str name ".{exe,bat,cmd}") name)) + first + fs/canonicalize + str)) + +(defn native-image [] + (let [graalvm-home (System/getenv "GRAALVM_HOME") + bin-dir (str (fs/file graalvm-home "bin"))] + (shell (executable bin-dir "gu") "install" "native-image") + (shell (executable bin-dir "native-image") + "--features=clj_easy.graal_build_time.InitClojureClasses" + "--no-fallback" "-jar" "target/graal-tests.jar" "graal_tests"))) + +(defn run-tests [] + (let [{:keys [out]} (shell {:out :string} (executable "." "graal_tests"))] + (assert (str/includes? out "loaded") out) + (println "Native image works!"))) diff --git a/project.clj b/project.clj index 24bcac2..c295559 100644 --- a/project.clj +++ b/project.clj @@ -1,91 +1,83 @@ (defproject com.taoensso/tower "3.1.0-beta5" :author "Peter Taoussanis " - :description "Clojure/Script i18n & L10n library" - :url "https://github.com/ptaoussanis/tower" - :license {:name "Eclipse Public License" - :url "http://www.eclipse.org/legal/epl-v10.html" - :distribution :repo - :comments "Same as Clojure"} - :min-lein-version "2.3.3" - :global-vars {*warn-on-reflection* true - *assert* true} + :description "i18n & L10n library for Clojure/Script" + :url "https://github.com/taoensso/tower" + + :license + {:name "Eclipse Public License - v 1.0" + :url "https://www.eclipse.org/legal/epl-v10.html"} + + :test-paths ["test" #_"src"] :dependencies - [[org.clojure/clojure "1.5.1"] - [com.taoensso/encore "2.68.0"] + [[com.taoensso/encore "2.68.0"] [com.taoensso/timbre "4.7.3"] [markdown-clj "0.9.89"]] - :plugins - [[lein-pprint "1.1.2"] - [lein-ancient "0.6.10"] - [lein-codox "0.9.5"]] - :profiles {;; :default [:base :system :user :provided :dev] - :server-jvm {:jvm-opts ^:replace ["-server"]} - :1.5 {:dependencies [[org.clojure/clojure "1.5.1"]]} - :1.6 {:dependencies [[org.clojure/clojure "1.6.0"]]} - :1.7 {:dependencies [[org.clojure/clojure "1.7.0"]]} - :1.8 {:dependencies [[org.clojure/clojure "1.8.0"]]} - :1.9 {:dependencies [[org.clojure/clojure "1.9.0-alpha10"]]} - :test {:dependencies [[org.clojure/test.check "0.9.0"] - [expectations "2.1.9"] - [ring/ring-core "1.5.0"]] - :plugins [[lein-expectations "0.0.8"] - [lein-autoexpect "1.4.2"]]} + :provided {:dependencies [[org.clojure/clojurescript "1.11.60"] + [org.clojure/clojure "1.11.1"]]} + :c1.12 {:dependencies [[org.clojure/clojure "1.12.0-alpha9"]]} + :c1.11 {:dependencies [[org.clojure/clojure "1.11.1"]]} + :c1.10 {:dependencies [[org.clojure/clojure "1.10.3"]]} + :c1.9 {:dependencies [[org.clojure/clojure "1.9.0"]]} + + :graal-tests + {:source-paths ["test"] + :main taoensso.graal-tests + :aot [taoensso.graal-tests] + :uberjar-name "graal-tests.jar" + :dependencies + [[org.clojure/clojure "1.11.1"] + [com.github.clj-easy/graal-build-time "1.0.5"]]} + :dev - [:1.9 :test :server-jvm - {:dependencies - [[org.clojure/clojurescript "1.9.93"]] + {:jvm-opts ["-server" #_"-Dtaoensso.elide-deprecated=true"] + + :global-vars + {*warn-on-reflection* true + *assert* true + *unchecked-math* false #_:warn-on-boxed} - :plugins - [;; These must be in :dev, Ref. https://github.com/lynaghk/cljx/issues/47: - [com.keminglabs/cljx "0.6.0"] - [lein-cljsbuild "1.1.3"]]}]} + :dependencies + [[org.clojure/test.check "0.9.0"] + [expectations "2.1.9"] + [ring/ring-core "1.5.0"]] - :source-paths ["src" "target/classes"] - :test-paths ["src" "test" "target/test-classes"] + :plugins + [[lein-expectations "0.0.8"] + [lein-autoexpect "1.4.2"] + [lein-pprint "1.3.2"] + [lein-ancient "0.7.0"] + [lein-cljsbuild "1.1.8"] + [com.taoensso.forks/lein-codox "0.10.11"]] - :cljx - {:builds - [{:source-paths ["src"] :rules :clj :output-path "target/classes"} - {:source-paths ["src"] :rules :cljs :output-path "target/classes"} - {:source-paths ["src" "test"] :rules :clj :output-path "target/test-classes"} - {:source-paths ["src" "test"] :rules :cljs :output-path "target/test-classes"}]} + :codox + {:language #{:clojure :clojurescript} + :base-language :clojure}}} :cljsbuild - {:test-commands {} + {:test-commands {"node" ["node" "target/test.js"]} :builds - [{:id "main" - :source-paths ["src" "target/classes"] - ;; :notify-command ["terminal-notifier" "-title" "cljsbuild" "-message"] - :compiler {:output-to "target/main.js" - :optimizations :advanced - :pretty-print false}} - {:id "tests" - :source-paths ["src" "target/classes" "test" "target/test-classes"] - ;; :notify-command [] - :compiler {:output-to "target/tests.js" - :optimizations :whitespace - :pretty-print true - :main "taoensso.tempura.tests"}}]} - - :auto-clean false - :prep-tasks [["cljx" "once"] "javac" "compile"] + [{:id :main + :source-paths ["src"] + :compiler + {:output-to "target/main.js" + :optimizations :advanced}} - :codox - {:language :clojure ; [:clojure :clojurescript] ; No support? - :source-paths ["target/classes"] - :source-uri - {#"target/classes" "https://github.com/ptaoussanis/tempura/blob/master/src/{classpath}x#L{line}" - #".*" "https://github.com/ptaoussanis/tempura/blob/master/{filepath}#L{line}"}} + {:id :test + :source-paths ["src" "test"] + :compiler + {:output-to "target/test.js" + :target :nodejs + :optimizations :simple}}]} :aliases - {"test-all" ["do" "clean," "cljx" "once," - "with-profile" "+1.9:+1.8:+1.7:+1.6:+1.5" "expectations"] - "build-once" ["do" "clean," "cljx" "once," "cljsbuild" "once" "main"] - "deploy-lib" ["do" "build-once," "deploy" "clojars," "install"] - "start-dev" ["with-profile" "+dev" "repl" ":headless"]} + {"start-dev" ["with-profile" "+dev" "repl" ":headless"] + "build-once" ["do" ["clean"] ["cljsbuild" "once"]] + "deploy-lib" ["do" ["build-once"] ["deploy" "clojars"] ["install"]] - :repositories {"sonatype-oss-public" "https://oss.sonatype.org/content/groups/public/"}) + "test-clj" ["with-profile" "+c1.12:+c1.11:+c1.10:+c1.9" "test"] + "test-cljs" ["with-profile" "+c1.12" "cljsbuild" "test"] + "test-all" ["do" ["clean"] ["test-clj"] ["test-cljs"]]}) diff --git a/test/taoensso/graal_tests.clj b/test/taoensso/graal_tests.clj new file mode 100644 index 0000000..04a5ea4 --- /dev/null +++ b/test/taoensso/graal_tests.clj @@ -0,0 +1,5 @@ +(ns taoensso.graal-tests + (:require [taoensso.tower :as tower]) + (:gen-class)) + +(defn -main [& args] (println "Namespace loaded successfully")) diff --git a/test/taoensso/tower/tests/main.clj b/test/taoensso/tower_tests.clj similarity index 98% rename from test/taoensso/tower/tests/main.clj rename to test/taoensso/tower_tests.clj index 1a9ac0d..1a493dd 100644 --- a/test/taoensso/tower/tests/main.clj +++ b/test/taoensso/tower_tests.clj @@ -1,9 +1,9 @@ -(ns taoensso.tower.tests.main +(ns taoensso.tower-tests (:require [expectations :as test :refer :all] [taoensso.tower :as tower :refer (with-tscope)]) (:import [java.util Date])) -(comment (test/run-tests '[taoensso.tower.tests.main])) +(comment (test/run-tests '[taoensso.tower-tests])) (defn- before-run {:expectations-options :before-run} []) (defn- after-run {:expectations-options :after-run} [])