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

warning(Elixir 1.11.0): Fix compiler warnings emitted in most recent … #735

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion lib/distillery/releases/archiver.ex
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ defmodule Distillery.Releases.Archiver do
end
catch
kind, err ->
{:error, {:archiver, Exception.normalize(kind, err, System.stacktrace())}}
{:error, {:archiver, Exception.normalize(kind, err, __STACKTRACE__)}}
end

defp make_archive(%Release{version: version} = release, tmpdir) do
Expand Down
2 changes: 1 addition & 1 deletion lib/distillery/releases/assembler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ defmodule Distillery.Releases.Assembler do
end
rescue
e in [File.Error] ->
{:error, {:assembler, {e, System.stacktrace()}}}
{:error, {:assembler, {e, __STACKTRACE__}}}
catch
:error, {:assembler, _mod, _reason} = err ->
{:error, err}
Expand Down
8 changes: 4 additions & 4 deletions lib/distillery/releases/config/config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -366,10 +366,10 @@ defmodule Distillery.Releases.Config do
config
rescue
e in [LoadError] ->
reraise(e, System.stacktrace())
reraise(e, __STACKTRACE__)

e ->
reraise(LoadError, [file: "nofile", error: e], System.stacktrace())
reraise(LoadError, [file: "nofile", error: e], __STACKTRACE__)
end

@doc """
Expand All @@ -381,10 +381,10 @@ defmodule Distillery.Releases.Config do
read_string!(File.read!(file))
rescue
e in [LoadError] ->
reraise(LoadError, [file: file, error: e.error], System.stacktrace())
reraise(LoadError, [file: file, error: e.error], __STACKTRACE__)

e ->
reraise(LoadError, [file: file, error: e], System.stacktrace())
reraise(LoadError, [file: file, error: e], __STACKTRACE__)
end

@doc """
Expand Down
4 changes: 2 additions & 2 deletions lib/distillery/releases/config/provider.ex
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ defmodule Distillery.Releases.Config.Provider do
end
rescue
err ->
trace = System.stacktrace()
trace = __STACKTRACE__
msg = Exception.message(err) <> "\n" <> Exception.format_stacktrace(trace)
print_err(msg)
reraise err, trace
catch
kind, err ->
print_err(Exception.format(kind, err, System.stacktrace()))
print_err(Exception.format(kind, err, __STACKTRACE__))

case kind do
:throw ->
Expand Down
10 changes: 5 additions & 5 deletions lib/distillery/releases/plugins/plugin.ex
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ defmodule Distillery.Releases.Plugin do
call(plugins, callback, release)
catch
:throw, {:error, {:plugin, {kind, err}}} ->
{:error, {:plugin, {kind, err, System.stacktrace()}}}
{:error, {:plugin, {kind, err, __STACKTRACE__}}}
end

defp call([], _, release), do: {:ok, release}
Expand All @@ -193,10 +193,10 @@ defmodule Distillery.Releases.Plugin do
apply_plugin(plugin, callback, release, opts)
rescue
e ->
{:error, {:plugin, {e, System.stacktrace()}}}
{:error, {:plugin, {e, __STACKTRACE__}}}
catch
kind, err ->
{:error, {:plugin, {kind, err, System.stacktrace()}}}
{:error, {:plugin, {kind, err, __STACKTRACE__}}}
else
nil ->
call(plugins, callback, release)
Expand Down Expand Up @@ -224,10 +224,10 @@ defmodule Distillery.Releases.Plugin do
apply_plugin(plugin, callback, args, opts)
rescue
e ->
{:error, {:plugin, {e, System.stacktrace()}}}
{:error, {:plugin, {e, __STACKTRACE__}}}
catch
kind, err ->
{:error, {:plugin, {kind, err, System.stacktrace()}}}
{:error, {:plugin, {kind, err, __STACKTRACE__}}}
else
_ ->
run(plugins, callback, args)
Expand Down
8 changes: 4 additions & 4 deletions lib/distillery/releases/runtime/control.ex
Original file line number Diff line number Diff line change
Expand Up @@ -707,14 +707,14 @@ defmodule Distillery.Releases.Runtime.Control do
Console.error("""
Could not load #{Path.expand(file)}: #{Exception.message(err)}

#{Exception.format_stacktrace(System.stacktrace())}
#{Exception.format_stacktrace(__STACKTRACE__)}
""")

