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

feat: support new 2.13 artifacts #346

Merged
merged 1 commit into from
Mar 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions lua/metals/install.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,14 @@ local function install_or_update(sync)
return true
end

local server_version = config.settings.metals.serverVersion or "latest.release"
local latestStable = "latest.release"
local server_version = config.settings.metals.serverVersion or latestStable
local binary_version = "2.12"
-- TODO When we release 0.11.3 we need to change this to:
-- if server_version == latestStable or server_version > "0.11.2" then
if server_version ~= latestStable and server_version > "0.11.2" then
binary_version = "2.13"
end

local server_org = config.settings.metals.serverOrg or "org.scalameta"

Expand All @@ -42,7 +49,7 @@ local function install_or_update(sync)
"-Xss4m",
"--java-opt",
"-Xms100m",
string.format("%s:metals_2.12:%s", server_org, server_version),
string.format("%s:metals_%s:%s", server_org, binary_version, server_version),
"-r",
"bintray:scalacenter/releases",
"-r",
Expand Down
12 changes: 11 additions & 1 deletion tests/setup/install_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe("install", function()
eq(path:exists(), true)
end)

it("should be able to install with a snapshot", function()
it("should be able to install with an old 2.12 snapshot", function()
local bare_config = require("metals.setup").bare_config()
bare_config.settings = { serverVersion = "0.10.9+131-30f6a57b-SNAPSHOT" }
config.validate_config(bare_config, vim.api.nvim_get_current_buf())
Expand All @@ -31,4 +31,14 @@ describe("install", function()
install.install_or_update(true)
eq(path:exists(), true)
end)

it("should be able to install with a new 2.13 snapshot", function()
local bare_config = require("metals.setup").bare_config()
bare_config.settings = { serverVersion = "0.11.2+3-105f3501-SNAPSHOT" }
config.validate_config(bare_config, vim.api.nvim_get_current_buf())

eq(path:exists(), false)
install.install_or_update(true)
eq(path:exists(), true)
end)
end)