Skip to content

babashka/tools.bbuild

 
 

Repository files navigation

tools.bbuild

Babashka maintained fork of tools.build

WARNING: this work is experimental and should be used with caution!

This fork of tools.build works with babashka. To make it compatible, the following changes were introduced:

  • The clojure.tools.deps library is replaced with tools-deps-native which is used as a pod.

  • compile-clj uses clojure.core/munge instead of clojure.lang.Compiler/munge

  • install uses a helper from tools-deps-native to construct maven objects.

  • javac shells out to javac rather than using javax.tools.JavaCompiler

Usage

Ensure you have babashka 1.0.169 or later.

In your bb.edn add :paths ["."] to add build.clj to your babashka classpath. Also add this library to bb.edn:

io.github.babashka/tools.bbuild {:git/sha "<sha>"}

Create a build.clj:

(ns build
  (:require [clojure.tools.build.api :as b]))

(def version "0.1.0")
(def class-dir "target/classes")

(defn basis [_]
  (b/create-basis {:project "deps.edn"}))

(defn clean [_]
  (b/delete {:path "target"}))

(defn write-pom [{:keys [basis]}]
  (b/write-pom
   {:basis     basis
    :src-dirs  ["src"]
    :class-dir class-dir
    :lib 'my/example
    :version version}))

(defn jar [{:keys [basis]}]
  (b/copy-dir {:src-dirs ["src"]
               :target-dir class-dir})
  (b/jar
   {:basis     basis
    :src-dirs  ["src"]
    :class-dir class-dir
    :main      "example.core"
    :jar-file  (format "target/example-%s.jar" version)}))

Then run e.g. bb -x build/jar to produce a jar file.

Tests

To run tests, run bb test. This assumes that the tools-deps-native pod is on your PATH.

Here follows the original README.


A library for building artifacts in Clojure projects.

Docs

Release Information

Latest release:

deps.edn dependency information:

As a git dep:

io.github.clojure/tools.build {:git/tag "v0.9.6" :git/sha "8e78bcc"}

As a Maven dep:

io.github.clojure/tools.build {:mvn/version "0.9.6"}

Developer Information

Tests

Copyright and License

Copyright © 2023 Rich Hickey, Alex Miller, and contributors

All rights reserved. The use and distribution terms for this software are covered by the Eclipse Public License 1.0 which can be found in the file epl-v10.html at the root of this distribution. By using this software in any fashion, you are agreeing to be bound by the terms of this license. You must not remove this notice, or any other, from this software.

About

Library of functions for building Clojure projects

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Clojure 90.6%
  • HTML 9.2%
  • Java 0.2%