Skip to content

Commit 6045c32

Browse files
authored
Update version checks (#343)
* bump min elixir version in mix files and .tool-versions * update otp and elixir version checks * remove no longer needed elixir 1.7 workarounds * remove elixir 1.10-rc support * fix warnings
1 parent 23d8b2a commit 6045c32

File tree

11 files changed

+33
-63
lines changed

11 files changed

+33
-63
lines changed

.tool-versions

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# This file contains the recommended versions for developing and running
2-
# elixir-ls. However, elixir-ls supports a minumum version of Elixir 1.7.0 with
3-
# OTP 20 and should work with any later releases.
2+
# elixir-ls. However, elixir-ls supports a minumum version of Elixir 1.8.0 with
3+
# OTP 21 and should work with any later releases.
44
# Using asdf to manage your elixir and OTP versions is not required, you can
55
# use the system-installed version instead.
66
#
77
# The versions selected here are the versions that are used to build a binary
88
# release for distribution
9-
elixir 1.7.4-otp-21
9+
elixir 1.8.2-otp-21
1010
erlang 21.3.8.17

apps/elixir_ls_debugger/lib/debugger/cli.ex

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ defmodule ElixirLS.Debugger.CLI do
1717
defp warn_if_unsupported_version do
1818
elixir_version = System.version()
1919

20+
unless Version.match?(elixir_version, ">= 1.8.0") do
21+
message =
22+
"WARNING: Elixir versions below 1.8 are not supported. (Currently v#{elixir_version})"
23+
24+
Output.print_err(message)
25+
end
26+
2027
if Version.match?(elixir_version, ">= 1.10.0") && Version.match?(elixir_version, "< 1.10.3") do
2128
message =
2229
"WARNING: Debugging is not supported on Elixir #{elixir_version}. Please upgrade" <>
@@ -25,5 +32,14 @@ defmodule ElixirLS.Debugger.CLI do
2532

2633
Output.print_err(message)
2734
end
35+
36+
otp_release = String.to_integer(System.otp_release())
37+
38+
if otp_release < 21 do
39+
message =
40+
"WARNING: Erlang OTP releases below 21 are not supported (Currently OTP #{otp_release})"
41+
42+
Output.print_err(message)
43+
end
2844
end
2945
end

apps/elixir_ls_debugger/lib/debugger/server.ex

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ defmodule ElixirLS.Debugger.Server do
130130
## Helpers
131131

132132
defp handle_request(initialize_req(_, client_info), state) do
133-
check_erlang_version()
134133
{capabilities(), %{state | client_info: client_info}}
135134
end
136135

@@ -607,17 +606,6 @@ defmodule ElixirLS.Debugger.Server do
607606
module not in exclude_modules
608607
end
609608

610-
defp check_erlang_version do
611-
version = String.to_integer(to_string(:erlang.system_info(:otp_release)))
612-
613-
if version < 20 do
614-
IO.warn(
615-
"Erlang version >= OTP 20 is required to debug Elixir. " <>
616-
"(Current version: #{version})\n"
617-
)
618-
end
619-
end
620-
621609
defp change_env(env) do
622610
Mix.env(env)
623611

apps/elixir_ls_debugger/mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ defmodule ElixirLS.Debugger.Mixfile do
99
config_path: "../../config/config.exs",
1010
deps_path: "../../deps",
1111
lockfile: "../../mix.lock",
12-
elixir: ">= 1.7.0",
12+
elixir: ">= 1.8.0",
1313
build_embedded: false,
1414
start_permanent: true,
1515
build_per_environment: false,

apps/elixir_ls_utils/mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ defmodule ElixirLS.Utils.Mixfile do
1010
deps_path: "../../deps",
1111
elixirc_paths: elixirc_paths(Mix.env()),
1212
lockfile: "../../mix.lock",
13-
elixir: ">= 1.7.0",
13+
elixir: ">= 1.8.0",
1414
build_embedded: false,
1515
start_permanent: false,
1616
build_per_environment: false,

apps/elixir_ls_utils/test/support/mix_test.case.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ defmodule ElixirLS.Utils.MixTest.Case do
139139
# FIXME: Private API
140140
defp clear_mix_cache do
141141
module =
142-
if Version.match?(System.version(), ">= 1.10.0-rc.0") do
142+
if Version.match?(System.version(), ">= 1.10.0") do
143143
Mix.State
144144
else
145145
Mix.ProjectStack

apps/language_server/lib/language_server/build.ex

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,7 @@ defmodule ElixirLS.LanguageServer.Build do
1111
{us, _} =
1212
:timer.tc(fn ->
1313
IO.puts("MIX_ENV: #{Mix.env()}")
14-
15-
if function_exported?(Mix, :target, 0) do
16-
# Even though we know we have the function here,
17-
# Compilation will fail calling Mix.target/0 directly
18-
# since Elixir 1.7 is used to compile - So we get around
19-
# that with apply/3
20-
IO.puts("MIX_TARGET: #{apply(Mix, :target, [])}")
21-
end
14+
IO.puts("MIX_TARGET: #{Mix.target()}")
2215

2316
prev_deps = cached_deps()
2417
:ok = Mix.Project.clear_deps_cache()

apps/language_server/lib/language_server/dialyzer.ex

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,35 +25,20 @@ defmodule ElixirLS.LanguageServer.Dialyzer do
2525
# Client API
2626

2727
def check_support do
28-
otp_release = String.to_integer(System.otp_release())
29-
{compiled_with, _} = System.build_info() |> Map.fetch!(:otp_release) |> Integer.parse()
28+
_otp_release = String.to_integer(System.otp_release())
29+
{_compiled_with, _} = System.build_info() |> Map.fetch!(:otp_release) |> Integer.parse()
3030

3131
cond do
32-
otp_release < 20 ->
33-
{:error,
34-
"Dialyzer integration requires Erlang OTP 20 or higher (Currently OTP #{otp_release})"}
35-
3632
not Code.ensure_loaded?(:dialyzer) ->
3733
{:error,
3834
"The current Erlang installation does not include Dialyzer. It may be available as a " <>
3935
"separate package."}
4036

41-
otp_release >= 21 and compiled_with < 20 ->
42-
{:error,
43-
"Dialyzer in Erlang/OTP versions >= 21 requires Elixir to have been compiled with an " <>
44-
"Erlang/OTP version >= 20, but current Elixir was compiled with " <>
45-
"version #{compiled_with}"}
46-
4737
not dialyzable?(System) ->
4838
{:error,
4939
"Dialyzer is disabled because core Elixir modules are missing debug info. " <>
5040
"You may need to recompile Elixir with Erlang >= OTP 20"}
5141

52-
Version.match?(System.version(), "1.7.0") ->
53-
{:error,
54-
"Dialyzer is disabled in Elixir v1.7.0 due to a bug in Dialyzer. " <>
55-
"Upgrade Elixir to >= v1.7.1 to enable"}
56-
5742
true ->
5843
:ok
5944
end

apps/language_server/lib/language_server/server.ex

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -723,19 +723,19 @@ defmodule ElixirLS.LanguageServer.Server do
723723
end
724724

725725
defp show_version_warnings do
726-
unless Version.match?(System.version(), ">= 1.7.0") do
726+
unless Version.match?(System.version(), ">= 1.8.0") do
727727
JsonRpc.show_message(
728728
:warning,
729-
"Elixir versions below 1.7 are not supported. (Currently v#{System.version()})"
729+
"Elixir versions below 1.8 are not supported. (Currently v#{System.version()})"
730730
)
731731
end
732732

733733
otp_release = String.to_integer(System.otp_release())
734734

735-
if otp_release < 20 do
735+
if otp_release < 21 do
736736
JsonRpc.show_message(
737737
:info,
738-
"Erlang OTP releases below 20 are not supported (Currently OTP #{otp_release})"
738+
"Erlang OTP releases below 21 are not supported (Currently OTP #{otp_release})"
739739
)
740740
end
741741

@@ -796,16 +796,7 @@ defmodule ElixirLS.LanguageServer.Server do
796796
defp maybe_set_mix_target(state, nil), do: state
797797

798798
defp maybe_set_mix_target(state, target) do
799-
if Version.match?(System.version(), ">= 1.8.0") do
800-
set_mix_target(state, target)
801-
else
802-
JsonRpc.show_message(
803-
:warning,
804-
"MIX_TARGET was set, but it requires Elixir >= 1.8.0. This setting will be ignored"
805-
)
806-
807-
state
808-
end
799+
set_mix_target(state, target)
809800
end
810801

811802
defp set_mix_target(state, target) do
@@ -814,10 +805,7 @@ defmodule ElixirLS.LanguageServer.Server do
814805
prev_target = state.settings["mixTarget"]
815806

816807
if is_nil(prev_target) or target == prev_target do
817-
# We've already checked for Elixir >= 1.8.0 by this point
818-
# but compilation will fail if we just call Mix.target/0
819-
# so we get around that via apply/3
820-
apply(Mix, :target, [String.to_atom(target)])
808+
Mix.target(String.to_atom(target))
821809
else
822810
JsonRpc.show_message(:warning, "You must restart ElixirLS after changing Mix target")
823811
end

apps/language_server/mix.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ defmodule ElixirLS.LanguageServer.Mixfile do
55
[
66
app: :language_server,
77
version: "0.5.0",
8-
elixir: ">= 1.7.0",
8+
elixir: ">= 1.8.0",
99
build_path: "../../_build",
1010
config_path: "../../config/config.exs",
1111
deps_path: "../../deps",

0 commit comments

Comments
 (0)