Skip to content

Commit

Permalink
Self-downloading binaries, properties files
Browse files Browse the repository at this point in the history
Fixes #229
Fixes #300

Properties Files
================

- Boot now supports specifying any env var (eg. BOOT_VERSION) from
  properties files.

- Setting BOOT_VERSION and BOOT_CLOJURE_VERSION is no longer required.

- System properties are now supported in addition to properties files
  and environment variables.

- Settings will be merged in the following order:

  1. BOOT_HOME/cache/boot.properties (deprecated)
  2. BOOT_HOME/boot.properties
  3. <git project dir>/boot.properties
  4. CWD/boot.properties
  5. environment variables
  6. system properties

  For example:

  CWD/boot.properties settings override BOOT_HOME/boot.properties,
  environment variables override all properties files, and system
  properties override everything else.

Self-Downloading Binaries
=========================

- Boot is now comprised of three pieces: the loader, application, and
  library.

  - The library is a set of Clojure dependencies in which all of the
    Boot namespaces are distributed.
  - The application is a Java uberjar that handles bootstrapping the
    infrastructure for creating pods and running Clojure programs.
  - The loader is new--it's a Java program with no dependencies that
    handles downloading the application as needed. It is what the user
    will call from the command line.

- From this release onwards:

  - We will publish an app binary for each new boot lib version.
  - An exception is thrown if app and library versions don't match.
  - App name will be "boot.jar", cross-platform.
  - Loader will be "boot.sh" and "boot.exe", built in the same way as
    the previous versions of the app were (i.e. executable jar shell
    script for Unix, Launch4J executable for Windows).

- Previous releases are also supported by the new loader--the loader
  will ensure that a compatible version of the app will be used with
  the specified legacy version of the boot lib.

The Loader
==========

- A self-contained Java program with no dependencies, packaged in
  executable JAR format:

  - Unix: JAR with bash shell script prelude (boot.sh)
  - Windows: Launch4J produced executable (boot.exe)

- Caches app uberjar in BOOT_HOME/cache/bin/BOOT_VERSION/boot.jar.

- In pseudo code this is what it does:

      (def app-jar-file
        (if BOOT_VERSION
          (or (cached BOOT_VERSION) (download-and-cache BOOT_VERSION))
          (or (latest-cached) (download-and-cache "2.3.0"))))

      (defn -main [& argv]
        (doto (new-classloader app-jar-file)
              (apply-method "boot.App" "main" argv)))

- There is a mapping from lib version -> app version for previous
  releases in the "boot/tag-release.properties" resource. This is used
  to download the correct version of the app for previous versions of
  the boot lib (when there wasn't an app release for every lib version).
  • Loading branch information
micha committed Oct 26, 2015
1 parent dbadf7d commit c0f92fe
Show file tree
Hide file tree
Showing 11 changed files with 499 additions and 178 deletions.
23 changes: 17 additions & 6 deletions Makefile
Expand Up @@ -2,7 +2,7 @@

SHELL := /bin/bash
export PATH := bin:l4j:$(PATH)
export LEIN_SNAPSHOTS_IN_RELEASE := yes
export LEIN_SNAPSHOTS_IN_RELEASE := yes

green = '\e[0;32m'
nc = '\e[0m'
Expand All @@ -11,7 +11,9 @@ version = $(shell grep ^version version.properties |sed 's/.*=//')
verfile = version.properties
bootbin = $(PWD)/bin/boot.sh
bootexe = $(PWD)/bin/boot.exe
bootjarurl = https://github.com/boot-clj/boot/releases/download/p1/boot
distjar = $(PWD)/bin/boot.jar
loaderjar = boot/loader/target/loader.jar
loadersource = boot/loader/src/boot/Loader.java
bootjar = boot/boot/target/boot-$(version).jar
podjar = boot/pod/target/pod-$(version).jar
aetherjar = boot/aether/target/aether-$(version).jar
Expand All @@ -32,6 +34,7 @@ clean:
(cd boot/aether && lein clean)
(cd boot/pod && lein clean)
(cd boot/worker && lein clean)
(cd boot/loader && make clean)

bloop:
which lein
Expand All @@ -43,6 +46,9 @@ bin/lein:

deps: bin/lein

$(loaderjar): $(loadersource)
(cd boot/loader && make)

$(bootjar): $(verfile) boot/boot/project.clj
(cd boot/boot && lein install)

Expand All @@ -69,23 +75,28 @@ $(corejar): $(verfile) boot/core/project.clj $(shell find boot/core/src)
$(baseuber): boot/base/pom.xml $(shell find boot/base/src/main)
(cd boot/base && mvn -q assembly:assembly -DdescriptorId=jar-with-dependencies)

$(bootbin): head.sh $(baseuber)
$(bootbin): head.sh $(loaderjar)
mkdir -p bin
cat head.sh $(baseuber) > $(bootbin)
chmod 0755 $(bootbin)
cat $^ > $@
chmod 755 $@
@echo -e "\033[0;32m<< Created boot executable: $(bootbin) >>\033[0m"

launch4j-config.xml: launch4j-config.in.xml $(verfile)
sed -e "s@__VERSION__@`cat $(verfile) |sed 's/.*=//'`@" launch4j-config.in.xml > launch4j-config.xml;

$(bootexe): $(baseuber) launch4j-config.xml
$(bootexe): $(loaderjar) launch4j-config.xml
@if [ -z $$RUNNING_IN_CI ] && which launch4j; then \
launch4j launch4j-config.xml; \
echo -e "\033[0;32m<< Created boot executable: $(bootexe) >>\033[0m"; \
[ -e $(bootexe) ] && touch $(bootexe); \
else true; fi

.installed: $(basejar) $(alljars) $(bootbin) $(bootexe)
cp $(baseuber) $(distjar)
# FIXME: this is just for testing -- remove before release
mkdir -p $$HOME/.boot/cache/bin/$(version)
cp $(baseuber) $$HOME/.boot/cache/bin/$(version)/boot.jar
# End testing code -- cut above.
date > .installed

install: .installed
Expand Down

0 comments on commit c0f92fe

Please sign in to comment.