err ->
Console.error("""
Evaluation failed with: #{Exception.message(err)}

#{Exception.format_stacktrace(System.stacktrace())}
#{Exception.format_stacktrace(__STACKTRACE__)}
""")
end

Expand Down Expand Up @@ -778,7 +778,7 @@ defmodule Distillery.Releases.Runtime.Control do
Console.error("""
Evaluation failed with: #{Exception.message(err)}

#{Exception.format_stacktrace(System.stacktrace())}
#{Exception.format_stacktrace(__STACKTRACE__)}
""")
end

Expand All @@ -792,7 +792,7 @@ defmodule Distillery.Releases.Runtime.Control do
Console.error("""
Evaluation failed with: #{Exception.message(err)}

#{Exception.format_stacktrace(System.stacktrace())}
#{Exception.format_stacktrace(__STACKTRACE__)}
""")
end

Expand Down
4 changes: 2 additions & 2 deletions lib/distillery/tasks/release.ex
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ defmodule Mix.Tasks.Distillery.Release do
e ->
Shell.error(
"Release failed: #{Exception.message(e)}\n" <>
Exception.format_stacktrace(System.stacktrace())
Exception.format_stacktrace(__STACKTRACE__)
)

System.halt(1)
Expand Down Expand Up @@ -153,7 +153,7 @@ defmodule Mix.Tasks.Distillery.Release do
e ->
Shell.error(
"Release failed: #{Exception.message(e)}\n" <>
Exception.format_stacktrace(System.stacktrace())
Exception.format_stacktrace(__STACKTRACE__)
)

System.halt(1)
Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ defmodule Distillery.Mixfile do
end

def application do
[extra_applications: [:runtime_tools]]
[extra_applications: [:runtime_tools, :crypto, :eex, :sasl]]
end

defp deps do
Expand Down
34 changes: 17 additions & 17 deletions test/cases/integration_test.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defmodule Distillery.Test.IntegrationTest do
use Distillery.Test.IntegrationCase, async: false

@moduletag win32: false

alias Distillery.Releases.Utils
Expand All @@ -11,14 +11,14 @@ defmodule Distillery.Test.IntegrationTest do
test "can build a release and start it - dev" do
with_standard_app do
assert {:ok, output} = build_release(env: :dev, no_tar: true)

# Release plugin was run
for callback <- ~w(before_assembly after_assembly) do
assert output =~ "EnvLoggerPlugin in dev executing #{callback}"
end

bin = Path.join([output_path(), "bin", "standard_app"])

try do
# Can start
assert {:ok, _} = release_cmd(bin, "start")
Expand All @@ -34,11 +34,11 @@ defmodule Distillery.Test.IntegrationTest do
rescue
e ->
release_cmd(bin, "stop")
reraise e, System.stacktrace()
reraise e, __STACKTRACE__
end
end
end

test "can build release and start it - prod" do
with_standard_app do
assert {:ok, output} = build_release()
Expand All @@ -48,7 +48,7 @@ defmodule Distillery.Test.IntegrationTest do
assert output =~ "EnvLoggerPlugin in prod executing #{callback}"
assert output =~ "ProdPlugin in prod executing #{callback}"
end

# Extract release to temporary directory
assert {:ok, tmpdir} = Utils.insecure_mkdir_temp()
bin = Path.join([tmpdir, "bin", "standard_app"])
Expand All @@ -69,7 +69,7 @@ defmodule Distillery.Test.IntegrationTest do
rescue
e ->
release_cmd(bin, "stop")
reraise e, System.stacktrace()
reraise e, __STACKTRACE__
after
File.rm_rf!(tmpdir)
end
Expand Down Expand Up @@ -122,7 +122,7 @@ defmodule Distillery.Test.IntegrationTest do
rescue
e ->
release_cmd(bin_path, "stop")
reraise e, System.stacktrace()
reraise e, __STACKTRACE__
after
File.rm_rf(tmpdir)
reset_changes!(app_path())
Expand All @@ -133,7 +133,7 @@ defmodule Distillery.Test.IntegrationTest do
test "can build and deploy hot upgrade with custom appup" do
with_standard_app do
out_path = output_path()

