diff --git a/.gitignore b/.gitignore index 22f8bc9e..1048d440 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ doc/*.css doc/*.html doc/*.png doc/edoc-info -include/compile_flags.hrl .directory .eunit .rebar diff --git a/Makefile b/Makefile index 62b3bb0d..1e92ba86 100644 --- a/Makefile +++ b/Makefile @@ -36,13 +36,10 @@ fast: get-deps compile all: fast dialyzer doc tests -include/compile_flags.hrl: write_compile_flags - ./write_compile_flags $@ - get-deps: $(REBAR) get-deps -compile: include/compile_flags.hrl +compile: $(REBAR) compile dialyzer: .plt/proper_plt compile @@ -52,7 +49,7 @@ dialyzer: .plt/proper_plt compile dialyzer --build_plt --output_plt $@ --apps erts kernel stdlib compiler crypto syntax_tools check_escripts: - ./check_escripts.sh make_doc write_compile_flags + ./check_escripts.sh make_doc tests: compile $(REBAR) eunit @@ -65,10 +62,10 @@ clean: distclean: clean $(RM) -r .eunit .rebar - $(RM) include/compile_flags.hrl .plt/proper_plt + $(RM) .plt/proper_plt $(REBAR) clean -rebuild: distclean include/compile_flags.hrl +rebuild: distclean $(REBAR) compile retest: compile diff --git a/include/proper_internal.hrl b/include/proper_internal.hrl index 7be80d7b..a61e8d6d 100644 --- a/include/proper_internal.hrl +++ b/include/proper_internal.hrl @@ -26,7 +26,6 @@ %%% @doc Internal header file: This header is included in all PropEr source %%% files. --include("compile_flags.hrl"). -include("proper_common.hrl"). diff --git a/mix.exs b/mix.exs index 9133376b..9543fa3f 100644 --- a/mix.exs +++ b/mix.exs @@ -22,7 +22,7 @@ defmodule Proper.Mixfile do end defp package do - [files: ~w(src include rebar.config configure Makefile COPYING README.md THANKS check_escripts.sh clean_doc.sh clean_temp.sh write_compile_flags mix.exs), + [files: ~w(src include rebar.config configure Makefile COPYING README.md THANKS check_escripts.sh clean_doc.sh clean_temp.sh mix.exs), maintainers: ["Manolis Papadakis", "Eirini Arvaniti", "Kostis Sagonas"], licenses: ["GPL"], links: %{"GitHub" => "https://github.com/manopapad/proper"}] diff --git a/rebar.config b/rebar.config index 96ad98e9..b403b13b 100644 --- a/rebar.config +++ b/rebar.config @@ -27,6 +27,8 @@ %% WARNING: Our version of rebar does NOT automatically report warnings, %% nor does it add erl_opts to eunit_compile_opts. +{minimum_otp_vsn, "17.0"}. + {erl_first_files, ["src/vararg.erl"]}. {eunit_first_files, ["src/vararg.erl", "src/proper_transformer.erl", @@ -35,9 +37,13 @@ {erl_opts, [debug_info, report_warnings, {warn_format,1}, warn_export_vars, warn_obsolete_guard, warn_unused_import, - warn_missing_spec, warn_untyped_record]}. + warn_missing_spec, warn_untyped_record, + {platform_define, "^17", 'USE_ERL_SCAN_LINE'}, + {platform_define, "^19|^2", 'AT_LEAST_19'}, + {platform_define, "^2", 'AT_LEAST_20'}, + {platform_define, "^2[1-9]", 'AT_LEAST_21'}]}. -{pre_hooks, [{"(linux|darwin|gnu)", compile, "make include/compile_flags.hrl"}, - {"(freebsd|netbsd|openbsd|solaris|dragonfly)", compile, "gmake include/compile_flags.hrl"}, - {"win32", compile, "escript.exe write_compile_flags include/compile_flags.hrl"}]}. {post_hooks, [{clean, "./clean_doc.sh"}]}. + +{dialyzer, [{warnings, [unmatched_returns]}, + {plt_extra_apps, [erts, kernel, stdlib, compiler, crypto, syntax_tools]}]}. diff --git a/test/proper_tests.erl b/test/proper_tests.erl index 9682582e..b9c4a49e 100644 --- a/test/proper_tests.erl +++ b/test/proper_tests.erl @@ -28,7 +28,6 @@ -module(proper_tests). --include("compile_flags.hrl"). -include("proper.hrl"). -include_lib("eunit/include/eunit.hrl"). diff --git a/test/symb_statem_maps.erl b/test/symb_statem_maps.erl index dcf94f36..bec5a541 100644 --- a/test/symb_statem_maps.erl +++ b/test/symb_statem_maps.erl @@ -26,8 +26,6 @@ -module(symb_statem_maps). --include("compile_flags.hrl"). - -include_lib("proper/include/proper.hrl"). -export([command/1, diff --git a/write_compile_flags b/write_compile_flags deleted file mode 100755 index bdf53d06..00000000 --- a/write_compile_flags +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env escript - -%%% -*- coding: utf-8 -*- -%%% -*- erlang-indent-level: 2 -*- -%%% ------------------------------------------------------------------- -%%% Copyright 2010-2018 Manolis Papadakis , -%%% Eirini Arvaniti -%%% and Kostis Sagonas -%%% -%%% This file is part of PropEr. -%%% -%%% PropEr is free software: you can redistribute it and/or modify -%%% it under the terms of the GNU General Public License as published by -%%% the Free Software Foundation, either version 3 of the License, or -%%% (at your option) any later version. -%%% -%%% PropEr is distributed in the hope that it will be useful, -%%% but WITHOUT ANY WARRANTY; without even the implied warranty of -%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -%%% GNU General Public License for more details. -%%% -%%% You should have received a copy of the GNU General Public License -%%% along with PropEr. If not, see . - -%%% Author(s): Manolis Papadakis and Kostis Sagonas -%%% Description: Compilation environment setup script: This script computes and -%%% prints out the correct set of compilation flags for the -%%% currently running version of the OTP. - --spec main([file:filename(),...]) -> 'ok'. -main([OutFile]) -> - CurrVer = parse_version_string(erlang:system_info(version)), - case CurrVer >= [6,0] of - true -> - {ok, Handle} = file:open(OutFile, [write]), - ToDefine = - case CurrVer < [10,0] of - true -> []; - false -> ["AT_LEAST_21"] - end ++ - case CurrVer < [9,0] of - true -> []; - false -> ["AT_LEAST_20"] - end ++ - case CurrVer < [8,0] of - true -> []; - false -> ["AT_LEAST_19"] - end ++ - %% older than 18.0 => erl_scan:line() type not marked deprecated - case CurrVer < [7,0] of - true -> ["USE_ERL_SCAN_LINE"]; - false -> [] - end, - Fun = fun(X) -> io:format(Handle, "-define(~s, 1).~n", [X]) end, - lists:foreach(Fun, ToDefine), - ok = file:close(Handle); - false -> - halt(1) %% we do not support releases prior to 17 - end. - -%% the stupid try-catch construct below is due to e.g. the R15A -%% release being denoted as having "5.9.pre" as version info :-( --spec parse_version_string(string()) -> [non_neg_integer()]. -parse_version_string(VerStr) -> - [try list_to_integer(S) - catch _:_ -> 0 end || S <- string:tokens(VerStr, ".")].