diff --git a/lib/distillery/releases/archiver.ex b/lib/distillery/releases/archiver.ex index eff56add..f6135c41 100644 --- a/lib/distillery/releases/archiver.ex +++ b/lib/distillery/releases/archiver.ex @@ -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 diff --git a/lib/distillery/releases/assembler.ex b/lib/distillery/releases/assembler.ex index 072ba252..6414cac2 100644 --- a/lib/distillery/releases/assembler.ex +++ b/lib/distillery/releases/assembler.ex @@ -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} diff --git a/lib/distillery/releases/config/config.ex b/lib/distillery/releases/config/config.ex index 5b7584cf..c39e6fcc 100644 --- a/lib/distillery/releases/config/config.ex +++ b/lib/distillery/releases/config/config.ex @@ -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 """ @@ -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 """ diff --git a/lib/distillery/releases/config/provider.ex b/lib/distillery/releases/config/provider.ex index 1deef987..51bcc588 100644 --- a/lib/distillery/releases/config/provider.ex +++ b/lib/distillery/releases/config/provider.ex @@ -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 -> diff --git a/lib/distillery/releases/plugins/plugin.ex b/lib/distillery/releases/plugins/plugin.ex index dc4b0b52..b9cd859e 100644 --- a/lib/distillery/releases/plugins/plugin.ex +++ b/lib/distillery/releases/plugins/plugin.ex @@ -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} @@ -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) @@ -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) diff --git a/lib/distillery/releases/runtime/control.ex b/lib/distillery/releases/runtime/control.ex index 7e28f386..a42ef7c0 100644 --- a/lib/distillery/releases/runtime/control.ex +++ b/lib/distillery/releases/runtime/control.ex @@ -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 @@ -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 @@ -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 diff --git a/lib/distillery/tasks/release.ex b/lib/distillery/tasks/release.ex index 5e583f8c..bf9bdfd0 100644 --- a/lib/distillery/tasks/release.ex +++ b/lib/distillery/tasks/release.ex @@ -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) @@ -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) diff --git a/mix.exs b/mix.exs index bff9889f..050d0eb7 100644 --- a/mix.exs +++ b/mix.exs @@ -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 diff --git a/test/cases/integration_test.exs b/test/cases/integration_test.exs index 3ba5c62d..41b1d3e8 100644 --- a/test/cases/integration_test.exs +++ b/test/cases/integration_test.exs @@ -1,6 +1,6 @@ defmodule Distillery.Test.IntegrationTest do use Distillery.Test.IntegrationCase, async: false - + @moduletag win32: false alias Distillery.Releases.Utils @@ -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") @@ -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() @@ -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"]) @@ -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 @@ -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()) @@ -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 @@ -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()) @@ -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") @@ -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 @@ -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}" diff --git a/test/cases/integration_test_win32.exs b/test/cases/integration_test_win32.exs index 32aedb4c..7285522c 100644 --- a/test/cases/integration_test_win32.exs +++ b/test/cases/integration_test_win32.exs @@ -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 @@ -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") @@ -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() @@ -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"]) @@ -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 @@ -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") @@ -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