From c57c2dcd2484fec4bec3d97463ae5457ad6cb853 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Sat, 28 Feb 2015 15:41:33 -0600 Subject: update erlydtl and switch to rebar3 --- .gitignore | 1 + .travis.yml | 10 +--- Makefile | 149 ---------------------------------------------------------- README.md | 12 ++--- bootstrap.cmd | 4 +- rebar.config | 38 ++++++++------- rebar.lock | 28 +++++++++++ rebar3 | Bin 0 -> 1297520 bytes 8 files changed, 57 insertions(+), 185 deletions(-) delete mode 100644 Makefile create mode 100644 rebar.lock create mode 100755 rebar3 diff --git a/.gitignore b/.gitignore index a6e5c52..f04f7d2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +_build deps/* ebin/* *.beam diff --git a/.travis.yml b/.travis.yml index 52861e5..84eddbc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,9 @@ language: erlang otp_release: - - 17.1 - 17.0 - R16B03-1 - - R16B03 - - R16B02 - - R16B01 - - R16B - R15B03 - - R15B02 - - R15B01 - - R15B -script: "make get-rebar && make rebuild" +script: "./rebar3 ct" branches: only: - master diff --git a/Makefile b/Makefile deleted file mode 100644 index 43f0d7e..0000000 --- a/Makefile +++ /dev/null @@ -1,149 +0,0 @@ -# Copyright 2012 Erlware, LLC. All Rights Reserved. -# -# This file is provided to you under the Apache License, -# Version 2.0 (the "License"); you may not use this file -# except in compliance with the License. You may obtain -# a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, -# software distributed under the License is distributed on an -# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -# KIND, either express or implied. See the License for the -# specific language governing permissions and limitations -# under the License. -# - - -ERLFLAGS= -pa $(CURDIR)/.eunit -pa $(CURDIR)/ebin -pa $(CURDIR)/deps/*/ebin - -DEPS_PLT=$(CURDIR)/.deps_plt - -# ============================================================================= -# Verify that the programs we need to run are installed on this system -# ============================================================================= -ERL = $(shell which erl) - -ifeq ($(ERL),) -$(error "Erlang not available on this system") -endif - -REBAR=$(shell which rebar) - -# If building on travis, use the rebar in the current directory -ifeq ($(TRAVIS),true) -REBAR=$(CURDIR)/rebar -endif - -ifeq ($(REBAR),) -REBAR=$(CURDIR)/rebar -endif - -# ============================================================================= -# Handle version discovery -# ============================================================================= - -# We have a problem that we only have 10 minutes to build on travis -# and those travis boxes are quite small. This is ok for the fast -# dialyzer on R15 and above. However on R14 and below we have the -# problem that travis times out. The code below lets us not run -# dialyzer on R14 -OTP_VSN=$(shell erl -noshell -eval 'io:format("~p", [erlang:system_info(otp_release)]), erlang:halt(0).' | perl -lne 'print for /R{0,1}(\d+).*/g') -TRAVIS_SLOW=$(shell expr $(OTP_VSN) \<= 15 ) - -ifeq ($(TRAVIS_SLOW), 0) -DIALYZER=$(shell which dialyzer) -else -DIALYZER=: not running dialyzer on R14 or R15 -endif - -.PHONY: all compile doc clean test dialyzer typer shell distclean pdf \ - update-deps escript clean-common-test-data rebuild - -all: deps compile escript - -# ============================================================================= -# Rules to build the system -# ============================================================================= - -REBAR_URL=https://github.com/rebar/rebar/wiki/rebar -$(REBAR): - curl -Lo rebar $(REBAR_URL) || wget $(REBAR_URL) - chmod a+x rebar - -get-rebar: $(REBAR) - -deps: $(REBAR) - $(REBAR) get-deps - $(REBAR) compile - -update-deps: $(REBAR) - $(REBAR) update-deps - $(REBAR) compile - -compile: $(REBAR) - $(REBAR) skip_deps=true compile - -escript: deps - $(REBAR) skip_deps=true escriptize - -doc: - $(REBAR) skip_deps=true doc - -eunit: compile clean-common-test-data - $(REBAR) skip_deps=true eunit - -ct: compile clean-common-test-data - mkdir -p $(CURDIR) logs - ct_run -pa $(CURDIR)/ebin \ - -pa $(CURDIR)/deps/*/ebin \ - -logdir $(CURDIR)/logs \ - -dir $(CURDIR)/test/ \ - -cover cover.spec \ - -suite rlx_command_SUITE rlx_discover_SUITE -suite rlx_release_SUITE \ - -suite rlx_archive_SUITE - -test: compile dialyzer eunit ct - -$(DEPS_PLT): compile - @echo Building local erts plt at $(DEPS_PLT) - @echo - $(DIALYZER) --output_plt $(DEPS_PLT) --build_plt \ - --apps erts kernel stdlib -r deps - -dialyzer: compile $(DEPS_PLT) - $(DIALYZER) --fullpath --plt $(DEPS_PLT) \ - -I include -Wrace_conditions -r ./ebin - -typer: - typer --plt $(DEPS_PLT) -r ./src - -shell: deps compile -# You often want *rebuilt* rebar tests to be available to the -# shell you have to call eunit (to get the tests -# rebuilt). However, eunit runs the tests, which probably -# fails (thats probably why You want them in the shell). This -# runs eunit but tells make to ignore the result. - - @$(REBAR) skip_deps=true eunit - @$(ERL) $(ERLFLAGS) - -pdf: - pandoc README.md -o README.pdf - -clean-common-test-data: -# We have to do this because of the unique way we generate test -# data. Without this rebar eunit gets very confused - - rm -rf $(CURDIR)/test/*_SUITE_data - -clean: clean-common-test-data $(REBAR) - - rm -rf $(CURDIR)/test/*.beam - - rm -rf $(CURDIR)/logs - - rm -rf $(CURDIR)/ebin - $(REBAR) skip_deps=true clean - -distclean: clean - - rm -rf $(DEPS_PLT) - - rm -rvf $(CURDIR)/deps - -rebuild: distclean deps compile escript dialyzer test diff --git a/README.md b/README.md index 672290f..a73fc29 100644 --- a/README.md +++ b/README.md @@ -27,19 +27,15 @@ Building To build relx and generate a standalone escript executable: - $ make + $ ./rebar3 escriptize -This creates the executable `relx`. - -Note, if using your own `rebar`, it must at least be > version -2.2.0-20-g6e24cd6. Unfortunately, the 2.2.0 release of rebar is not -sufficient. +This creates the executable `_build/default/relx`. Building on Windows ------------------- -To build relx on Windows you'll need to have rebar installed and the path to -the rebar binary added to the `PATH` environment variable. To start the build +To build relx on Windows you'll need to have rebar3 installed and the path to +the rebar3 binary added to the `PATH` environment variable. To start the build use the `bootstrap` batch file: c:\> bootstrap diff --git a/bootstrap.cmd b/bootstrap.cmd index cff8483..487157d 100644 --- a/bootstrap.cmd +++ b/bootstrap.cmd @@ -1,8 +1,8 @@ :: A script to build relx on Windows -:: Requires rebar +:: Requires rebar3 :: Get dependencies, compile and escriptize relx -@cmd /c @rebar -r get-deps compile escriptize +@cmd /c @rebar3 escriptize :: Create a shortcut file for running the relx command @set relx_cmd=relx.cmd diff --git a/rebar.config b/rebar.config index b67d1f8..8f27793 100644 --- a/rebar.config +++ b/rebar.config @@ -1,26 +1,21 @@ %% -*- mode: Erlang; fill-column: 80; comment-column: 75; -*- %% Dependencies ================================================================ -{deps, [{rebar_vsn_plugin, ".*", - {git, "https://github.com/erlware/rebar_vsn_plugin.git", - {branch, "master"}}}, - {neotoma, ".*", - {git, "https://github.com/seancribbs/neotoma.git", {branch, "master"}}}, - {erlware_commons, ".*", +{deps, [{erlware_commons, ".*", {git, "https://github.com/erlware/erlware_commons.git", {branch, "master"}}}, {providers, ".*", {git, "https://github.com/tsloughter/providers.git", - {tag, "v1.0.0"}}}, + {tag, "v1.3.0"}}}, {erlydtl, ".*", {git, "https://github.com/erlydtl/erlydtl.git", - {tag, "0.9.0"}}}, + {branch, "master"}}}, {getopt, "", {git, "https://github.com/jcomellas/getopt.git", {branch, "master"}}}]}. -%% Rebar Plugins ============================================================== -{plugin_dir, "deps/rebar_vsn_plugin/src"}. -{plugins, [rebar_vsn_plugin]}. +{escript_emu_args, "%%! +sbtu +A0 -noinput\n"}. +{escript_incl_apps, + [getopt, erlware_commons, merl, erlydtl, providers, relx]}. %% Compiler Options ============================================================ {erl_opts, @@ -32,13 +27,22 @@ %% EUnit ======================================================================= {eunit_opts, [{report, {eunit_surefire, [{dir, "."}]}}]}. -{cover_enabled, true}. -{cover_print_enabled, true}. -%% Misc ======================================================================= +%% Erlydtl ===================================================================== {erlydtl_opts, [{doc_root, "priv/templates"}, + force_recompile, {compiler_options, [report, return, debug_info]}]}. -{escript_incl_apps, - [getopt, erlware_commons, erlydtl, providers]}. -{escript_emu_args, "%%! +sbtu +A0 -noinput\n"}. +{provider_hooks, [{post, [{compile, {erlydtl, compile}}]}]}. + +%% Profiles ==================================================================== + +{profiles, [{dev, [{deps, [{neotoma, ".*", + {git, "https://github.com/seancribbs/neotoma.git", {branch, "master"}}} + ]} + ] + }]}. + +{ct_opts, [{cover_spec, "cover.spec"}, + {cover_enabled, true}, + {cover_print_enabled, true}]}. diff --git a/rebar.lock b/rebar.lock new file mode 100644 index 0000000..ac9daf6 --- /dev/null +++ b/rebar.lock @@ -0,0 +1,28 @@ +[{<<"rebar_vsn_plugin">>, + {git,"https://github.com/erlware/rebar_vsn_plugin.git", + {ref,"fd40c960c7912193631d948fe962e1162a8d1334"}}, + 1}, + {<<"merl">>, + {git,"git://github.com/erlydtl/merl.git", + {ref,"750b09d44425f435ff579a4d28bf5844bb5b4ef1"}}, + 1}, + {<<"eunit_formatters">>, + {git,"git://github.com/seancribbs/eunit_formatters", + {ref,"2c73eb6e46b0863f19507857b386a48a53aaf141"}}, + 1}, + {<<"providers">>, + {git,"https://github.com/tsloughter/providers.git", + {ref,"f06c616dd680f787fd344c5e84d1b28b5dc6568c"}}, + 0}, + {<<"getopt">>, + {git,"https://github.com/jcomellas/getopt.git", + {ref,"626698975e63866156159661d100785d65eab6f9"}}, + 0}, + {<<"erlydtl">>, + {git,"https://github.com/erlydtl/erlydtl.git", + {ref,"a4ac28680d6e066aabf86b3be9f073352a1a4d40"}}, + 0}, + {<<"erlware_commons">>, + {git,"https://github.com/erlware/erlware_commons.git", + {ref,"05b956da26788f30b3cb793fa6ace02b75f481d0"}}, + 0}]. diff --git a/rebar3 b/rebar3 new file mode 100755 index 0000000..28db770 Binary files /dev/null and b/rebar3 differ -- cgit v1.2.3