Skip to content

Commit 35b2912

Browse files
committed
移除extension-path,因为已经有官方支持了
1 parent 6f98ba2 commit 35b2912

File tree

6 files changed

+8
-127
lines changed

6 files changed

+8
-127
lines changed

.vscode/extensions.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"recommendations": [
33
"actboy168.tasks",
4-
"actboy168.extension-path",
54
"actboy168.lua-debug"
65
]
76
}

.vscode/launch.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
"console": "integratedTerminal",
99
"luaVersion": "lua-latest",
1010
"windows": {
11-
"luaexe": "${command:extensionPath}actboy168.lua-debug-2.0.12-win32-x64/bin/lua-debug.exe"
11+
"luaexe": "${extensionInstallFolder:actboy168.lua-debug}/bin/lua-debug.exe"
1212
},
1313
"linux": {
14-
"luaexe": "${command:extensionPath}actboy168.lua-debug-2.0.12-linux-x64/bin/lua-debug",
14+
"luaexe": "${extensionInstallFolder:actboy168.lua-debug}/bin/lua-debug",
1515
},
1616
"osx": {
17-
"luaexe": "${command:extensionPath}actboy168.lua-debug-2.0.12-darwin-arm64/bin/lua-debug",
17+
"luaexe": "${extensionInstallFolder:actboy168.lua-debug}/bin/lua-debug",
1818
},
1919
"outputCapture": [
2020
],
@@ -34,7 +34,7 @@
3434
"--extensionDevelopmentPath=${workspaceFolder}/extension/"
3535
],
3636
"env": {
37-
"VSCODE_EXTENSION_PATH" : "${command:extensionPath}actboy168.lua-debug-2.0.12"
37+
"VSCODE_EXTENSION_PATH" : "${extensionInstallFolder:actboy168.lua-debug}"
3838
}
3939
}
4040
]

.vscode/tasks.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@
3232
"lua",
3333
"compile/copy.lua",
3434
"extension",
35-
"extension",
36-
"${command:extensionPath}"
35+
"${extensionInstallFolder:actboy168.lua-debug}"
3736
]
3837
},
3938
{
@@ -43,8 +42,7 @@
4342
"lua",
4443
"compile/copy.lua",
4544
"publish",
46-
"publish",
47-
"${command:extensionPath}"
45+
"${extensionInstallFolder:actboy168.lua-debug}"
4846
]
4947
}
5048
]

compile/common/make.lua

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ lm:copy 'copy_bootstrap' {
1010
outputs = 'publish/bin/main.lua',
1111
}
1212

13-
lm:runlua 'update_version' {
14-
script = 'compile/update_version.lua',
15-
}
16-
1713
lm:runlua 'package_json' {
1814
script = 'compile/common/write_json.lua',
1915
args = {'$in', '$out', lm.platform},
@@ -31,7 +27,6 @@ lm:phony 'common' {
3127
'copy_json',
3228
'copy_bootstrap',
3329
'copy_extension',
34-
'update_version',
3530
'package_json',
3631
}
3732
}

compile/copy.lua

Lines changed: 2 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,7 @@
1-
package.path = package.path ..";3rd/json.lua/?.lua"
1+
package.path = package.path..";3rd/json.lua/?.lua"
22

33
local fs = require 'bee.filesystem'
44
local OS = require 'bee.platform'.os
5-
local json = require "json"
6-
7-
local function readall(filename)
8-
local f <close> = assert(io.open(filename, 'rb'))
9-
return f:read 'a'
10-
end
11-
12-
local function getExtensionDirName(packageDir)
13-
local package = assert(json.decode(readall(packageDir .. '/package.json')))
14-
local publisher = package.publisher
15-
local name = package.name
16-
local version = package.version
17-
if not publisher then
18-
error 'Cannot found `publisher` in package.json.'
19-
end
20-
if not name then
21-
error 'Cannot found `name` in package.json.'
22-
end
23-
if not version then
24-
error 'Cannot found `version` in package.json.'
25-
end
26-
return ('%s.%s-%s'):format(publisher,name,version)
27-
end
285

296
local function crtdll(path)
307
if path:find("api-ms-win-", 1, true) then
@@ -66,57 +43,7 @@ local function copy_directory(from, to, filter)
6643
end
6744
end
6845

69-
local function what_arch()
70-
if OS == "windows" then
71-
if os.getenv "PROCESSOR_ARCHITECTURE" == "ARM64" then
72-
return "arm64"
73-
end
74-
if os.getenv "PROCESSOR_ARCHITECTURE" == "AMD64" or os.getenv "PROCESSOR_ARCHITEW6432" == "AMD64" then
75-
return "x64"
76-
end
77-
return "ia32"
78-
end
79-
local f <close> = assert(io.popen("uname -m", 'r'))
80-
return f:read 'l':lower()
81-
end
82-
83-
local function detectPlatform(extensionPath, extensionDirName)
84-
local extensionDirPrefix = fs.path(extensionPath) / extensionDirName
85-
local function guess(platform)
86-
local extensionDir = extensionDirPrefix..platform
87-
if fs.exists(extensionDir / "package.json") then
88-
return extensionDir
89-
end
90-
end
91-
local arch = what_arch()
92-
if OS == "windows" then
93-
local r = guess '-win32-x64'
94-
if r then return r end
95-
elseif OS == "linux" then
96-
if arch == "x86_64" then
97-
local r = guess '-linux-x64'
98-
if r then return r end
99-
elseif arch == "aarch64" then
100-
local r = guess '-linux-arm64'
101-
if r then return r end
102-
end
103-
elseif OS == "macos" then
104-
if arch == "arm64" then
105-
local r = guess '-darwin-arm64'
106-
if r then return r end
107-
end
108-
local r = guess '-darwin-x64'
109-
if r then return r end
110-
end
111-
local r = guess ''
112-
if r then return r end
113-
error("`" .. extensionDirPrefix:string() .. "` is not installed.")
114-
end
115-
116-
local packageDir,sourceDir,extensionPath = ...
117-
local extensionDirName = getExtensionDirName(packageDir)
118-
local extensionDir = detectPlatform(extensionPath, extensionDirName)
119-
46+
local sourceDir, extensionDir = ...
12047
local sourceDir = fs.path(sourceDir)
12148
copy_directory(sourceDir, extensionDir, function (path)
12249
local ext = path:extension()

compile/update_version.lua

Lines changed: 0 additions & 38 deletions
This file was deleted.

0 commit comments

Comments
 (0)