Repository navigation
Expand file tree
/
Copy pathflutter.lua
More file actions
59 lines (52 loc) · 1.87 KB
/
Copy pathflutter.lua
File metadata and controls
59 lines (52 loc) · 1.87 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
-- flutter: live crawl of the per-platform Flutter release manifests
-- (ported from vcollector official/flutter.go).
local C = dofile(__vmr_plugin_dir .. "/_vmr_common.lua")
plugin_name = "flutter"
sdk_name = "flutter"
plugin_version = "0.1"
homepage = "https://flutter.dev/"
ic = C.installer({
flag_files = {
windows = { "README.md", "LICENSE", "CODEOWNERS" },
darwin = { "README.md", "LICENSE", "CODEOWNERS" },
linux = { "README.md", "LICENSE", "CODEOWNERS" },
},
binary_dirs = {
windows = { { "bin" } },
darwin = { { "bin" } },
linux = { { "bin" } },
},
})
local RELEASES_URL = "https://storage.googleapis.com/flutter_infra_release/releases/releases_%s.json"
local PLATFORMS = {
{ "linux", "linux" },
{ "macos", "darwin" },
{ "windows", "windows" },
}
local ARCH_MAP = { x64 = "amd64", arm64 = "arm64" }
function crawl()
local vl = vmrNewVersionList()
for _, platform in ipairs(PLATFORMS) do
local resp = vmrGetResponse(vmrSprintf(RELEASES_URL, { platform[1] }), 300, {})
local root = vmrInitGJson(resp)
local base = vmrGetString(root, "base_url")
vmrSliceEach(root, "releases", function(_, release)
local arch = ARCH_MAP[vmrGetString(release, "dart_sdk_arch")]
if arch then
local sum = vmrGetString(release, "sha256")
vmrAddItem(vl, vmrGetString(release, "version"), {
url = vmrUrlJoin(base, vmrGetString(release, "archive")),
arch = arch,
os = platform[2],
sum = sum,
sum_type = (sum ~= "") and "sha256" or "",
size = 0,
installer = vmrInstallerUnarchiver,
lts = "",
extra = "",
})
end
end)
end
return vl
end