-
Notifications
You must be signed in to change notification settings - Fork 164
/
uwp.lua
101 lines (96 loc) · 2.31 KB
/
uwp.lua
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
local outPath = "build/wiliwili.msix"
local keyPath = "winrt/key.pfx"
local priconfigPath = "build/priconfig.xml"
local fileMapPath = "build/main.map.txt"
local priPath = "build/resources.pri"
function findsdk()
local find_vstudio = import("detect.sdks.find_vstudio")
for _, vsinfo in pairs(find_vstudio()) do
if vsinfo.vcvarsall then
return vsinfo.vcvarsall[os.arch()]
end
end
end
function main(target)
local files = {
{priPath, "resources.pri"},
{target:targetfile(), "wiliwili.exe"},
}
local d = {}
local debugs = {
path.join(target:targetdir(), "wiliwili.pdb"),
path.join(target:targetdir(), "wiliwili.ilk"),
}
for _, f in ipairs(debugs) do
if os.exists(f) then
local k = path.filename(f)
table.insert(files, {f, k})
end
end
for _, pkg in pairs(target:pkgs()) do
if pkg:has_shared() then
for _, f in ipairs(pkg:libraryfiles()) do
if f:endswith(".dll") then
table.insert(files, {f, path.filename(f)})
end
end
end
end
for _, f in ipairs(os.files("winrt/Assets/**")) do
table.insert(files, {f, string.sub(f, 7)})
end
for _, f in ipairs(os.files("resources/**")) do
table.insert(files, {f, f})
end
local file = io.open(fileMapPath, "w")
file:write([[
[ResourceMetadata]
"ResourceDimensions" "language-en-US"
[Files]
]])
for _, ff in ipairs(files) do
file:write(format('"%s"\t\t"%s"\n', ff[1], ff[2]))
end
file:close()
os.setenv("PATH", findsdk()["PATH"])
os.vexecv("makepri", {
"createconfig",
"-Overwrite",
"/cf",
priconfigPath,
"/dq",
"en-US"
})
os.vexecv("makepri", {
"new",
"-Overwrite",
"/pr",
"winrt",
"/cf",
priconfigPath,
"-OutputFile",
priPath
})
os.vexecv("makeappx", {
"pack",
"/l",
"/h",
"SHA256",
"/f",
fileMapPath,
"/m",
"build/AppxManifest.xml",
"/o",
"/p",
outPath
})
os.vexecv("signtool", {
"sign",
"/fd",
"SHA256",
"/a",
"/f",
keyPath,
outPath
})
end