Skip to content

Commit b2a04dd

Browse files
authored
No "app.config" in "mix sentry.package_source_code" (#661)
Closes #660.
1 parent b0413f1 commit b2a04dd

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

lib/mix/tasks/sentry.package_source_code.ex

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@ defmodule Mix.Tasks.Sentry.PackageSourceCode do
3333
mix release
3434
```
3535
36+
> #### Runtime Configuration {: .tip}
37+
>
38+
> If you use `config/runtime.exs` for runtime configuration of your application and
39+
> release, *and* you also configure the source-context-related options for the `:sentry`
40+
> application in that file (such as `:root_source_code_paths`), you'll need to call the
41+
> `mix app.config` task before calling this Mix task. `mix app.config` loads the
42+
> `config/runtime.exs` configuration. Generally, we recommend configuring all the
43+
> source-context-related options in compile-time config files (like `config/config.exs`
44+
> or `config/prod.exs`).
45+
3646
## Options
3747
3848
* `--debug` - print more information about collecting and encoding source code
@@ -50,13 +60,11 @@ defmodule Mix.Tasks.Sentry.PackageSourceCode do
5060
@bytes_in_gb 1024 * 1024 * 1024
5161

5262
@switches [debug: :boolean]
53-
@requirements ["app.config"]
5463

5564
@impl true
5665
def run(args) do
5766
{opts, _args} = OptionParser.parse!(args, strict: @switches)
5867

59-
# We can read the config here because this task depends on the `app.config` task.
6068
config = Application.get_all_env(:sentry)
6169

6270
{elapsed, source_map} =
@@ -80,10 +88,8 @@ defmodule Mix.Tasks.Sentry.PackageSourceCode do
8088
File.write!(output_path, contents)
8189

8290
Mix.shell().info([
83-
"Wrote ",
84-
:cyan,
85-
format_bytes(byte_size(contents)),
86-
:reset,
91+
"Wrote #{map_size(source_map)} files in ",
92+
[:cyan, format_bytes(byte_size(contents)), :reset],
8793
" to: #{Path.relative_to_cwd(output_path)}"
8894
])
8995
end

0 commit comments

Comments
 (0)