Add build system

This commit adds support for generating POM files and builds of matchbot
as JAR or uberjar (standalone JAR) files.

Resolves issue #3

Signed-off-by: Sebastian Crane <>
This commit is contained in:
Sebastian Crane 2022-04-09 21:25:07 +01:00
parent 69e154ea87
commit bfd321cdb3
3 changed files with 81 additions and 2 deletions

build.clj Normal file
View File

@ -0,0 +1,77 @@
;; SPDX-License-Identifier: Apache-2.0
;; SPDX-FileCopyrightText: 2022 Sebastian Crane <>
(ns build
(:require [ :as b]
[tools-pom.tasks :as pom]))
(def application 'org.libregaming/matchbot)
(def version "1.1.0-SNAPSHOT")
(def src-dirs ["src"])
(def target-dir "target")
(def class-dir (format "%s/%s" target-dir "classes"))
(def basis (b/create-basis {:project "deps.edn"}))
(def pom-file (format "%s/pom.xml" target-dir))
(def jar-file (format "%s/%s-%s.jar" target-dir (name application) version))
(def uber-file (format "%s/%s-%s-standalone.jar" target-dir (name application) version))
(defn clean [_]
(b/delete {:path target-dir}))
(defn uber [_]
(b/delete {:path class-dir})
(b/copy-dir {:src-dirs src-dirs
:target-dir class-dir})
(b/compile-clj {:basis basis
:src-dirs src-dirs
:class-dir class-dir})
(b/uber {:class-dir class-dir
:uber-file uber-file
:basis basis
:main 'system}))
(defn jar [_]
(b/delete {:path class-dir})
(b/copy-dir {:src-dirs src-dirs
:target-dir class-dir})
(b/jar {:class-dir class-dir
:jar-file jar-file}))
(defn pom [_]
{:lib application
:version version
:write-pom true
:validate-pom true
"A chatbot for announcing upcoming matches and finding fellow players, written for the LibreGaming community"
{:name "Apache-2.0"
:url ""}]
{:id "seabass"
:name "Sebastian Crane"
:email ""
:organization "LibreGaming"
:organization-url ""
:roles [:role "Maintainer"]
:timezone "Europe/London"}]
{:url ""
:connection "scm:git:"
:developer-connection "scm:git:ssh://"}
{:system "Gitea"
:url ""}}})
(b/copy-file {:src "pom.xml" :target pom-file})
(b/delete {:path "pom.xml"}))
(defn all [_]
(jar nil)
(uber nil)
(pom nil))

View File

@ -9,4 +9,5 @@
:extra-deps {lambdaisland/kaocha {:mvn/version "1.60.972"}}
:main-opts ["-m" "kaocha.runner"]}
:build {:deps {io.github.clojure/ {:git/tag "v0.8.1" :git/sha "7d40500"}
com.github.pmonks/tools-pom {:mvn/version "1.0.74"}}}}}
com.github.pmonks/tools-pom {:mvn/version "1.0.74"}}
:ns-default build}}}

View File

@ -5,7 +5,8 @@
(:require [irc]
[ :as json]
[clojure.set :as set]
[clj-yaml.core :as yaml]))
[clj-yaml.core :as yaml])
(defn setify-vals [x]
(reduce #(assoc %1