From 23b1ea816ed84c89c8854756b78679effc372211 Mon Sep 17 00:00:00 2001 From: Hyunwoo Nam Date: Mon, 12 Feb 2024 23:17:38 +0900 Subject: [PATCH] add lacinia-parser local deps which must be prepared before use --- build.clj | 8 ------ deps.edn | 4 +-- gen/build.clj | 26 +++++++++++++++++++ gen/deps.edn | 9 +++++++ .../src}/com/walmartlabs/lacinia/Graphql.g4 | 0 .../com/walmartlabs/lacinia/GraphqlSchema.g4 | 0 6 files changed, 37 insertions(+), 10 deletions(-) create mode 100644 gen/build.clj create mode 100644 gen/deps.edn rename {resources => gen/src}/com/walmartlabs/lacinia/Graphql.g4 (100%) rename {resources => gen/src}/com/walmartlabs/lacinia/GraphqlSchema.g4 (100%) diff --git a/build.clj b/build.clj index 33c7b083..fcfa1978 100644 --- a/build.clj +++ b/build.clj @@ -60,11 +60,3 @@ (println "Pushing changes ...") (build/process {:dir publish-dir :command-args ["git" "push"]})) - -(def basis (delay (build/create-basis {:project "deps.edn"}))) - -(defn compile-java [& _] - (build/delete {:path "target/classes"}) - (build/javac {:src-dirs ["gen"] - :class-dir "gen/classes" - :basis @basis})) \ No newline at end of file diff --git a/deps.edn b/deps.edn index 8e5daabc..6b789573 100644 --- a/deps.edn +++ b/deps.edn @@ -1,8 +1,8 @@ {:deps {org.clojure/clojure {:mvn/version "1.11.1"} - org.antlr/antlr4-runtime {:mvn/version "4.13.1"} + com.walmartlabs/lacinia-parser {:local/root "./gen"} org.flatland/ordered {:mvn/version "1.15.10"} org.clojure/data.json {:mvn/version "2.4.0"}} - :paths ["src" "resources" "gen/src" "gen/classes"] + :paths ["src" "resources" "gen/target"] :aliases {:dev {:extra-deps {criterium/criterium {:mvn/version "0.4.6"} diff --git a/gen/build.clj b/gen/build.clj new file mode 100644 index 00000000..c5f77b17 --- /dev/null +++ b/gen/build.clj @@ -0,0 +1,26 @@ +; Copyright (c) 2021-present Walmart, Inc. +; +; Licensed under the Apache License, Version 2.0 (the "License") +; you may not use this file except in compliance with the License. +; You may obtain a copy of the License at +; +; http://www.apache.org/licenses/LICENSE-2.0 +; +; Unless required by applicable law or agreed to in writing, software +; distributed under the License is distributed on an "AS IS" BASIS, +; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +; See the License for the specific language governing permissions and +; limitations under the License. + +;; clj -T:build + +(ns build + (:require [clojure.tools.build.api :as build])) + +(def basis (delay (build/create-basis {:project "deps.edn"}))) + +(defn compile-java [& _] + (build/delete {:path "target/classes"}) + (build/javac {:src-dirs ["src"] + :class-dir "target/classes" + :basis @basis})) \ No newline at end of file diff --git a/gen/deps.edn b/gen/deps.edn new file mode 100644 index 00000000..d4ec472f --- /dev/null +++ b/gen/deps.edn @@ -0,0 +1,9 @@ +{:deps {org.antlr/antlr4-runtime {:mvn/version "4.13.1"}} + :paths ["src" "target/classes"] + :deps/prep-lib {:ensure "target/classes" + :alias :build + :fn compile-java} + :aliases + {:build {:deps {io.github.hlship/build-tools + {:git/tag "0.10.1" :git/sha "7ecff5"}} + :ns-default build}}} \ No newline at end of file diff --git a/resources/com/walmartlabs/lacinia/Graphql.g4 b/gen/src/com/walmartlabs/lacinia/Graphql.g4 similarity index 100% rename from resources/com/walmartlabs/lacinia/Graphql.g4 rename to gen/src/com/walmartlabs/lacinia/Graphql.g4 diff --git a/resources/com/walmartlabs/lacinia/GraphqlSchema.g4 b/gen/src/com/walmartlabs/lacinia/GraphqlSchema.g4 similarity index 100% rename from resources/com/walmartlabs/lacinia/GraphqlSchema.g4 rename to gen/src/com/walmartlabs/lacinia/GraphqlSchema.g4