commit
4124536852
4 changed files with 19 additions and 14 deletions
|
@ -6,24 +6,25 @@ using Pkg
|
||||||
# add LanguageServer.jl
|
# add LanguageServer.jl
|
||||||
Pkg.add("LanguageServer")
|
Pkg.add("LanguageServer")
|
||||||
|
|
||||||
# add dependencies of LanguageServer.jl
|
# add PackageCompiler.jl
|
||||||
pkg_ls = Pkg.project().dependencies["LanguageServer"]
|
Pkg.add("PackageCompiler")
|
||||||
pkg_ls_deps = Pkg.dependencies()[pkg_ls].dependencies |> keys
|
|
||||||
foreach(Pkg.add, pkg_ls_deps)
|
|
||||||
|
|
||||||
# add extra dependencies
|
# add extra dependencies
|
||||||
# these packages are manually collected
|
# these packages are manually collected
|
||||||
pkg_extra = ["Logging", "Sockets", "DataStructures", "Tar", "ArgTools", "Dates", "Downloads", "TOML"]
|
pkg_extra = ["Logging", "Sockets", "DataStructures", "Tar", "ArgTools", "Dates", "Downloads", "TOML", "JSONRPC", "SymbolServer"]
|
||||||
foreach(Pkg.add, pkg_extra)
|
Pkg.add(pkg_extra)
|
||||||
@info "dependency added"
|
@info "added dependencies"
|
||||||
|
|
||||||
|
# Extra package to be executed in precompiled code
|
||||||
|
pkg_precompiled = []
|
||||||
|
|
||||||
# save pkgs to be used for precompile functions with traced script
|
# save pkgs to be used for precompile functions with traced script
|
||||||
out_path = joinpath(Pkg.project().path |> dirname, "precompile_exec_head.jl")
|
out_path = joinpath(Pkg.project().path |> dirname, "precompile_exec_head.jl")
|
||||||
@info "writing $(out_path)"
|
@info "writing $(out_path)"
|
||||||
open(out_path, "w") do io
|
open(out_path, "w") do io
|
||||||
println(io, "using LanguageServer")
|
println(io, "using LanguageServer")
|
||||||
println(io, "using " * join(pkg_ls_deps, ", "))
|
|
||||||
println(io, "using " * join(pkg_extra, ", "))
|
println(io, "using " * join(pkg_extra, ", "))
|
||||||
|
# println(io, "using " * join(pkg_precompiled, ", "))
|
||||||
if Sys.iswindows()
|
if Sys.iswindows()
|
||||||
println(io, "import FileWatching")
|
println(io, "import FileWatching")
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,7 +5,8 @@ if !ispath(project_path)
|
||||||
@info "Created $(project_path)"
|
@info "Created $(project_path)"
|
||||||
touch(joinpath(project_path, "tracecompile.jl"))
|
touch(joinpath(project_path, "tracecompile.jl"))
|
||||||
end
|
end
|
||||||
cmd = `julia --project=$(project_path) $(@__DIR__)/add_dependencies.jl`
|
|
||||||
@info cmd
|
using Pkg
|
||||||
run(cmd)
|
Pkg.activate(project_path)
|
||||||
|
include("$(@__DIR__)/add_dependencies.jl")
|
||||||
|
|
||||||
|
|
|
@ -2,14 +2,17 @@
|
||||||
project_path = joinpath(homedir(), ".julia", "environments", "nvim-lspconfig")
|
project_path = joinpath(homedir(), ".julia", "environments", "nvim-lspconfig")
|
||||||
cd(project_path) do
|
cd(project_path) do
|
||||||
@info "now at " pwd()
|
@info "now at " pwd()
|
||||||
run(`julia --project=. -e 'using Pkg; Pkg.update()'`)
|
using Pkg
|
||||||
|
Pkg.activate(".")
|
||||||
|
Pkg.update()
|
||||||
compile_traces = Iterators.filter(eachline("tracecompile.jl")) do line
|
compile_traces = Iterators.filter(eachline("tracecompile.jl")) do line
|
||||||
# Remove anonymous functions from compile trace
|
# Remove anonymous functions from compile trace
|
||||||
!startswith(line, '#') && !occursin(r"\#\d+\#\d+", line) && !occursin(r"\#\#printstyled\#", line)
|
!startswith(line, '#') && !occursin(r"\#\d+\#\d+", line) && !occursin(r"\#\#printstyled\#", line)
|
||||||
end |> join
|
end |> join
|
||||||
read("precompile_exec_head.jl", String) * compile_traces |> (b -> write("precompile_exec.jl", b))
|
read("precompile_exec_head.jl", String) * compile_traces |> (b -> write("precompile_exec.jl", b))
|
||||||
@info "compiling sysimage..."
|
@info "compiling sysimage..."
|
||||||
run(`julia --project=. -e 'using PackageCompiler; create_sysimage(["LanguageServer"], sysimage_path = "sys-ls.so", precompile_execution_file = ["precompile_exec.jl"])'`)
|
using PackageCompiler;
|
||||||
|
create_sysimage(["LanguageServer"], sysimage_path = "sys-ls.so", precompile_execution_file = ["precompile_exec.jl"])'
|
||||||
@info "post precompile"
|
@info "post precompile"
|
||||||
run(`julia --project=. -J sys-ls.so -e 'using Pkg; Pkg.precompile()'`)
|
run(`julia --project=. -J sys-ls.so -e 'using Pkg; Pkg.precompile()'`)
|
||||||
end
|
end
|
||||||
|
|
|
@ -686,7 +686,7 @@ lspconfig.julials.setup {
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
cmd = { "julia", "--startup-file=no", "--history-file=no",
|
cmd = { "julia", "--startup-file=no", "--history-file=no",
|
||||||
julials_so_option[1], julials_so_option[2],
|
-- julials_so_option[1], julials_so_option[2],
|
||||||
-- use below 2 lines to collect script to be included in sysimage
|
-- use below 2 lines to collect script to be included in sysimage
|
||||||
-- '--trace-compile',
|
-- '--trace-compile',
|
||||||
-- vim.env.HOME .. "/.julia/environments/nvim-lspconfig/tracecompile.jl",
|
-- vim.env.HOME .. "/.julia/environments/nvim-lspconfig/tracecompile.jl",
|
||||||
|
|
Loading…
Add table
Reference in a new issue