forked from natinusala/borealis
-
Notifications
You must be signed in to change notification settings - Fork 10
/
uwp.lua
95 lines (89 loc) · 2.22 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
local outPath = "build/demo.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(), path.filename(target:targetfile())},
}
local target_pdb = path.join(target:targetdir(), path.basename(target:targetfile())..".pdb")
if os.exists(target_pdb) then
table.insert(files, {target_pdb, path.filename(target_pdb)})
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.execv("makepri", {
"createconfig",
"-Overwrite",
"/cf",
priconfigPath,
"/dq",
"en-US"
})
os.execv("makepri", {
"new",
"-Overwrite",
"/pr",
"winrt",
"/cf",
priconfigPath,
"-OutputFile",
priPath
})
os.execv("makeappx", {
"pack",
"/l",
"/h",
"SHA256",
"/f",
fileMapPath,
"/m",
"build/AppxManifest.xml",
"/o",
"/p",
outPath
})
os.execv("signtool", {
"sign",
"/fd",
"SHA256",
"/a",
"/f",
keyPath,
outPath
})
end