aboutsummaryrefslogtreecommitdiffstats
path: root/lua/mason-registry/index/smithy-language-server/init.lua
blob: cef679c567c5944c1c24a34511ffe4ac90304dc0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
local Pkg = require "mason-core.package"
local _ = require "mason-core.functional"
local fs = require "mason-core.fs"
local git = require "mason-core.managers.git"
local path = require "mason-core.path"

return Pkg.new {
    name = "smithy-language-server",
    desc = "A Language Server Protocol implementation for the Smithy IDL.",
    homepage = "https://github.com/awslabs/smithy-language-server",
    languages = { Pkg.Lang.Smithy },
    categories = { Pkg.Cat.LSP },
    ---@async
    ---@param ctx InstallContext
    install = function(ctx)
        git.clone({ "https://github.com/awslabs/smithy-language-server" }).with_receipt()
        ctx:promote_cwd()
        ctx.spawn.gradlew {
            "build",
            with_paths = { ctx.cwd:get() },
        }

        local version = _.trim(ctx.fs:read_file "VERSION")

        ctx:link_bin(
            "smithy-language-server",
            ctx:write_shell_exec_wrapper(
                "smithy-language-server",
                ("java -jar %q"):format(path.concat {
                    ctx.package:get_install_path(),
                    "build",
                    "libs",
                    ("smithy-language-server-%s.jar"):format(version),
                })
            )
        )
    end,
}