Skip to content

Commit 4e39536

Browse files
author
Matsievskiy S.V
committed
Add PackageCompiler project and compilation script
This PR adds script for package compilation into binary
1 parent 131557f commit 4e39536

File tree

5 files changed

+88
-0
lines changed

5 files changed

+88
-0
lines changed

contrib/.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
JuliaLSP_compiled

contrib/JuliaLSP/Project.toml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name = "JuliaLSP"
2+
uuid = "9488cb22-ff86-4d62-8f4a-077fe1791049"
3+
authors = ["Matsievskiy S.V. <matsievskiysv@gmail.com>"]
4+
version = "0.1.0"
5+
6+
[deps]
7+
LanguageServer = "2b0e0bc5-e4fd-59b4-8912-456d1b03d8d7"
8+
SymbolServer = "cf896787-08d5-524d-9de7-132aaa0cb996"

contrib/JuliaLSP/precompile_app.jl

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
using JuliaLSP
2+
3+
push!(ARGS, "arg")
4+
JuliaLSP.julia_main()

contrib/JuliaLSP/src/JuliaLSP.jl

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module JuliaLSP
2+
3+
using LanguageServer, LanguageServer.SymbolServer
4+
5+
function julia_main()::Cint
6+
server = LanguageServer.LanguageServerInstance(stdin, stdout)
7+
server.runlinter = true
8+
run(server)
9+
return 0 # if things finished successfully
10+
end
11+
12+
end # module

contrib/compile.sh

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/usr/bin/env bash
2+
3+
JULIABIN="julia"
4+
JULIAPROJ="JuliaLSP"
5+
JULIACOMP="JuliaLSP_compiled"
6+
7+
REPO="https://github.com/julia-vscode/LanguageServer.jl"
8+
BRANCH="master"
9+
10+
HL='\033[1;4;31m'
11+
NC='\033[0m'
12+
13+
errorexit() {
14+
echo -e ${HL}"$@"${NC}
15+
exit 1
16+
}
17+
18+
while [[ $# -gt 0 ]]
19+
do
20+
key="$1"
21+
22+
case $key in
23+
-j|--julia)
24+
JULIABIN="$2"
25+
shift
26+
;;
27+
-b|--branch)
28+
BRANCH="$2"
29+
shift
30+
;;
31+
-r|--repo)
32+
REPO="$2"
33+
shift
34+
;;
35+
*)
36+
echo -e "Usage:\ncompile.sh [-j|--julia <julia binary>] [-b|--branch <repo branch>]" >&2
37+
exit
38+
;;
39+
esac
40+
shift
41+
done
42+
43+
echo -e ${HL}Updating packages${NC}
44+
45+
$JULIABIN --project=${JULIAPROJ} --startup-file=no --history-file=no -e \
46+
"import Pkg;
47+
Pkg.add(Pkg.PackageSpec(url=\"${REPO}\", rev=\"${BRANCH}\"));
48+
Pkg.update();" || errorexit Cannot update packages
49+
50+
echo -e ${HL}Compiling...${NC}
51+
52+
# Additional libs are needed for running tests
53+
$JULIABIN --startup-file=no --history-file=no -e \
54+
"import Pkg;
55+
Pkg.add(\"PackageCompiler\")
56+
Pkg.add([\"Test\", \"Sockets\", \"CSTParser\", \"StaticLint\", \"JSON\", \"JSONRPC\"])
57+
using PackageCompiler;
58+
Pkg.activate(\"${JULIAPROJ}\");
59+
create_app(\"${JULIAPROJ}\", \"${JULIACOMP}\",
60+
force=true, precompile_execution_file=\"../test/runtests.jl\");" \
61+
|| errorexit Cannot compile packages
62+
63+
echo -e ${HL}Compiled${NC}

0 commit comments

Comments
 (0)