Skip to content

Commit

Permalink
Use clojure / deps.edn instead of lein / project.clj when building
Browse files Browse the repository at this point in the history
  • Loading branch information
mfikes committed Jan 24, 2018
1 parent 391eba8 commit 8031e8d
Show file tree
Hide file tree
Showing 16 changed files with 58 additions and 478 deletions.
4 changes: 4 additions & 0 deletions .travis.yml
Expand Up @@ -19,5 +19,9 @@ before_install:

install:
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then jdk_switcher use openjdk8; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install clojure; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then curl -O https://download.clojure.org/install/linux-install-1.9.0.315.sh; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then chmod +x linux-install-1.9.0.315.sh; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo ./linux-install-1.9.0.315.sh; fi

script: script/build && script/test
8 changes: 7 additions & 1 deletion BUILD-PPA.md
Expand Up @@ -5,10 +5,16 @@
On Ubuntu, clone and then make a sources archive that includes all necessary JARs.

0. `ssh` to Ubuntu build box.
0. `curl -O https://download.clojure.org/install/linux-install-1.9.0.315.sh`
0. `chmod +x linux-install-1.9.0.315.sh`
0. `sudo ./linux-install-1.9.0.315.sh`
0. `git clone https://github.com/mfikes/planck`
0. `cd planck`
0. `cp /usr/local/bin/clojure planck-cljs/script`
0. `cp /usr/local/lib/clojure/deps.edn planck-cljs/script`
0. `cp -r /usr/local/lib/clojure/libexec planck-cljs/script/libexec`
0. Edit `planck-cljs/script/clojure` and revise `install_dir` to be `script`
0. `FAST_BUILD=1 script/build-sandbox`
0. `cp ~/.lein/self-installs/leiningen-2.8.1-standalone.jar planck-cljs/sandbox-m2`
0. `BUILD_PPA=1 script/clean`
0. `cd ..`
0. `tar cvzf planck_2.<x>.<y>.orig.tar.gz planck`
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Expand Up @@ -3,6 +3,9 @@ All notable changes to this project will be documented in this file. This change

## [Unreleased]

### Changed
- Use `clojure` / `deps.edn` instead of `lein` / `project.clj` when building

