diff options
author | 最萌小汐 <sumneko@hotmail.com> | 2019-11-27 15:07:41 +0800 |
---|---|---|
committer | 最萌小汐 <sumneko@hotmail.com> | 2019-11-27 15:07:41 +0800 |
commit | 535dfc3f9de2064a76608915aa85fe2486fb51bb (patch) | |
tree | 14421ffb253982569649046b8de86d94ada63084 /make | |
parent | 44ffd4ec7e08f232f7ac16856695b7f409423e2d (diff) | |
download | lua-language-server-535dfc3f9de2064a76608915aa85fe2486fb51bb.zip |
修改make
Diffstat (limited to 'make')
-rw-r--r-- | make/copy.lua | 66 | ||||
-rw-r--r-- | make/install.lua | 13 |
2 files changed, 7 insertions, 72 deletions
diff --git a/make/copy.lua b/make/copy.lua deleted file mode 100644 index df7c2de4..00000000 --- a/make/copy.lua +++ /dev/null @@ -1,66 +0,0 @@ -local fs = require 'bee.filesystem' -local pf = require 'bee.platform' - -local function getExtensionDirName(packageDir) - local publisher,name,version - for line in io.lines(packageDir .. '/package.json') do - if not publisher then - publisher = line:match('"publisher": "([^"]+)"') - end - if not name then - name = line:match('"name": "([^"]+)"') - end - if not version then - version = line:match('"version": "(%d+%.%d+%.%d+)"') - end - end - if not publisher then - error 'Cannot found `publisher` in package.json.' - end - if not name then - error 'Cannot found `name` in package.json.' - end - if not version then - error 'Cannot found `version` in package.json.' - end - return ('%s.%s-%s'):format(publisher,name,version) -end - -local function copy_directory(from, to, filter) - fs.create_directories(to) - for fromfile in from:list_directory() do - if fs.is_directory(fromfile) then - copy_directory(fromfile, to / fromfile:filename(), filter) - else - if (not filter) or filter(fromfile) then - print('copy', fromfile, to / fromfile:filename()) - fs.copy_file(fromfile, to / fromfile:filename(), true) - end - end - end -end - -local extensionPath = ... -local packageDir = "." -local sourceDir = fs.path(".") -local extensionDirName = getExtensionDirName(packageDir) -local extensionDir = fs.path(extensionPath) / extensionDirName -if not fs.exists(extensionDir) then - io.stderr:write("ERROR: `" .. extensionDir:string() .. "` is not installed.\n") - return -end - -local binDir = extensionDir / "server" / pf.OS / "bin" -local bakDir = extensionDir / "server" / "bak" - -if fs.exists(binDir) then - if pcall(fs.remove_all, bakDir) then - fs.rename(binDir, bakDir) - else - fs.remove_all(binDir) - end -end - -copy_directory(sourceDir / "server" / pf.OS / "bin", binDir) - -print 'ok' diff --git a/make/install.lua b/make/install.lua index 4ea31eaa..515264cc 100644 --- a/make/install.lua +++ b/make/install.lua @@ -9,20 +9,21 @@ local bindir = CWD / 'build' / platform / 'bin' local exe = platform == 'msvc' and ".exe" or "" local dll = platform == 'msvc' and ".dll" or ".so" -fs.create_directories(output) -fs.copy_file(bindir / 'lni'..dll, output / 'lni'..dll, true) -fs.copy_file(bindir / 'lpeglabel'..dll, output / 'lpeglabel'..dll, true) -fs.copy_file(bindir / 'bee'..dll, output / 'bee'..dll, true) -fs.copy_file(bindir / 'lua'..exe, output / 'lua-language-server'..exe, true) - local bootstrap = CWD / "3rd" / "bee.lua" / "bootstrap" fs.copy_file(bootstrap / "main.lua", CWD / 'build' / "main.lua", true) fs.copy_file(bindir / ('bee'..dll), CWD / 'build' / ('bee'..dll), true) fs.copy_file(bindir / ('bootstrap'..exe), CWD / 'build' / ('bootstrap'..exe), true) +fs.copy_file(bindir / 'lua'..exe, CWD / 'build' / ('lua'..exe), true) if platform == 'msvc' then fs.copy_file(bindir / 'lua54.dll', CWD / 'build' / 'lua54.dll', true) end +fs.create_directories(output) +fs.copy_file(bindir / 'lni'..dll, output / 'lni'..dll, true) +fs.copy_file(bindir / 'lpeglabel'..dll, output / 'lpeglabel'..dll, true) +fs.copy_file(bindir / 'bee'..dll, output / 'bee'..dll, true) +fs.copy_file(bindir / 'lua'..exe, output / 'lua-language-server'..exe, true) + if platform == 'msvc' then fs.copy_file(bindir / 'lua54'..dll, output / 'lua54'..dll, true) require 'msvc'.copy_crtdll('x64', output) |