Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecations #257

Merged
merged 5 commits into from
Mar 26, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 13 additions & 1 deletion lib/benchee.ex
Expand Up @@ -44,6 +44,11 @@ for {module, moduledoc} <- [{Benchee, elixir_doc}, {:benchee, erlang_doc}] do
end

def run(config, jobs) when is_map(jobs) do
IO.puts("""
Passing configuration as the first argument to Benchee.run/2 is deprecated.
Please see the documentation for Benchee.run/2 for updated usage instructions.
""")

# pre 0.6.0 way of passing in the config first and as a map
do_run(jobs, config)
end
Expand All @@ -65,14 +70,21 @@ for {module, moduledoc} <- [{Benchee, elixir_doc}, {:benchee, erlang_doc}] do
end)
end

def measure(suite) do
IO.puts("""
Benchee.measure/1 is deprecated, please use Benchee.collect/1.
""")

Benchee.Benchmark.collect(suite)
end

defdelegate init(), to: Benchee.Configuration
defdelegate init(config), to: Benchee.Configuration
defdelegate system(suite), to: Benchee.System
defdelegate benchmark(suite, name, function), to: Benchee.Benchmark
defdelegate benchmark(suite, name, function, printer), to: Benchee.Benchmark
defdelegate collect(suite), to: Benchee.Benchmark
defdelegate collect(suite, printer), to: Benchee.Benchmark
defdelegate measure(suite), to: Benchee.Benchmark, as: :collect
defdelegate statistics(suite), to: Benchee.Statistics
defdelegate load(suite), to: Benchee.ScenarioLoader
end
Expand Down
12 changes: 11 additions & 1 deletion lib/benchee/configuration.ex
Expand Up @@ -360,6 +360,14 @@ defmodule Benchee.Configuration do

defp formatter_configuration_from_options(config, module, legacy_option_key) do
if Map.has_key?(config.formatter_options, legacy_option_key) do
IO.puts("""

Using :formatter_options to configure formatters is now deprecated.
Please configure them in `:formatters` - see the documentation for
Benchee.Configuration.init/1 for details.

""")

{module, config.formatter_options[legacy_option_key]}
else
module
Expand Down Expand Up @@ -418,7 +426,9 @@ defmodule Benchee.Configuration do

Measuring memory consumption is only available on OTP 19 or greater.
If you would like to benchmark memory consumption, please upgrade to a
newer verion of OTP.
newer version of OTP.
Benchee now also only supports elixir ~> 1.6 which doesn't support OTP 18.
Please upgrade :)

""")
end
Expand Down
15 changes: 14 additions & 1 deletion lib/benchee/formatter.ex
Expand Up @@ -74,7 +74,20 @@ defmodule Benchee.Formatter do
{formatter, @default_opts}
end

defp normalize_module_configuration(formatter), do: formatter
defp normalize_module_configuration(formatter) when is_function(formatter, 1), do: formatter

defp normalize_module_configuration(formatter) do
IO.puts("""

All formaters that are not modules implementing the Benchee.Formatter
behaviour or functions with an arity of 1 are deprecated.
Please see the documentation for Benchee.Configuration.init/1 for
current usage instructions.

""")

formatter
end

defp is_formatter_module?({formatter, _options}) when is_atom(formatter) do
module_attributes = formatter.module_info(:attributes)
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
@@ -1,7 +1,7 @@
defmodule Benchee.Mixfile do
use Mix.Project

@version "0.14.0"
@version "0.99.0"

def project do
[
Expand Down