Skip to content

Commit 01ada39

Browse files
committedMay 14, 2019
added safely
1 parent e6e9ce3 commit 01ada39

File tree

16 files changed

+97
-18
lines changed

16 files changed

+97
-18
lines changed
 

‎README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ Here the instructions on how to build your own Clojure projects with GraalVM.
1212
Here the list of libraries tested:
1313

1414
- [Clojure core](./clojure) :white_check_mark:
15-
- [amazonica/s3](./amazonica-s3) :x: (*Buildtime and Runtime error*)
16-
- [cheshire](./cheshire) :white_check_mark:
17-
- [nippy](./nippy) :warning: (*Can't serialize exceptions*)
18-
- cognitect/aws-api+s3 :question:
19-
- ring/jetty :question:
20-
- ring/http-kit :question:
21-
- ring/aleph :question:
22-
- safely :question:
15+
- [amazonica+s3](./amazonica-s3) - Cloud API wrapper library :x: (*Buildtime and Runtime error*)
16+
- [cheshire](./cheshire) - JSON parser/writer :white_check_mark:
17+
- [nippy](./nippy) - Clojure serialization/deserialization library :warning: (*Can't serialize exceptions*)
18+
- cognitect/aws-api+s3 - Cloud API library :question:
19+
- ring/jetty - Web server :question:
20+
- ring/http-kit - Web server :question:
21+
- ring/aleph - Web server :question:
22+
- [safely](./safely) - Circuit breaker :white_check_mark:
2323

2424

2525
More libraries to come (*PRs are welcome*).

‎amazonica-s3/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# amazonica-s3
22

3-
Testing whether Amazonica/s3 library can be used in a native binary image with GraalVM.
3+
Testing whether [Amazonica/s3](https://github.com/mcohen01/amazonica) library can be used in a native binary image with GraalVM.
44

55
## Usage
66

‎amazonica-s3/project.clj

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
:aliases
1919
{"native"
2020
["shell"
21-
"native-image" "--report-unsupported-elements-at-runtime"
21+
"native-image" "--report-unsupported-elements-at-runtime" "--no-server"
2222
"--initialize-at-build-time"
2323
"-jar" "./target/${:uberjar-name:-${:name}-${:version}-standalone.jar}"
2424
"-H:Name=./target/${:name}"]

‎aws-api-s3/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# cognitect/aws-api+s3
22

3-
Testing whether cognitect/aws-api+s3 library can be used in a native binary image with GraalVM.
3+
Testing whether [cognitect/aws-api+s3](https://github.com/cognitect-labs/aws-api) library can be used in a native binary image with GraalVM.
44

55
## Usage
66

‎aws-api-s3/project.clj

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
:aliases
1515
{"native"
1616
["shell"
17-
"native-image" "--report-unsupported-elements-at-runtime"
17+
"native-image" "--report-unsupported-elements-at-runtime" "--no-server"
1818
"--initialize-at-build-time"
1919
"-jar" "./target/${:uberjar-name:-${:name}-${:version}-standalone.jar}"
2020
"-H:Name=./target/${:name}"]

‎cheshire/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# cheshire
22

3-
Testing whether Cheshire library can be used in a native binary image with GraalVM.
3+
Testing whether [Cheshire](https://github.com/dakrone/cheshire) library can be used in a native binary image with GraalVM.
44

55
## Usage
66

‎cheshire/project.clj

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
:aliases
1313
{"native"
1414
["shell"
15-
"native-image" "--report-unsupported-elements-at-runtime"
15+
"native-image" "--report-unsupported-elements-at-runtime" "--no-server"
1616
"--initialize-at-build-time"
1717
"-jar" "./target/${:uberjar-name:-${:name}-${:version}-standalone.jar}"
1818
"-H:Name=./target/${:name}"]

‎nippy/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Nippy
22

3-
Testing whether Nippy library can be used in a native binary image with GraalVM.
3+
Testing whether [Nippy](https://github.com/ptaoussanis/nippy) library can be used in a native binary image with GraalVM.
44

55
## Usage
66

‎nippy/project.clj

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
:aliases
1313
{"native"
1414
["shell"
15-
"native-image" "--report-unsupported-elements-at-runtime"
15+
"native-image" "--report-unsupported-elements-at-runtime" "--no-server"
1616
"--initialize-at-build-time"
1717
"-jar" "./target/${:uberjar-name:-${:name}-${:version}-standalone.jar}"
1818
"-H:Name=./target/${:name}"]

‎ring-jetty/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ring+jetty
22

3-
Testing whether Ring library can be used in a native binary image with GraalVM.
3+
Testing whether [Ring](https://github.com/ring-clojure/ring) library can be used in a native binary image with GraalVM.
44

55
## Usage
66

‎ring-jetty/project.clj

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
:aliases
1717
{"native"
1818
["shell"
19-
"native-image" "--report-unsupported-elements-at-runtime"
19+
"native-image" "--report-unsupported-elements-at-runtime" "--no-server"
2020
"--initialize-at-build-time"
2121
"-jar" "./target/${:uberjar-name:-${:name}-${:version}-standalone.jar}"
2222
"-H:Name=./target/${:name}"]

‎safely/.gitignore

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/target
2+
/classes
3+
/checkouts
4+
profiles.clj
5+
pom.xml
6+
pom.xml.asc
7+
*.jar
8+
*.class
9+
/.lein-*
10+
/.nrepl-port
11+
.hgignore
12+
.hg/

‎safely/README.md

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# safely
2+
3+
Testing whether [Safely](https://github.com/BrunoBonacci/safely) library can be used in a native binary image with GraalVM.
4+
5+
## Usage
6+
7+
Currently testing:
8+
9+
[com.brunobonacci/safely "0.5.0-alpha6"]
10+
11+
Test with:
12+
13+
lein do clean, uberjar, native, run-native

‎safely/project.clj

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
(defproject safely "0.1.0-SNAPSHOT"
2+
3+
:dependencies [[org.clojure/clojure "1.10.0"]
4+
[com.brunobonacci/safely "0.5.0-alpha6"]
5+
;; to use with Log4J
6+
[org.slf4j/slf4j-log4j12 "1.7.25"]
7+
;; see also resource/log4j.properties
8+
]
9+
10+
:main simple.main
11+
12+
:uberjar-name "simple-main.jar"
13+
:profiles {:uberjar {:aot :all}
14+
:dev {:plugins [[lein-shell "0.5.0"]]}}
15+
16+
:aliases
17+
{"native"
18+
["shell"
19+
"native-image" "--report-unsupported-elements-at-runtime" "--no-server"
20+
;; to use without logging
21+
;;"--allow-incomplete-classpath"
22+
"--initialize-at-build-time"
23+
"-jar" "./target/${:uberjar-name:-${:name}-${:version}-standalone.jar}"
24+
"-H:Name=./target/${:name}"]
25+
26+
"run-native" ["shell" "./target/${:name}" "README.md"]})

‎safely/resources/log4j.properties

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Root logger option
2+
log4j.rootLogger=INFO, stdout
3+
4+
# Direct log messages to stdout
5+
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
6+
log4j.appender.stdout.Target=System.out
7+
log4j.appender.stdout.encoding=UTF-8
8+
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
9+
log4j.appender.stdout.layout.ConversionPattern=%-5p %c{1}:%L - %m%n
10+
11+
# Print only messages of level DEBUG or above in the package
12+
# log4j.logger.com.mypackage=DEBUG, stdout
13+
# or
14+
# log4j.category.com.mypackage=DEBUG

‎safely/src/simple/main.clj

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
(ns simple.main
2+
(:require [safely.core :refer [safely]])
3+
(:gen-class))
4+
5+
6+
7+
(defn -main [& [file]]
8+
(println "Attempting to read file:" file)
9+
(safely
10+
(println (slurp file))
11+
:on-error
12+
:max-retry 10
13+
:log-stacktrace false
14+
:circuit-breaker :read-file))

0 commit comments

Comments
 (0)
Please sign in to comment.