Elixir 1.18 Deal with :warnings_as_errors deprecation in compiler_options/1
warning: :warnings_as_errors is deprecated as part of Code.get_compiler_option/1 (elixir 1.18.3) lib/code.ex:1597: Code.get_compiler_option/1 (elixir 1.18.3) lib/code.ex:1572: anonymous fn/2 in Code.compiler_options/1 (elixir 1.18.3) lib/enum.ex:2546: Enum."-reduce/3-lists^foldl/2-0-"/3 (elixir 1.18.3) lib/code.ex:1571: Code.compiler_options/1 (pleroma 2.9.1-77-g8ec49c59-elixir-1-18+test) lib/pleroma/application.ex:104: Pleroma.Application.start/2 (kernel 10.2.6) application_master.erl:295: :application_master.start_it_old/4 warning: :warnings_as_errors is deprecated as part of Code.put_compiler_option/2, instead you must pass it as a --warnings-as-errors flag. If you need to set it as a default in a mix task, you can also set it under aliases: [compile: "compile --warnings-as-errors"] (elixir 1.18.3) lib/code.ex:1710: Code.put_compiler_option/2 (elixir 1.18.3) lib/code.ex:1573: anonymous fn/2 in Code.compiler_options/1 (elixir 1.18.3) lib/enum.ex:2546: Enum."-reduce/3-lists^foldl/2-0-"/3 (elixir 1.18.3) lib/code.ex:1571: Code.compiler_options/1 (pleroma 2.9.1-77-g8ec49c59-elixir-1-18+test) lib/pleroma/application.ex:104: Pleroma.Application.start/2 (kernel 10.2.6) application_master.erl:295: :application_master.start_it_old/4
This commit is contained in:
parent
63cbc1208d
commit
5addbf39fb
4 changed files with 17 additions and 7 deletions
|
|
@ -4,7 +4,7 @@ defmodule Mix.Tasks.Pleroma.TestRunner do
|
|||
use Mix.Task
|
||||
|
||||
def run(args \\ []) do
|
||||
case System.cmd("mix", ["test"] ++ args, into: IO.stream(:stdio, :line)) do
|
||||
case System.cmd("mix", ["test", "--warnings-as-errors"] ++ args, into: IO.stream(:stdio, :line)) do
|
||||
{_, 0} ->
|
||||
:ok
|
||||
|
||||
|
|
|
|||
|
|
@ -43,9 +43,6 @@ defmodule Pleroma.Application do
|
|||
# every time the application is restarted, so we disable module
|
||||
# conflicts at runtime
|
||||
Code.compiler_options(ignore_module_conflict: true)
|
||||
# Disable warnings_as_errors at runtime, it breaks Phoenix live reload
|
||||
# due to protocol consolidation warnings
|
||||
Code.compiler_options(warnings_as_errors: false)
|
||||
Pleroma.Telemetry.Logger.attach()
|
||||
Config.Holder.save_default()
|
||||
Pleroma.HTML.compile_scrubbers()
|
||||
|
|
@ -93,6 +90,21 @@ defmodule Pleroma.Application do
|
|||
end
|
||||
end
|
||||
|
||||
# Disable warnings_as_errors at runtime, it breaks Phoenix live reload
|
||||
# due to protocol consolidation warnings
|
||||
# :warnings_as_errors is deprecated via Code.compiler_options/2 since 1.18
|
||||
if elixir_version = System.version() do
|
||||
[major, minor] =
|
||||
elixir_version
|
||||
|> String.split(".")
|
||||
|> Enum.map(&String.to_integer/1)
|
||||
|> Enum.take(2)
|
||||
|
||||
if major == 1 and minor < 18 do
|
||||
Code.compiler_options(warnings_as_errors: false)
|
||||
end
|
||||
end
|
||||
|
||||
# Define workers and child supervisors to be supervised
|
||||
children =
|
||||
[
|
||||
|
|
|
|||
2
mix.exs
2
mix.exs
|
|
@ -236,7 +236,7 @@ defmodule Pleroma.Mixfile do
|
|||
"ecto.rollback": ["pleroma.ecto.rollback"],
|
||||
"ecto.setup": ["ecto.create", "ecto.migrate", "run priv/repo/seeds.exs"],
|
||||
"ecto.reset": ["ecto.drop", "ecto.setup"],
|
||||
test: ["ecto.create --quiet", "ecto.migrate", "test"],
|
||||
test: ["ecto.create --quiet", "ecto.migrate", "test --warnings-as-errors"],
|
||||
docs: ["pleroma.docs", "docs"],
|
||||
analyze: ["credo --strict --only=warnings,todo,fixme,consistency,readability"],
|
||||
copyright: &add_copyright/1,
|
||||
|
|
|
|||
|
|
@ -2,8 +2,6 @@
|
|||
# Copyright © 2017-2022 Pleroma Authors <https://pleroma.social/>
|
||||
# SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
Code.put_compiler_option(:warnings_as_errors, true)
|
||||
|
||||
ExUnit.configure(capture_log: true, max_cases: System.schedulers_online())
|
||||
|
||||
ExUnit.start(exclude: [:federated])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue