From b7ae026280f2bfe66ecd1a94d76977cb3230fc60 Mon Sep 17 00:00:00 2001 From: Peter Taoussanis Date: Fri, 28 Oct 2022 09:08:50 +0200 Subject: [PATCH] [nop] Update project template --- .github/workflows/build.yml | 25 ----------- .github/workflows/graal-tests.yml | 32 ++++++++++++++ .github/workflows/main-tests.yml | 30 +++++++++++++ CHANGELOG.md | 4 +- FUNDING.yml | 2 +- LICENSE => LICENSE.txt | 0 README.md | 42 +++++++++--------- bb.edn | 10 +++++ bb/graal_tests.clj | 36 ++++++++++++++++ project.clj | 72 +++++++++++++++++-------------- test/taoensso/graal_tests.clj | 5 +++ 11 files changed, 176 insertions(+), 82 deletions(-) delete mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/graal-tests.yml create mode 100644 .github/workflows/main-tests.yml rename LICENSE => LICENSE.txt (100%) create mode 100644 bb.edn create mode 100755 bb/graal_tests.clj create mode 100644 test/taoensso/graal_tests.clj diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index cbe91db..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: build - -on: [push, pull_request] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-java@v1 - with: - java-version: 14 - - - name: Cache deps - uses: actions/cache@v1 - id: cache-deps - with: - path: ~/.m2/repository - key: ${{ runner.os }}-java14-${{ hashFiles('project.clj') }} - restore-keys: | - ${{ runner.os }}-java14- - - - name: Run tests for Java 14 - run: | - lein test-all diff --git a/.github/workflows/graal-tests.yml b/.github/workflows/graal-tests.yml new file mode 100644 index 0000000..b2ea89b --- /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@v3 + - uses: graalvm/setup-graalvm@v1 + with: + version: 'latest' + java-version: ${{ matrix.java }} + components: 'native-image' + github-token: ${{ secrets.GITHUB_TOKEN }} + + - uses: DeLaGuardo/setup-clojure@10.0 + with: + lein: latest + bb: latest + + - uses: actions/cache@v3 + 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..900a96e --- /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@v3 + - uses: actions/setup-java@v3 + with: + distribution: 'corretto' + java-version: ${{ matrix.java }} + + - uses: DeLaGuardo/setup-clojure@10.0 + with: + lein: latest + + - uses: actions/cache@v3 + 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 8bd6e3e..2cabb89 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) +This project uses Break Versioning (https://www.taoensso.com/break-versioning) ## v1.5.3 - 2022 Oct 27 @@ -8,7 +8,7 @@ > This is a major maintenance release that should be non-breaking for most users. -* **New**: Wiki docs at https://github.com/ptaoussanis/tempura/wiki +* **New**: Wiki docs at https://github.com/taoensso/tempura/wiki * **New**: Add `new-tr-fn` for creating `tr` partials with fn-local cache. * **BREAKING**: `wrap-ring-request` (alpha) API changes, see commit ed688af18de2 for details. diff --git a/FUNDING.yml b/FUNDING.yml index dc3d4d2..964e36a 100644 --- a/FUNDING.yml +++ b/FUNDING.yml @@ -1,2 +1,2 @@ github: ptaoussanis -custom: "https://www.taoensso.com/clojure/backers" +custom: "https://www.taoensso.com/clojure" diff --git a/LICENSE b/LICENSE.txt similarity index 100% rename from LICENSE rename to LICENSE.txt diff --git a/README.md b/README.md index d666852..1264437 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,20 @@ -Taoensso open-source +Taoensso open-source -**[CHANGELOG]** | [API] | current [Break Version]: +**[CHANGELOG][]** | [API][] | current [Break Version][]: ```clojure [com.taoensso/tempura "1.5.3"] ; See CHANGELOG for details ``` -> See [here](https://taoensso.com/clojure/backers) if you're interested in helping support my open-source work, thanks! - Peter Taoussanis +> See [here][backers] if to help support my open-source work, thanks! - [Peter Taoussanis][Taoensso.com] # Tempura: a pure Clojure/Script i18n translations library ## Objectives * Tiny (**single fn**), **cross-platform all-Clojure API** for providing multilingual content. - * Match [gettext]'s convenience for **embedding default content** directly in code (optional). + * Match [gettext][]'s convenience for **embedding default content** directly in code (optional). * Exceed `gettext`'s ability to handle **versioned content** through unique content ids. * Work out-the-box with plain text, Hiccup, **Reactjs**, ... * Easy, optional platform-appropriate support for simple **Markdown styles**. @@ -68,7 +68,7 @@ ``` -See the [wiki docs] for a more detailed discussion of Tempura's resource search behaviour. +See the [wiki docs][] for a more detailed discussion of Tempura's resource search behaviour. ## Quickstart @@ -153,7 +153,7 @@ And we're ready to go: (tr [:example/invalid [:div "My **fallback** div"]]) ; => [:div "My " [:strong "fallback"] " div"] ``` -And that's it, you know the [API]: +And that's it, you know the [API][]: ```clojure (tr [opts locales resource-ids]) ; Without argument interpolation, or @@ -196,7 +196,7 @@ I'll note that since the API is so pleasant, it's actually often much _less_ eff If it's easy to use, it'll be easy to get your developers in the habit of writing content this way - which means that there's a trivial path to adding multilingual support whenever it makes sense to do so. -> See also the [wiki docs] for more info. +> See also the [wiki docs][] for more info. ## FAQ @@ -218,7 +218,7 @@ As an example: So performance is often on par with the best possible hand-optimized monolingual code. -#### How would you use this with [Reagent], etc.? +#### How would you use this with [Reagent][], etc.? Tempura was specifically designed to work with Reactjs applications, and works great with Reagent out-the-box. @@ -240,29 +240,27 @@ Shouldn't be hard to do, you'll just need a conversion tool to/from edn. Haven't ## Contacting me / contributions -Please use the project's [GitHub issues page] for all questions, ideas, etc. **Pull requests welcome**. See the project's [GitHub contributors page] for a list of contributors. +Please use the project's [GitHub issues page][] for all questions, ideas, etc. **Pull requests welcome**. See the project's [GitHub contributors page][] for a list of contributors. -Otherwise, you can reach me at [Taoensso.com]. Happy hacking! +Otherwise, you can reach me at [Taoensso.com][]. Happy hacking! -\- [Peter Taoussanis] +\- [Peter Taoussanis][Taoensso.com] ## License -Distributed under the [EPL v1.0] \(same as Clojure). -Copyright © 2016-2022 [Peter Taoussanis]. +Distributed under the [EPL v1.0][] \(same as Clojure). +Copyright © 2016-2022 [Peter Taoussanis][Taoensso.com]. [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 +[Break Version]: https://github.com/taoensso/encore/blob/master/BREAK-VERSIONING.md +[backers]: https://taoensso.com/clojure/backers -[CHANGELOG]: https://github.com/ptaoussanis/tempura/releases -[API]: http://ptaoussanis.github.io/tempura/ -[GitHub issues page]: https://github.com/ptaoussanis/tempura/issues -[GitHub contributors page]: https://github.com/ptaoussanis/tempura/graphs/contributors +[CHANGELOG]: https://github.com/taoensso/tempura/releases +[API]: http://taoensso.github.io/tempura/ +[GitHub issues page]: https://github.com/taoensso/tempura/issues +[GitHub contributors page]: https://github.com/taoensso/tempura/graphs/contributors [EPL v1.0]: https://raw.githubusercontent.com/ptaoussanis/tempura/master/LICENSE [Hero]: https://raw.githubusercontent.com/ptaoussanis/tempura/master/hero.png "Title" @@ -271,4 +269,4 @@ Copyright © 2016-2022 [Peter Taoussanis]. [Reagent]: https://github.com/reagent-project/reagent [tutorial]: https://gist.github.com/field-theory/b7c05953e32645d880eae382171a85d7 [@field-theory]: https://github.com/field-theory -[wiki docs]: https://github.com/ptaoussanis/tempura/wiki +[wiki docs]: https://github.com/taoensso/tempura/wiki 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..b8c00d6 --- /dev/null +++ b/bb/graal_tests.clj @@ -0,0 +1,36 @@ +#!/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") "-jar" "target/graal-tests.jar" "--no-fallback" "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 890ffe3..8dd2adc 100644 --- a/project.clj +++ b/project.clj @@ -1,40 +1,54 @@ (defproject com.taoensso/tempura "1.5.3" :author "Peter Taoussanis " - :description "Pure Clojure/Script i18n translations library" - :url "https://github.com/ptaoussanis/tempura" - :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 - *unchecked-math* false #_:warn-on-boxed} + :description "Simple text localization for Clojure/Script applications" + :url "https://github.com/taoensso/tempura" + + :license + {:name "Eclipse Public License - v 1.0" + :url "https://www.eclipse.org/legal/epl-v10.html"} :dependencies [[com.taoensso/encore "3.31.0"]] - :plugins - [[lein-pprint "1.3.2"] - [lein-ancient "0.7.0"] - [lein-codox "0.10.8"] - [lein-cljsbuild "1.1.8"]] - :profiles {;; :default [:base :system :user :provided :dev] - :server-jvm {:jvm-opts ^:replace ["-server"]} :provided {:dependencies [[org.clojure/clojurescript "1.11.60"] [org.clojure/clojure "1.11.1"]]} :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"]]} - :depr {:jvm-opts ["-Dtaoensso.elide-deprecated=true"]} - :dev [:c1.11 :test :server-jvm :depr] - :test {:dependencies [[org.clojure/test.check "1.1.1"]]}} + :test + {:jvm-opts ["-Dtaoensso.elide-deprecated=true"] + :global-vars + {*warn-on-reflection* true + *assert* true + *unchecked-math* false #_:warn-on-boxed} + + :dependencies + [[org.clojure/test.check "1.1.1"]]} + + :graal-tests + {:dependencies [[org.clojure/clojure "1.11.1"] + [com.github.clj-easy/graal-build-time "0.1.4"]] + :main taoensso.graal-tests + :aot [taoensso.graal-tests] + :uberjar-name "graal-tests.jar"} + + :dev + [:c1.11 :test + {:jvm-opts ["-server"] + :plugins + [[lein-pprint "1.3.2"] + [lein-ancient "0.7.0"] + [lein-cljsbuild "1.1.8"] + [com.taoensso.forks/lein-codox "0.10.10"]] + + :codox + {:language #{:clojure :clojurescript} + :base-language :clojure}}]} - :test-paths ["src" "test"] + :test-paths ["test" #_"src"] :cljsbuild {:test-commands {"node" ["node" "target/test.js"]} @@ -54,15 +68,9 @@ :aliases {"start-dev" ["with-profile" "+dev" "repl" ":headless"] + "build-once" ["do" ["clean"] ["cljsbuild" "once"]] "deploy-lib" ["do" ["build-once"] ["deploy" "clojars"] ["install"]] - "build-once" ["do" ["clean"] "cljsbuild" "once"] - "test-cljs" ["with-profile" "+test" "cljsbuild" "test"] - "test-all" - ["do" ["clean"] - "with-profile" "+c1.11:+c1.10:+c1.9" "test," - "test-cljs"]} - - :repositories - {"sonatype-oss-public" - "https://oss.sonatype.org/content/groups/public/"}) + "test-clj" ["with-profile" "+c1.11:+c1.10:+c1.9" "test"] + "test-cljs" ["with-profile" "+test" "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..0bc9af2 --- /dev/null +++ b/test/taoensso/graal_tests.clj @@ -0,0 +1,5 @@ +(ns taoensso.graal-tests + (:require [taoensso.tempura :as tempura]) + (:gen-class)) + +(defn -main [& args] (println "Namespace loaded successfully"))