Skip to content

Commit

Permalink
feat: support new 2.13 artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
ckipp01 committed Mar 9, 2022
1 parent 06c9e0c commit 249318a
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
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)

0 comments on commit 249318a

Please sign in to comment.