## [2.11.0] - 2018-01-23
### Added
- Add `M-f`, `M-b`, and `M-d` support for REPL ([#569](https://github.com/mfikes/planck/issues/569))
Expand Down
16 changes: 4 additions & 12 deletions README.md
Expand Up @@ -46,24 +46,16 @@ $ script/build

The resulting binary will be `planck-c/build/planck`.

### Parameterized Builds

Set the optional `FAST_BUILD` environment variable to quickly build a development version that skips Closure optimization:

```
$ FAST_BUILD=1 script/build
```

To build against a specific (locally installed) ClojureScript version, specify `CLJS_VERSION`:
Specify `-fast` to quickly build a development version that skips Closure optimization:

```
$ CLJS_VERSION=1.9.908 script/build
$ script/build -fast
```

To locally build and use a specific ClojureScript commit, specify `CLJS_COMMIT`:
If you specify `-Sdeps`, it will be passed through to the underlying [`clojure`](https://clojure.org/guides/deps_and_cli) command during the build process. This can be used, for example, to specify a ClojureScript dep to use:

```
$ CLJS_COMMIT=d450122 script/build
$ script/build -Sdeps "{:deps {org.clojure/clojurescript {:mvn/version \"1.9.946\"}}}"
```

## Tests
Expand Down
6 changes: 2 additions & 4 deletions debian/rules
Expand Up @@ -7,7 +7,7 @@ build: build-indep
build-indep: build-arch

build-arch:
LEIN_HOME=lein_home LEIN_ROOT=1 script/build-sandbox
script/build-sandbox

binary: binary-indep

Expand All @@ -21,8 +21,6 @@ binary-arch:
dpkg --build debian/tmp ..

clean:
mkdir -p lein_home/self-installs
cp planck-cljs/sandbox-m2/leiningen-2.8.1-standalone.jar lein_home/self-installs
LEIN_HOME=lein_home LEIN_ROOT=1 BUILD_PPA=1 script/clean
BUILD_PPA=1 script/clean

.PHONY: binary binary-arch binary-indep clean
4 changes: 3 additions & 1 deletion debian/source/include-binaries
@@ -1 +1,3 @@
lein_home/self-installs/leiningen-2.8.1-standalone.jar
planck_cljs/script/clojure
planck-cljs/script/deps.edn
planck-cljs/script/libexec/clojure-tools-1.9.0.315.jar
7 changes: 7 additions & 0 deletions planck-cljs/deps.edn
@@ -0,0 +1,7 @@
{:deps {org.clojure/clojurescript {:mvn/version "1.9.946"}
org.clojure/test.check {:mvn/version "0.10.0-alpha2"}
com.cognitect/transit-clj {:mvn/version "0.8.300"}
com.cognitect/transit-cljs {:mvn/version "0.8.243"}
fipp {:mvn/version "0.6.8"}
malabarba/lazy-map {:mvn/version "1.3"}
cljsjs/parinfer {:mvn/version "1.8.1-0"}}}
20 changes: 0 additions & 20 deletions planck-cljs/project.clj

This file was deleted.

45 changes: 6 additions & 39 deletions planck-cljs/script/build
Expand Up @@ -4,50 +4,17 @@ if [ ! -f jscomp.js ]; then
curl -s -O http://planck-repl.org/releases/closure-${CLOSURE_JS_RELEASE}/jscomp.js
fi

# Set the CLJS_COMMIT env var to build our own copy
# of ClojureScript compiler. This can be HEAD, a commit hash, etc.
# When setting, first do script/clean-all first from top-level.
CLJS_COMMIT="${CLJS_COMMIT:-}"

# Make sure we fail and exit on the command that actually failed.
set -e
set -o pipefail

# Handle case where LEIN_HOME has been set
if [ -n "$LEIN_HOME" ]; then
export LEIN_HOME=../lein_home
fi

# Initialize lein if it hasn't yet been
script/lein -v > /dev/null 2>&1

# Turn off tiered compilation (otherwise unavailability warning will break classpath)
export LEIN_JVM_OPTS=
mkdir -p out/cljs/analyzer
mkdir -p out/cljs/core/specs

# Suppress lein output regarding retrieving JARS
export LEIN_SILENT=true
export PATH=script:$PATH

if [ -n "$CLJS_COMMIT" ]; then
if [ -e clojurescript ]; then
rm -rf clojurescript
fi
git clone https://github.com/clojure/clojurescript --quiet
cd clojurescript
git reset --hard $CLJS_COMMIT
# Apply patches
# curl -L http://dev.clojure.org/jira/secure/attachment/16577/CLJS-1997.patch | git apply
# Deal with the case when building in sandbox mode
if [ -e ../profiles.clj ]; then
export MAVEN_OPTS="-Dmaven.repo.local=../sandbox-m2"
echo "{:dev {:local-repo \"../sandbox-m2\"}}" > profiles.clj
fi
export CLJS_VERSION=`script/build 2> /dev/null | grep 'Building ClojureScript' | tail -1 | cut -c 31-`
echo Using locally built ClojureScript $CLJS_VERSION
cd ..
if [ -n "${CANARY_CLOJURESCRIPT_VERSION+set}" ]; then
DEPS="{:deps {org.clojure/clojurescript {:mvn/version \"$CANARY_CLOJURESCRIPT_VERSION\"}}}"
fi

CLJSC_CP=`script/lein with-profile build-release classpath`

mkdir -p out/cljs/analyzer
mkdir -p out/cljs/core/specs
java -cp $CLJSC_CP clojure.main script/build.clj
clojure -Sdeps "${DEPS:-{}}" script/build.clj
8 changes: 2 additions & 6 deletions planck-cljs/script/clean
@@ -1,14 +1,10 @@
#!/usr/bin/env bash

# Handle case where LEIN_HOME has been set
if [ -n "$LEIN_HOME" ]; then
export LEIN_HOME=../lein_home
fi

script/lein clean
if [ -z "$BUILD_PPA" ]; then
rm -f jscomp.js
fi
rm -rf out
rm -rf target
rm -rf resources
rm -rf tools.reader
rm -rf clojurescript
Expand Down

0 comments on commit 8031e8d

Please sign in to comment.