Add support for SQLite via a BABASHKA_FEATURE_SQLITE feature flag (#1079)

* implement native sqlite support as a feature flag following [1]

([1] is mentioned as a checklist of sorts as to how to add a new 
feature flag in [2])

[1] 13f65f05ae
[2] https://github.com/babashka/babashka/blob/master/doc/build.md

* bump to latest sqlite-jdbc, remove some no longer needed config+libs

based on feedback from borkdude here [1], bump xerial/sqlite-jdbc
3.36.0.3, which includes the graalvm classes and resource config
previously implemented via ericdallo/sqlite-jni-graal-fix and a `-H`
flag in `script/compile`

[1]: https://github.com/babashka/babashka/pull/1079#issuecomment-980533178
This commit is contained in:
Nik 2021-11-28 16:34:54 +08:00 committed by GitHub
parent 803eb33369
commit f06a749249
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 0 deletions

View file

@ -107,6 +107,7 @@ Babashka supports the following feature flags:
| `BABASHKA_FEATURE_TEST_CHECK` | Includes the [clojure.test.check](https://github.com/clojure/test.check) library | `true` | | `BABASHKA_FEATURE_TEST_CHECK` | Includes the [clojure.test.check](https://github.com/clojure/test.check) library | `true` |
| `BABASHKA_FEATURE_SPEC_ALPHA` | Includes the [clojure.spec.alpha](https://github.com/clojure/spec.alpha) library (WIP) | `false` | | `BABASHKA_FEATURE_SPEC_ALPHA` | Includes the [clojure.spec.alpha](https://github.com/clojure/spec.alpha) library (WIP) | `false` |
| `BABASHKA_FEATURE_JDBC` | Includes the [next.jdbc](https://github.com/seancorfield/next-jdbc) library | `false` | | `BABASHKA_FEATURE_JDBC` | Includes the [next.jdbc](https://github.com/seancorfield/next-jdbc) library | `false` |
| `BABASHKA_FEATURE_SQLITE` | Includes the [sqlite-jdbc](https://github.com/xerial/sqlite-jdbc) library | `false` |
| `BABASHKA_FEATURE_POSTGRESQL` | Includes the [PostgresSQL](https://jdbc.postgresql.org/) JDBC driver | `false` | | `BABASHKA_FEATURE_POSTGRESQL` | Includes the [PostgresSQL](https://jdbc.postgresql.org/) JDBC driver | `false` |
| `BABASHKA_FEATURE_HSQLDB` | Includes the [HSQLDB](http://www.hsqldb.org/) JDBC driver | `false` | | `BABASHKA_FEATURE_HSQLDB` | Includes the [HSQLDB](http://www.hsqldb.org/) JDBC driver | `false` |
| `BABASHKA_FEATURE_ORACLEDB` | Includes the [Oracle](https://www.oracle.com/database/technologies/appdev/jdbc.html) JDBC driver | `false` | | `BABASHKA_FEATURE_ORACLEDB` | Includes the [Oracle](https://www.oracle.com/database/technologies/appdev/jdbc.html) JDBC driver | `false` |

View file

@ -33,6 +33,7 @@
:dependencies [[clj-commons/clj-yaml "0.7.107"]]} :dependencies [[clj-commons/clj-yaml "0.7.107"]]}
:feature/jdbc {:source-paths ["feature-jdbc"] :feature/jdbc {:source-paths ["feature-jdbc"]
:dependencies [[seancorfield/next.jdbc "1.1.610"]]} :dependencies [[seancorfield/next.jdbc "1.1.610"]]}
:feature/sqlite [:feature/jdbc {:dependencies [[org.xerial/sqlite-jdbc "3.36.0.3"]]}]
:feature/postgresql [:feature/jdbc {:dependencies [[org.postgresql/postgresql "42.2.18"]]}] :feature/postgresql [:feature/jdbc {:dependencies [[org.postgresql/postgresql "42.2.18"]]}]
;:feature/oracledb [:feature/jdbc {:dependencies [[com.oracle.database.jdbc/ojdbc8 "19.8.0.0"]]}] ;:feature/oracledb [:feature/jdbc {:dependencies [[com.oracle.database.jdbc/ojdbc8 "19.8.0.0"]]}]
:feature/oracledb [:feature/jdbc {:dependencies [[io.helidon.integrations.db/ojdbc "2.1.0"]]}] ; ojdbc10 + GraalVM config, by Oracle :feature/oracledb [:feature/jdbc {:dependencies [[io.helidon.integrations.db/ojdbc "2.1.0"]]}] ; ojdbc10 + GraalVM config, by Oracle

View file

@ -35,6 +35,13 @@ else
BABASHKA_LEIN_PROFILES+=",-feature/jdbc" BABASHKA_LEIN_PROFILES+=",-feature/jdbc"
fi fi
if [ "$BABASHKA_FEATURE_SQLITE" = "true" ]
then
BABASHKA_LEIN_PROFILES+=",+feature/sqlite"
else
BABASHKA_LEIN_PROFILES+=",-feature/sqlite"
fi
if [ "$BABASHKA_FEATURE_POSTGRESQL" = "true" ] if [ "$BABASHKA_FEATURE_POSTGRESQL" = "true" ]
then then
BABASHKA_LEIN_PROFILES+=",+feature/postgresql" BABASHKA_LEIN_PROFILES+=",+feature/postgresql"

View file

@ -16,6 +16,12 @@ if "%BABASHKA_FEATURE_JDBC%"=="true" (
set BABASHKA_LEIN_PROFILES=%BABASHKA_LEIN_PROFILES%,-feature/jdbc set BABASHKA_LEIN_PROFILES=%BABASHKA_LEIN_PROFILES%,-feature/jdbc
) )
if "%BABASHKA_FEATURE_SQLITE%"=="true" (
set BABASHKA_LEIN_PROFILES=%BABASHKA_LEIN_PROFILES%,+feature/sqlite
) else (
set BABASHKA_LEIN_PROFILES=%BABASHKA_LEIN_PROFILES%,-feature/sqlite
)
if "%BABASHKA_FEATURE_POSTGRESQL%"=="true" ( if "%BABASHKA_FEATURE_POSTGRESQL%"=="true" (
set BABASHKA_LEIN_PROFILES=%BABASHKA_LEIN_PROFILES%,+feature/postgresql set BABASHKA_LEIN_PROFILES=%BABASHKA_LEIN_PROFILES%,+feature/postgresql
) else ( ) else (

View file

@ -19,6 +19,7 @@
;; excluded by default ;; excluded by default
(def jdbc? (= "true" (System/getenv "BABASHKA_FEATURE_JDBC"))) (def jdbc? (= "true" (System/getenv "BABASHKA_FEATURE_JDBC")))
(def sqlite? (= "true" (System/getenv "BABASHKA_FEATURE_SQLITE")))
(def postgresql? (= "true" (System/getenv "BABASHKA_FEATURE_POSTGRESQL"))) (def postgresql? (= "true" (System/getenv "BABASHKA_FEATURE_POSTGRESQL")))
(def oracledb? (= "true" (System/getenv "BABASHKA_FEATURE_ORACLEDB"))) (def oracledb? (= "true" (System/getenv "BABASHKA_FEATURE_ORACLEDB")))
(def hsqldb? (= "true" (System/getenv "BABASHKA_FEATURE_HSQLDB"))) (def hsqldb? (= "true" (System/getenv "BABASHKA_FEATURE_HSQLDB")))

View file

@ -253,6 +253,7 @@ Use bb run --help to show this help output.
features/xml? features/xml?
features/yaml? features/yaml?
features/jdbc? features/jdbc?
features/sqlite?
features/postgresql? features/postgresql?
features/hsqldb? features/hsqldb?
features/oracledb? features/oracledb?