Skip to content
Snippets Groups Projects
Commit 7d1a60df authored by actboy168's avatar actboy168
Browse files

安装脚本

parent 55ec1070
No related branches found
No related tags found
No related merge requests found
{
"recommendations": [
"actboy168.extension-path",
]
}
\ No newline at end of file
......@@ -5,6 +5,28 @@
"type": "shell",
"label": "编译",
"command": "cd 3rd\\luamake && tools\\ninja -f ninja\\msvc.ninja && cd ..\\.. && 3rd\\luamake\\luamake rebuild"
},
{
"label": "Copy Extension",
"command": "${workspaceFolder}/build/lua",
"args": [
"make/copy.lua",
"${command:extensionPath}"
],
"type": "shell",
"windows": {
"options": {
"shell": {
"executable": "C:\\Windows\\System32\\cmd.exe",
"args": [
"/c"
]
}
}
},
"options": {
"cwd": "${workspaceFolder}"
},
}
]
}
\ No newline at end of file
......@@ -44,6 +44,7 @@ lm:build 'install' {
'lni',
'lpeglabel',
'bee',
'bootstrap',
platform.OS == "Windows" and "rcedit"
}
}
......
local fs = require 'bee.filesystem'
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
error(extensionDir .. "is not installed.")
end
if pcall(fs.remove_all, extensionDir / "server" / "bin-bak") then
fs.rename(extensionDir / "server" / "bin", extensionDir / "server" / "bin-bak")
else
fs.remove_all(extensionDir / "server" / "bin")
end
copy_directory(sourceDir / "server" / "bin", extensionDir / "server" / "bin")
print 'ok'
......@@ -14,6 +14,14 @@ 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' / ('lua'..exe), true)
if platform == 'msvc' then
fs.copy_file(bindir / 'lua54.dll', CWD / 'build' / 'lua54.dll', true)
end
if platform == 'msvc' then
fs.copy_file(bindir / 'lua54'..dll, output / 'lua54'..dll, true)
require 'msvc'.copy_crtdll('x64', output)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment