Permalink
Browse files

Switch from make to rebar

  • Loading branch information...
1 parent 22cd3eb commit 690aad43ac77829f9cf07927cd6a8ce7edcb6be3 @manopapad committed Dec 3, 2010
View
132 Makefile
@@ -1,135 +1,31 @@
-APP_SRC_DIR=src
-APP_BIN_DIR=ebin
-HDR_DIR=include
-DOC_DIR=doc
-DOC_PATTERN=*.html stylesheet.css erlang.png edoc-info
-TST_SRC_DIR=tests
-TST_BIN_DIR=tests
-EXM_DIR=examples
-UTIL_SRC_DIR=util
-UTIL_BIN_DIR=util
-TMP_PATTERN=*~ \\\#*\\\# *.dump
-COMMA=,
-EMPTY=
-SPACE= $(EMPTY) $(EMPTY)
-
-TXT_FILES=COPYING README
-DOC_SRC_FILES=$(DOC_DIR)/overview.edoc
-MAKE_FILES=Makefile vsn.mk $(APP_SRC_DIR)/proper.app.src
-PACKAGE_FILE=proper.tar.gz
-REGISTERED_PROCS=
-NEEDED_APPS=compiler erts kernel stdlib crypto
-
-include vsn.mk
-PROPER_REGISTERED=$(subst $(SPACE),$(COMMA),$(REGISTERED_PROCS))
-PROPER_NEEDED_APPS=$(subst $(SPACE),$(COMMA),$(NEEDED_APPS))
-
-APP_SRC_FILES=$(wildcard $(APP_SRC_DIR)/*.erl)
-APP_MODULES=$(APP_SRC_FILES:$(APP_SRC_DIR)/%.erl=%)
-PROPER_MODULES=$(subst $(SPACE),$(COMMA),$(APP_MODULES))
-APP_BIN_FILES=$(APP_MODULES:%=$(APP_BIN_DIR)/%.beam) $(APP_BIN_DIR)/proper.app
-HDR_FILES=$(wildcard $(HDR_DIR)/*.hrl)
-DOC_FILES=$(addprefix $(DOC_DIR)/, $(DOC_PATTERN))
-TST_SRC_FILES=$(wildcard $(TST_SRC_DIR)/*.erl)
-TST_MODULES=$(TST_SRC_FILES:$(TST_SRC_DIR)/%.erl=%)
-TST_BIN_FILES=$(TST_MODULES:%=$(TST_BIN_DIR)/%.beam)
-EXM_FILES=$(wildcard $(EXM_DIR)/*.erl)
-UTIL_SRC_FILES=$(wildcard $(UTIL_SRC_DIR)/*.erl)
-UTIL_MODULES=$(UTIL_SRC_FILES:$(UTIL_SRC_DIR)/%.erl=%)
-UTIL_BIN_FILES=$(UTIL_MODULES:%=$(UTIL_BIN_DIR)/%.beam)
-TMP_FILES=$(TMP_PATTERN) $(addprefix $(APP_SRC_DIR)/, $(TMP_PATTERN)) $(addprefix $(HDR_DIR)/, $(TMP_PATTERN)) $(addprefix $(DOC_DIR)/, $(TMP_PATTERN)) $(addprefix $(TST_SRC_DIR)/, $(TMP_PATTERN)) $(addprefix $(EXM_DIR)/, $(TMP_PATTERN)) $(addprefix $(UTIL_SRC_DIR)/, $(TMP_PATTERN))
-BUILD_FILES=$(APP_BIN_FILES) $(DOC_FILES) $(TST_BIN_FILES) $(UTIL_BIN_FILES) $(PACKAGE_FILE)
-
-ENTER_ERL=erl -noinput -pa $(APP_BIN_DIR) $(TST_BIN_DIR) -eval '
-EXIT_ERL=' -run init stop
-ERLC=erlc
-ERLC_FLAGS=+debug_info -I $(HDR_DIR)
-ifdef NOTYPES
-APP_ERLC_FLAGS=-W2 -pa $(UTIL_BIN_DIR) '+{parse_transform,strip_types}' -o $(APP_BIN_DIR)
-else
-APP_ERLC_FLAGS=-W2 +warn_missing_spec +warn_untyped_record -o $(APP_BIN_DIR)
-endif
-TST_ERLC_FLAGS=-W0 -pa $(TST_BIN_DIR) -DPROPER_REGISTERED='[$(PROPER_REGISTERED)]' -o $(TST_BIN_DIR)
-UTIL_ERLC_FLAGS=-W2 -o $(UTIL_BIN_DIR)
-EDOC_OPTIONS=[{dialyzer_specs,all}, {report_missing_type,true}, {report_type_mismatch,true}, {pretty_print,erl_pp}, {preprocess,true}]
-EUNIT_OPTIONS=[]
-DIALYZER=dialyzer
-DIALYZER_FLAGS=-Wunmatched_returns
-RM=rm -f
-TAR=tar -czf
-SUB_MAKE_FLAGS=--no-print-directory
-SUB_MAKE=$(MAKE) $(SUB_MAKE_FLAGS)
-
-
-# TODO: separate debug and optimization options
-# TODO: extra targets: tags, commit/update, check_plt, analyze
-# TODO: header files as dependencies: more fine-grained
-
-.PHONY: default all compile tests util doc check clean distclean rebuild package build_plt
+.PHONY: default all compile tests doc check clean distclean rebuild retest
default: compile
all: compile doc
-compile: $(APP_BIN_FILES)
-
-$(APP_BIN_FILES): $(UTIL_BIN_FILES) $(HDR_FILES) $(MAKE_FILES)
-
-$(APP_BIN_DIR)/%.beam: $(APP_SRC_DIR)/%.erl
- $(ERLC) $(ERLC_FLAGS) $(APP_ERLC_FLAGS) $<
+compile:
+ ./rebar compile
-$(APP_BIN_DIR)/%.app: $(APP_SRC_DIR)/%.app.src
- sed -e s^%PROPER_VSN%^$(PROPER_VSN)^ \
- -e s^%PROPER_MODULES%^$(PROPER_MODULES)^ \
- -e s^%PROPER_REGISTERED%^$(PROPER_REGISTERED)^ \
- -e s^%PROPER_NEEDED_APPS%^$(PROPER_NEEDED_APPS)^ \
- $< > $@
+tests:
+ ./rebar eunit
-tests: compile $(TST_BIN_FILES)
- $(ENTER_ERL) eunit:test({dir,"$(TST_BIN_DIR)"},$(EUNIT_OPTIONS)) $(EXIT_ERL)
-
-$(TST_BIN_FILES): $(HDR_FILES) $(MAKE_FILES)
-
-$(TST_BIN_DIR)/%.beam: $(TST_SRC_DIR)/%.erl
- ERL_LIBS=`pwd` $(ERLC) $(ERLC_FLAGS) $(TST_ERLC_FLAGS) $<
-
-util: $(UTIL_BIN_FILES)
-
-$(UTIL_BIN_FILES): $(MAKE_FILES)
-
-$(UTIL_BIN_DIR)/%.beam: $(UTIL_SRC_DIR)/%.erl
- $(ERLC) $(ERLC_FLAGS) $(UTIL_ERLC_FLAGS) $<
-
-doc: $(DOC_SRC_FILES) $(APP_SRC_FILES) $(HDR_FILES) $(MAKE_FILES)
- $(ENTER_ERL) edoc:application(proper, ".", $(EDOC_OPTIONS)) $(EXIT_ERL)
+doc:
+ ./rebar doc
check: compile
- $(DIALYZER) $(DIALYZER_FLAGS) $(APP_BIN_DIR)
+ ./rebar dialyze
clean:
- @echo -n removing temporary files...
- @$(RM) $(TMP_FILES)
- @echo done
+ ./clean_temp.sh
distclean: clean
- @echo -n removing build artifacts...
- @$(RM) $(BUILD_FILES)
- @echo done
+ ./rebar clean
rebuild:
- @$(SUB_MAKE) distclean
- @$(SUB_MAKE) compile
+ ./rebar clean
+ ./rebar compile
retest:
- $(RM) $(TST_BIN_FILES)
- @$(SUB_MAKE) tests
-
-package:
- @$(SUB_MAKE) all
- @$(SUB_MAKE) clean
- @echo -n packaging...
- @$(TAR) $(PACKAGE_FILE) $(APP_SRC_FILES) $(APP_BIN_FILES) $(HDR_FILES) $(DOC_SRC_FILES) $(DOC_FILES) $(TST_SRC_FILES) $(UTIL_SRC_FILES) $(UTIL_BIN_FILES) $(EXM_FILES) $(TXT_FILES) $(MAKE_FILES)
- @echo done
-
-build_plt:
- $(DIALYZER) --build_plt --apps $(NEEDED_APPS)
+ rm -rf .eunit
+ ./rebar eunit
View
16 README
@@ -41,15 +41,13 @@ Quickstart guide
or
proper_gen:pick(some_type(), <size>).
-Note to users of Erlang r13b03 or older:
-
-PropEr makes heavy use of recursive types, which are unsupported in versions of
-the Erlang/OTP distribution prior to r13b04. To compile PropEr under such a
-system, run 'make' like so:
- make NOTYPES=1
-This enables the spec+type-stripping parse transform included in PropEr, which
-fixes the problem by stripping all type information from PropEr's source files
-while compiling.
+Note to users of Erlang/OTP R13B03 or older:
+
+PropEr makes heavy use of recursive types, which are unsupported on versions of
+the Erlang/OTP distribution prior to R13B04. To compile PropEr under such a
+system, add {d,NO_TYPES} to erl_opts inside rebar.config. This enables the
+spec+type-stripping parse transform included in PropEr, which fixes the problem
+by stripping all type information from PropEr's source files while compiling.
--------------------------------------------------------------------------------
View
@@ -0,0 +1,3 @@
+#! /bin/sh
+
+rm -f doc/*.html doc/stylesheet.css doc/erlang.png doc/edoc-info
View
@@ -0,0 +1,7 @@
+#! /bin/sh
+
+DIRS=.\ `ls -l | grep '^d' | awk '{print $8}'`
+
+for d in $DIRS; do
+ rm -f $d/*~ $d/#*# $d/*.dump
+done
@@ -23,6 +23,15 @@
%%------------------------------------------------------------------------------
+%% Activate strip_types parse transform
+%%------------------------------------------------------------------------------
+
+-ifdef(NO_TYPES).
+-compile({parse_transform, strip_types}).
+-endif.
+
+
+%%------------------------------------------------------------------------------
%% Macros
%%------------------------------------------------------------------------------
View
BIN rebar
Binary file not shown.
View
@@ -0,0 +1,15 @@
+% WARNING: Our version of rebar doesn't automatically report warnings, nor does
+% it add erl_opts to eunit_compile_opts.
+
+% WARNING: To compile on versions of Erlang/OTP older than R13B4, add
+% {d,'NO_TYPES'} to erl_opts.
+
+{erl_first_files, ["strip_types.erl"]}.
+{erl_opts, [debug_info, report_warnings, {warn_format,1}, warn_export_vars,
+ warn_obsolete_guard, warn_unused_import, warn_missing_spec,
+ warn_untyped_record]}.
+{edoc_opts, [{dialyzer_specs,all}, {report_missing_type,true},
+ {report_type_mismatch,true}, {pretty_print,erl_pp},
+ {preprocess,true}]}.
+{dialyzer_opts, [{warnings,[unmatched_returns]}]}.
+{clean_post_script, "./clean_doc.sh"}.
View
@@ -23,8 +23,7 @@
{application, proper,
[{description, "A QuickCheck-inspired property-based testing tool for Erlang"},
- {vsn, "%PROPER_VSN%"},
- {modules, [%PROPER_MODULES%]},
- {registered, [%PROPER_REGISTERED%]},
- {applications, [%PROPER_NEEDED_APPS%]},
+ {vsn, "1.0"},
+ {registered, []},
+ {applications, [compiler,erts,kernel,stdlib,crypto]},
{env, []}]}.
View
@@ -37,7 +37,9 @@
-export_type([test/0, outer_test/0, counterexample/0]).
-export_type([imm_testcase/0, stripped_test/0, fail_reason/0, output_fun/0]).
-%% @private_type imm_testcase, stripped_test, fail_reason
+%% @private_type imm_testcase
+%% @private_type stripped_test
+%% @private_type fail_reason
-include("proper_internal.hrl").
View
@@ -45,6 +45,10 @@
| {'size', array_size()}.
-type array_opts(T) :: array_opt(T) | [array_opt(T)].
+%% This header is only included so that the strip_types parse transform will be
+%% applied to this file as well.
+-include("proper_internal.hrl").
+
%%------------------------------------------------------------------------------
%% API functions
View
@@ -51,6 +51,10 @@
%% {'$call',proper_dict,update,[aa,<fun>,{'$call',proper_dict,new,[]}]}
%% which would raise an exception if we tried to evaluate it.
+%% This header is only included so that the strip_types parse transform will be
+%% applied to this file as well.
+-include("proper_internal.hrl").
+
%%------------------------------------------------------------------------------
%% API functions
View
@@ -40,6 +40,10 @@
%% Based on the documentation alone, this is the best we can do.
-type iterator(_T) :: term().
+%% This header is only included so that the strip_types parse transform will be
+%% applied to this file as well.
+-include("proper_internal.hrl").
+
%%------------------------------------------------------------------------------
%% API functions
View
@@ -37,6 +37,10 @@
%% Based on the documentation alone, this is the best we can do.
-type iterator(_K,_V) :: term().
+%% This header is only included so that the strip_types parse transform will be
+%% applied to this file as well.
+-include("proper_internal.hrl").
+
%%------------------------------------------------------------------------------
%% API functions
View
@@ -37,6 +37,13 @@
-export_type([instance/0, imm_instance/0, sized_generator/0, nosize_generator/0,
generator/0, straight_gen/0, reverse_gen/0, combine_fun/0,
alt_gens/0]).
+%% @private_type sized_generator
+%% @private_type nosize_generator
+%% @private_type generator
+%% @private_type straight_gen
+%% @private_type reverse_gen
+%% @private_type combine_fun
+%% @private_type alt_gens
-include("proper_internal.hrl").
@@ -53,21 +60,14 @@
| {'$used', imm_instance(), imm_instance()}
| {'$to_part', imm_instance()}.
-%% @private_type sized_generator
-type sized_generator() :: fun((size()) -> imm_instance()).
-%% @private_type nosize_generator
-type nosize_generator() :: fun(() -> imm_instance()).
-%% @private_type generator
-type generator() :: sized_generator() | nosize_generator().
-type sized_straight_gen() :: fun((size()) -> {'ok',instance()} | 'error').
-type nosize_straight_gen() :: fun(() -> {'ok',instance()} | 'error').
-%% @private_type straight_gen
-type straight_gen() :: sized_straight_gen() | nosize_straight_gen().
-%% @private_type reverse_gen
-type reverse_gen() :: fun((instance()) -> imm_instance()).
-%% @private_type combine_fun
-type combine_fun() :: fun((instance()) -> imm_instance()).
-%% @private_type alt_gens
-type alt_gens() :: fun(() -> [imm_instance()]).
View
@@ -34,6 +34,10 @@
%% type because dialyzer can't handle parametric opaque types yet).
-type orddict(K,V) :: [{K,V}].
+%% This header is only included so that the strip_types parse transform will be
+%% applied to this file as well.
+-include("proper_internal.hrl").
+
%%------------------------------------------------------------------------------
%% API functions
View
@@ -36,6 +36,10 @@
%% type because dialyzer can't handle parametric opaque types yet).
-type ordset(T) :: [T].
+%% This header is only included so that the strip_types parse transform will be
+%% applied to this file as well.
+-include("proper_internal.hrl").
+
%%------------------------------------------------------------------------------
%% API functions
View
@@ -35,6 +35,10 @@
%% type because dialyzer can't handle parametric opaque types yet).
-type queue(_T) :: queue().
+%% This header is only included so that the strip_types parse transform will be
+%% applied to this file as well.
+-include("proper_internal.hrl").
+
%%------------------------------------------------------------------------------
%% API functions
View
@@ -36,6 +36,10 @@
%% type because dialyzer can't handle parametric opaque types yet).
-type set(_T) :: set().
+%% This header is only included so that the strip_types parse transform will be
+%% applied to this file as well.
+-include("proper_internal.hrl").
+
%%------------------------------------------------------------------------------
%% API functions
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -62,9 +62,7 @@ cexm(FailReason, Bound) ->
{cexm, FailReason, Bound, 10, {state,'$temp_mod',[],1}}.
state_is_clean() ->
- get() =:= []
- andalso [] =:= [Proc || Proc <- registered(),
- lists:member(Proc, ?PROPER_REGISTERED)].
+ get() =:= [].
-define(_failsWithReason(ExpReason, Test),
?_failRun(ExpReason, _, _, none, Test, [noshrink])).
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
View
1 vsn.mk
@@ -1 +0,0 @@
-PROPER_VSN = 1.0

0 comments on commit 690aad4

Please sign in to comment.