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

add PackageCompile project and compilation script #695

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions contrib/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
JuliaLSP_compiled
8 changes: 8 additions & 0 deletions contrib/JuliaLSP/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name = "JuliaLSP"
uuid = "9488cb22-ff86-4d62-8f4a-077fe1791049"
authors = ["Matsievskiy S.V. <matsievskiysv@gmail.com>"]
version = "0.1.0"

[deps]
LanguageServer = "2b0e0bc5-e4fd-59b4-8912-456d1b03d8d7"
SymbolServer = "cf896787-08d5-524d-9de7-132aaa0cb996"
4 changes: 4 additions & 0 deletions contrib/JuliaLSP/precompile_app.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
using JuliaLSP

push!(ARGS, "arg")
JuliaLSP.julia_main()
12 changes: 12 additions & 0 deletions contrib/JuliaLSP/src/JuliaLSP.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module JuliaLSP

using LanguageServer, LanguageServer.SymbolServer

function julia_main()::Cint
server = LanguageServer.LanguageServerInstance(stdin, stdout)
server.runlinter = true
run(server)
return 0 # if things finished successfully
end

end # module
63 changes: 63 additions & 0 deletions contrib/compile.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/usr/bin/env bash

JULIABIN="julia"
JULIAPROJ="JuliaLSP"
JULIACOMP="JuliaLSP_compiled"

REPO="https://github.com/julia-vscode/LanguageServer.jl"
BRANCH="master"

HL='\033[1;4;31m'
NC='\033[0m'

errorexit() {
echo -e ${HL}"$@"${NC}
exit 1
}

while [[ $# -gt 0 ]]
do
key="$1"

case $key in
-j|--julia)
JULIABIN="$2"
shift
;;
-b|--branch)
BRANCH="$2"
shift
;;
-r|--repo)
REPO="$2"
shift
;;
*)
echo -e "Usage:\ncompile.sh [-j|--julia <julia binary>] [-b|--branch <repo branch>]" >&2
exit
;;
esac
shift
done

echo -e ${HL}Updating packages${NC}

$JULIABIN --project=${JULIAPROJ} --startup-file=no --history-file=no -e \
"import Pkg;
Pkg.add(Pkg.PackageSpec(url=\"${REPO}\", rev=\"${BRANCH}\"));
Pkg.update();" || errorexit Cannot update packages

echo -e ${HL}Compiling...${NC}

# Additional libs are needed for running tests
$JULIABIN --startup-file=no --history-file=no -e \
"import Pkg;
Pkg.add(\"PackageCompiler\")
Pkg.add([\"Test\", \"Sockets\", \"CSTParser\", \"StaticLint\", \"JSON\", \"JSONRPC\"])
using PackageCompiler;
Pkg.activate(\"${JULIAPROJ}\");
create_app(\"${JULIAPROJ}\", \"${JULIACOMP}\",
force=true, precompile_execution_file=\"../test/runtests.jl\");" \
|| errorexit Cannot compile packages

echo -e ${HL}Compiled${NC}