# Build v1 release
assert {:ok, _} = build_release()
# Apply v2 changes
Expand Down Expand Up @@ -182,7 +182,7 @@ defmodule Distillery.Test.IntegrationTest do
rescue
e ->
release_cmd(bin_path, "stop")
reraise e, System.stacktrace()
reraise e, __STACKTRACE__
after
File.rm_rf(tmpdir)
reset_changes!(app_path())
Expand Down Expand Up @@ -216,21 +216,21 @@ defmodule Distillery.Test.IntegrationTest do
rescue
e ->
release_cmd(bin_path, "stop")
reraise e, System.stacktrace()
reraise e, __STACKTRACE__
after
File.rm_rf!(tmpdir)
end
end
end
end

describe "umbrella application" do
test "can build umbrella and deploy it - dev" do
with_umbrella_app do
assert {:ok, output} = build_release(env: :dev, no_tar: true)

bin = Path.join([output_path(), "bin", "umbrella"])

try do
# Can start
assert {:ok, _} = release_cmd(bin, "start")
Expand All @@ -242,7 +242,7 @@ defmodule Distillery.Test.IntegrationTest do
rescue
e ->
release_cmd(bin, "stop")
reraise e, System.stacktrace()
reraise e, __STACKTRACE__
end
end
end
Expand All @@ -253,7 +253,7 @@ defmodule Distillery.Test.IntegrationTest do
headers = [{'accepts', 'application/json'}, {'content-type', 'application/json'}]
opts = [body_format: :binary, full_result: false]
case :httpc.request(:get, {url, headers}, [], opts) do
{:ok, {200, _}} ->
{:ok, {200, _}} ->
:ok
err when tries < 5 ->
IO.inspect "Request (attempt #{tries} of 5) to /healthz endpoint failed with: #{err}"
Expand Down
26 changes: 13 additions & 13 deletions test/cases/integration_test_win32.exs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ defmodule Distillery.Test.Win32IntegrationTest do
Currently this mostly mirrors the other integration tests, except no hot upgrades
"""
use Distillery.Test.IntegrationCase, async: false

@moduletag win32: true

alias Distillery.Releases.Utils
Expand All @@ -16,14 +16,14 @@ defmodule Distillery.Test.Win32IntegrationTest do
test "can build a release and start it - dev" do
with_standard_app do
assert {:ok, output} = build_release(env: :dev, no_tar: true)

# Release plugin was run
for callback <- ~w(before_assembly after_assembly) do
assert output =~ "EnvLoggerPlugin in dev executing #{callback}"
end

bin = Path.join([output_path(), "bin", "standard_app"])

try do
# Can start
assert {:ok, _} = release_cmd(bin, "start")
Expand All @@ -39,11 +39,11 @@ defmodule Distillery.Test.Win32IntegrationTest do
rescue
e ->
release_cmd(bin, "stop")
reraise e, System.stacktrace()
reraise e, __STACKTRACE__
end
end
end

test "can build release and start it - prod" do
with_standard_app do
assert {:ok, output} = build_release()
Expand All @@ -53,7 +53,7 @@ defmodule Distillery.Test.Win32IntegrationTest do
assert output =~ "EnvLoggerPlugin in prod executing #{callback}"
assert output =~ "ProdPlugin in prod executing #{callback}"
end

# Extract release to temporary directory
assert {:ok, tmpdir} = Utils.insecure_mkdir_temp()
bin = Path.join([tmpdir, "bin", "standard_app"])
Expand All @@ -74,7 +74,7 @@ defmodule Distillery.Test.Win32IntegrationTest do
rescue
e ->
release_cmd(bin, "stop")
reraise e, System.stacktrace()
reraise e, __STACKTRACE__
after
File.rm_rf!(tmpdir)
end
Expand Down Expand Up @@ -107,21 +107,21 @@ defmodule Distillery.Test.Win32IntegrationTest do
rescue
e ->
release_cmd(bin_path, "stop")
reraise e, System.stacktrace()
reraise e, __STACKTRACE__
after
File.rm_rf!(tmpdir)
end
end
end
end

describe "umbrella application" do
test "can build umbrella and deploy it - dev" do
with_umbrella_app do
assert {:ok, output} = build_release(env: :dev, no_tar: true)

bin = Path.join([output_path(), "bin", "umbrella"])

try do
# Can start
assert {:ok, _} = release_cmd(bin, "start")
Expand All @@ -133,7 +133,7 @@ defmodule Distillery.Test.Win32IntegrationTest do
rescue
e ->
release_cmd(bin, "stop")
reraise e, System.stacktrace()
reraise e, __STACKTRACE__
end
end
end
Expand Down