summaryrefslogtreecommitdiff
path: root/osx.sh
blob: 1a1e21e6071495f3a84fcd9a733b084e54032db8 (plain)
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
#!/bin/bash

set -e

MY_DIR=$(cd "$(dirname $0)";pwd)
INSTALL_PATH=`find ~/.vscode/extensions -name "sumneko.lua-*" | sort -r | head -1`

cd $MY_DIR

echo "updating submodule ..."
git submodule -q update --recursive --init

echo "build luamake ..."
cd 3rd/luamake
ninja -f ninja/macos.ninja
cd -

echo "build binary ..."
./3rd/luamake/luamake

if [ -d "$INSTALL_PATH" ]; then
    echo "Try to install lua-language-server for you:"
    cp -R server/bin "${INSTALL_PATH}/server"

    echo "Test ..."
    cp server/test.lua "${INSTALL_PATH}/server"
    ${INSTALL_PATH}/server/bin/lua-language-server ${INSTALL_PATH}/server/test.lua
    rm ${INSTALL_PATH}/server/test.lua

    echo "installed."
    echo "please restart VScode and enjoy."
else
    echo "Test ..."
    ./server/bin/lua-language-server ./server/publish.lua

    echo "please install sumneko Lua in VScode Marketplace first."
fi
echo "Done."