Giter Club home page Giter Club logo

boot-as-library's Introduction

Boot as a library?

Some recent discussions with @thheller and others prompted me to investigate if Boot could be used as a library with a separate tool to construct the initial classpath, say clj.

In my hypothetical thinking one should be able to do something like this:

(ns boot.deploy
  (:require [boot.core :as b]
            [boot.tasks.built-in :as tasks]))

(defn -main []
  (boot (pom ,,,) 
        (jar)
        (push ,,,)))

And the run it using clj (provided one has boot dependencies in their deps.edn):

clj -m boot.deploy

Known Problems

The above is all a bit further out but one thing I've tried already is this:

java -cp "$(clj -Spath)" boot.App repl

It gives you a REPL that can run basic Clojure stuff, e.g.

  • (def a 1)
  • (+ a 2)
  • (boot (with-pass-thru _ (println "test")))
  • (require 'boot.pod)
  • (count boot.pod/pods) (yields '2' after repl start)

but fails with the slightly more complex (pod-using?) things I've tried:

  • creating pods: (boot.pod/make-pod {:dependencies [['bidi "2.1.3"]]})
  • running tasks: (boot (pom :project 'a/b :version "1.2.3") (target))

Most of these fail with some "Pop without matching push" exceptions (see below).

I assume those can somehow be traced back to the fact that there's โ€” in contrast to when boot is used โ€” no Boot.class or boot.ParentClassLoader.class on the classpath.

clojure.lang.ExceptionInfo: Pop without matching push {:line 13}
        at clojure.core$ex_info.invokeStatic(core.clj:4739)
        at clojure.core$ex_info.invoke(core.clj:4739)
        at boot.main$_main$fn__1201.invoke(main.clj:222)
        at boot.main$_main.invoke(main.clj:216)
        at clojure.lang.Var.invoke(Var.java:396)
        at org.projectodd.shimdandy.impl.ClojureRuntimeShimImpl.invoke(ClojureRuntimeShimImpl.java:159)
        at org.projectodd.shimdandy.impl.ClojureRuntimeShimImpl.invoke(ClojureRuntimeShimImpl.java:150)
        at boot.App.runBoot(App.java:399)
        at boot.App.main(App.java:491)
Caused by: java.lang.IllegalStateException: Pop without matching push
        at clojure.lang.Var.popThreadBindings(Var.java:333)
        at clojure.core$pop_thread_bindings.invokeStatic(core.clj:1923)
        at clojure.core$pop_thread_bindings.invoke(core.clj:1923)
        at boot.core$run_tasks.invoke(core.clj:1019)
        at boot.core$boot$fn__933.invoke(core.clj:1031)
        at clojure.core$binding_conveyor_fn$fn__5476.invoke(core.clj:2022)
        at clojure.lang.AFn.call(AFn.java:18)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)
Boot failed to start:
java.lang.IllegalStateException: Pop without matching push
        at clojure.lang.Var.popThreadBindings(Var.java:333)
        at clojure.core$pop_thread_bindings.invokeStatic(core.clj:1923)
        at clojure.core$pop_thread_bindings.invoke(core.clj:1923)
        at boot.main$_main.invoke(main.clj:174)
        at clojure.lang.Var.invoke(Var.java:396)
        at org.projectodd.shimdandy.impl.ClojureRuntimeShimImpl.invoke(ClojureRuntimeShimImpl.java:159)
        at org.projectodd.shimdandy.impl.ClojureRuntimeShimImpl.invoke(ClojureRuntimeShimImpl.java:150)
        at boot.App.runBoot(App.java:399)
        at boot.App.main(App.java:491)

boot-as-library's People

Contributors

martinklepsch avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.