-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WIP * Set up build for Java * Add ASTWalker.java! * Almost got SqlVisitor worked out * Add SqlVisitor and ASTWalker; use for query->columns * Cleanup * Build before testing on CI * Build before checking on CI * Put Java file in the right spot 😮 * Refactor to use a Clojure map + callbacks * Add some basic build scripts * Update docs * atom->transient * Make ASTWalker more robust/foolproof * Back to atoms
- Loading branch information
1 parent
00b0f0a
commit 4f8e0ec
Showing
9 changed files
with
1,427 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env bash | ||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
if [[ -n "${TRACE-}" ]]; then | ||
set -o xtrace | ||
fi | ||
|
||
if [ $# -ge 1 ] && [[ "$1" =~ ^-*h(elp)?$ ]]; then | ||
echo 'Usage: ./bin/build-jar | ||
Build a JAR | ||
' | ||
exit | ||
fi | ||
|
||
# Ensure we're in the project root | ||
cd "$(dirname "$0")"/.. | ||
|
||
main() { | ||
clj -T:build jar | ||
} | ||
|
||
main "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/usr/bin/env bash | ||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
if [[ -n "${TRACE-}" ]]; then | ||
set -o xtrace | ||
fi | ||
|
||
if [ $# -ge 1 ] && [[ "$1" =~ ^-*h(elp)?$ ]]; then | ||
echo 'Usage: ./bin/java-compile | ||
Compiles all the Java files used in the project so that they can be used in local Clojure development. To build a JAR, use ./build-jar instead. | ||
' | ||
exit | ||
fi | ||
|
||
# Ensure we're in the project root | ||
cd "$(dirname "$0")"/.. | ||
|
||
main() { | ||
clj -T:build compile | ||
} | ||
|
||
main "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
;; Further info: https://clojure.org/guides/tools_build#_mixed_java_clojure_build | ||
|
||
(ns build | ||
(:require | ||
[clojure.java.shell :as sh] | ||
[clojure.string :as str] | ||
[clojure.tools.build.api :as b])) | ||
|
||
(def lib 'metabase/macaw) | ||
|
||
(def major-minor-version "0.1") | ||
|
||
(defn commit-number [] | ||
(or (-> (sh/sh "git" "rev-list" "HEAD" "--count") | ||
:out | ||
str/trim | ||
parse-long) | ||
"9999-SNAPSHOT")) | ||
|
||
(def version (str major-minor-version \. (commit-number))) | ||
(def target "target") | ||
(def class-dir (format "%s/classes" target)) | ||
|
||
(def jar-file (format "target/%s-%s.jar" (name lib) version)) | ||
|
||
(def basis (delay (b/create-basis {:project "deps.edn"}))) | ||
|
||
(defn clean [_] | ||
(b/delete {:path target})) | ||
|
||
(defn compile [_] | ||
(b/javac {:src-dirs ["java"] | ||
:class-dir class-dir | ||
:basis @basis | ||
:javac-opts ["--release" "11"]})) | ||
|
||
(defn jar [_] | ||
(compile nil) | ||
(b/write-pom {:class-dir class-dir | ||
:lib lib | ||
:version version | ||
:basis @basis | ||
:src-dirs ["src"]}) | ||
(b/copy-dir {:src-dirs ["src" "resources"] | ||
:target-dir class-dir}) | ||
(b/jar {:class-dir class-dir | ||
:jar-file jar-file})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.