Skip to content

Commit

Permalink
Update to 0.1.1
Browse files Browse the repository at this point in the history
I can build a reasonable graalvm native image now
  • Loading branch information
crinklywrappr committed Aug 21, 2020
1 parent 1c8e774 commit 73cab59
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 16 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Download the application from the releases page.

```
$ rp -s starship --with-repo chocolatey --with-repo scoop
"rust:starship-module-config-derive" is in 0/4 repositories
"starship" is in 3/20 repositories
rust:starship-module-config-derive... 0/4 repos
starship............................. 3/20 repos
$ rp -p starship --with-repo chocolatey --with-repo scoop
| :repo | :subrepo | :name | :version | :status |
Expand Down Expand Up @@ -52,7 +52,7 @@ I wrote this in an afternoon. I had a vm with 4 non-language-specific package m

After writing it, I realized it's small enough (< 150 loc) to be an excellent project for playing around with lumo, babashka, graal native image, etc.

This has already been accomplished with graal native image. However, the image size is huge. I believe this is due to limitations with clj-http-lite.
This has already been accomplished with graal native image.

## License

Expand Down
16 changes: 9 additions & 7 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
(defproject repoman "0.1.0-SNAPSHOT"
(defproject repoman "0.1.1"
:description "Tiny tool to query repology"
:url "http://example.com/FIXME"
: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 [[org.clojure/clojure "1.10.1"]
:dependencies [[org.clojure/clojure "1.10.2-alpha1"]
[org.clojure/tools.cli "1.0.194"]
;; clj-http incompatible with graal
[org.martinklepsch/clj-http-lite "0.4.3"]
;; 0.4.3-1 is built locally, using the latest commit
[org.martinklepsch/clj-http-lite "0.4.3-1"]
[cheshire "5.10.0"]
[camel-snake-kebab "0.4.1"]]
:plugins [[io.taylorwood/lein-native-image "0.3.1"]]
:main ^:skip-aot repoman.core
:target-path "target/%s"
:java-cmd "C:\\Users\\doubl\\scoop\\apps\\openjdk15\\current\\bin\\java.exe"
:javac-options ["-server"]
:native-image
{:name "rp"
:graal-bin "C:\\Program Files\\GraalVM\\graalvm-ce-java11-20.1.0\\bin"
;; :jvm-opts ["-Dclojure.compiler.direct-linking=true"]
:opts ["--verbose"
"--report-unsupported-elements-at-runtime"
;; "--report-unsupported-elements-at-runtime"
"--initialize-at-build-time"
"--allow-incomplete-classpath" ;; clj-http-lite requires this
"--enable-https"
"--no-fallback"]}
:profiles
{:uberjar
{:aot :all
:native-image
{:jvm-opts ["-Dclojure.compiler.direct-linking=true"]}}})
:jvm-opts ["-Dclojure.compiler.direct-linking=true"]}})
22 changes: 16 additions & 6 deletions src/repoman/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
(:import [java.io File])
(:gen-class))

;; (set! *warn-on-reflection* true)
(set! *warn-on-reflection* true)

(def endpoint "https://repology.org/api/v1/")
(def pkg-keys [:repo :subrepo :name :version :status])
Expand Down Expand Up @@ -76,8 +76,9 @@
(fn [[k v]]
(let [v (transform-keys ->kebab-case-keyword v)]
{:prj k
:prj-len (count k)
:repos (count v)
:avail? (count (filter (partial in-repos? repos) v))})))))
:matches (count (filter (partial in-repos? repos) v))})))))

(defn project
"Gets project information from repology
Expand Down Expand Up @@ -105,10 +106,19 @@
[repos {:keys [search json]}]
(let [xs (repoman.core/search repos search)]
(if json
(println (json/generate-string xs {:pretty true}))
(doseq [m xs]
(println (format "\"%s\" is in %d/%d repositories"
(:prj m) (:avail? m) (:repos m)))))))
(println
(json/generate-string
(map #(dissoc % :prj-len) xs)
{:pretty true}))
(let [max-len (apply max (map :prj-len xs))]
(doseq [{:keys [prj prj-len repos matches]} xs]
(println
(format
"%s...%s%3s/%s repos"
prj
(apply str (repeat (- max-len prj-len) \.))
matches
repos)))))))

(defn format-project
"Prints project data to the screen.
Expand Down

0 comments on commit 73cab59

Please sign in to comment.