dsh-ipa-build 1.3.0 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/scripts/ipa.ps1 CHANGED
@@ -17,15 +17,126 @@ if (-not (Test-Path $zsign)) {
17
17
  if (Test-Path $vendored) { $zsign = $vendored }
18
18
  }
19
19
  if ($env:IPA_ZSIGN) { $zsign = $env:IPA_ZSIGN }
20
+ # 工具链自己的环境变量文件,bootstrap 写在这里(不动用户持久 PATH)
21
+ $envFile = Join-Path $tc 'env.ps1'
22
+ if ((Test-Path $envFile) -and -not $env:IPA_NO_ENV) { . $envFile }
20
23
 
21
24
  function Die($m) { Write-Host $m; exit 1 }
22
25
 
23
- function Read-Plist($app) {
26
+ function Test-Bplist($path) {
27
+ if (-not (Test-Path $path)) { return $false }
28
+ $fs = [IO.File]::OpenRead($path)
29
+ try {
30
+ $b = New-Object byte[] 6
31
+ $fs.Read($b, 0, 6) | Out-Null
32
+ return ([Text.Encoding]::ASCII.GetString($b) -eq 'bplist')
33
+ } finally { $fs.Dispose() }
34
+ }
35
+
36
+ # 按偏移读一小段,不把整个可执行文件塞进内存
37
+ function Read-At($fs, $off, $len) {
38
+ $b = New-Object byte[] $len
39
+ $fs.Position = $off
40
+ $n = $fs.Read($b, 0, $len)
41
+ if ($n -lt $len) { return $null }
42
+ return ,$b
43
+ }
44
+
45
+ function Cpu-Name($v) {
46
+ switch ($v) {
47
+ 16777228 { 'arm64' }
48
+ 16777223 { 'x86_64' }
49
+ 12 { 'armv7' }
50
+ 7 { 'i386' }
51
+ 16777222 { 'arm64_32' }
52
+ default { '?' }
53
+ }
54
+ }
55
+
56
+ # 解析 LC_CODE_SIGNATURE 和签名 SuperBlob:有 CMS 才是真证书签名
57
+ function Get-SigState($fs, $off) {
58
+ $h = Read-At $fs $off 32
59
+ if ($h -eq $null) { return '没签' }
60
+ $mg = [BitConverter]::ToUInt32($h, 0)
61
+ if ($mg -eq 4277009103) { $hsz = 32 } elseif ($mg -eq 4277009102) { $hsz = 28 } else { return '没签' }
62
+ $ncmds = [BitConverter]::ToUInt32($h, 16)
63
+ $sizeofcmds = [BitConverter]::ToUInt32($h, 20)
64
+ if ($ncmds -gt 4096 -or $sizeofcmds -gt 1048576) { return '没签' }
65
+ $cmds = Read-At $fs ($off + $hsz) $sizeofcmds
66
+ if ($cmds -eq $null) { return '没签' }
67
+ $sigoff = -1
68
+ $pos = 0
69
+ for ($i = 0; $i -lt $ncmds; $i++) {
70
+ if ($pos + 8 -gt $sizeofcmds) { break }
71
+ $cmd = [BitConverter]::ToUInt32($cmds, $pos)
72
+ $size = [BitConverter]::ToUInt32($cmds, $pos + 4)
73
+ if ($size -lt 8) { break }
74
+ if ($cmd -eq 29 -and $pos + 16 -le $sizeofcmds) { $sigoff = [BitConverter]::ToUInt32($cmds, $pos + 8) }
75
+ $pos += $size
76
+ }
77
+ if ($sigoff -lt 0) { return '没签' }
78
+ $sb = Read-At $fs $sigoff 12
79
+ if ($sb -eq $null -or [BitConverter]::ToUInt32($sb, 0) -ne 4208856256) { return '没签' }
80
+ $cnt = [BitConverter]::ToUInt32($sb, 4)
81
+ if ($cnt -gt 20) { $cnt = 20 }
82
+ $idx = Read-At $fs ($sigoff + 8) ($cnt * 8)
83
+ if ($idx -eq $null) { return '没签' }
84
+ for ($i = 0; $i -lt $cnt; $i++) {
85
+ if ([BitConverter]::ToUInt32($idx, $i * 8) -eq 0x10000) { return '真证书签名(有 CMS)' }
86
+ }
87
+ return 'ad-hoc 伪签名(只有 CodeDirectory)'
88
+ }
89
+
90
+ # fat binary 的 offset 4 是 nfat_arch,不是 cputype
91
+ function Get-MachReport($path) {
92
+ $fs = $null
93
+ try { $fs = [IO.File]::OpenRead($path) } catch { return @('读不了', '读不了', 0) }
94
+ try {
95
+ $h = Read-At $fs 0 32
96
+ if ($h -eq $null) { return @('?', '读不了', (Get-Item $path).Length) }
97
+ $magic = [BitConverter]::ToUInt32($h, 0)
98
+ $archs = @()
99
+ $sig = '没签'
100
+ if ($magic -eq 4277009102 -or $magic -eq 4277009103) {
101
+ $archs += (Cpu-Name ([BitConverter]::ToUInt32($h, 4)))
102
+ $sig = Get-SigState $fs 0
103
+ } elseif ($magic -eq 3405691582 -or $magic -eq 3405691583) {
104
+ $nfat = [BitConverter]::ToUInt32($h, 4)
105
+ if ($nfat -gt 20) { $nfat = 0 }
106
+ $entSize = if ($magic -eq 3405691583) { 32 } else { 20 }
107
+ for ($i = 0; $i -lt $nfat; $i++) {
108
+ $e = Read-At $fs (8 + $i * $entSize) $entSize
109
+ if ($e -eq $null) { continue }
110
+ $archs += (Cpu-Name ([BitConverter]::ToUInt32($e, 0)))
111
+ $off = if ($entSize -eq 32) { [BitConverter]::ToUInt64($e, 8) } else { [BitConverter]::ToUInt32($e, 8) }
112
+ $st = Get-SigState $fs $off
113
+ if ($st -ne '没签') { $sig = $st }
114
+ }
115
+ } else {
116
+ $archs += '不是 Mach-O'
117
+ }
118
+ $archLabel = ($archs -join '+')
119
+ if ($archLabel -eq '') { $archLabel = '?' }
120
+ if ($archs.Count -gt 1) { $archLabel = "$archLabel(fat)" }
121
+ return @($archLabel, $sig, (Get-Item $path).Length)
122
+ } finally { if ($fs) { $fs.Dispose() } }
123
+ }
124
+
125
+ # $argv[1..0] 在 PowerShell 里会倒序取出 @($null, $argv[0]),后面 $null.StartsWith 直接崩
126
+ function Rest($a) {
127
+ if ($a.Count -gt 1) { return @($a[1..($a.Count - 1)]) }
128
+ return @()
129
+ }
130
+
131
+ function Read-Plist($app, [switch]$Strict) {
24
132
  $p = Join-Path $app 'Info.plist'
25
133
  if (-not (Test-Path $p)) { return $null }
26
134
  $b = [IO.File]::ReadAllBytes($p)
27
135
  if ($b.Length -gt 6 -and [Text.Encoding]::ASCII.GetString($b, 0, 6) -eq 'bplist') {
28
- return $null # 二进制 plist,这回不动它
136
+ # Xcode 产出的 Info.plist 基本都是 bplist,读不了就不能装作读到了:
137
+ # 改不动字段却照样改可执行文件名,包会起不来。宁可在这里停下。
138
+ if ($Strict) { Die "Info.plist 是二进制格式(bplist),这里改不了字段。先在 macOS 上 plutil -convert xml1 转成 XML,或者不带 --bundle-id/--name/--version 直接 pack。" }
139
+ return $null
29
140
  }
30
141
  try { return [xml](Get-Content $p -Raw -Encoding UTF8) } catch { return $null }
31
142
  }
@@ -46,13 +157,21 @@ function Get-Value($pl, $key) {
46
157
 
47
158
  function Set-Value($pl, $key, $value) {
48
159
  if ($pl -eq $null) { return }
49
- $nodes = $pl.plist.dict.ChildNodes
160
+ $dict = $pl.plist.dict
161
+ $nodes = $dict.ChildNodes
50
162
  for ($i = 0; $i -lt $nodes.Count - 1; $i++) {
51
163
  if ($nodes[$i].Name -eq 'key' -and $nodes[$i].InnerText -eq $key) {
52
164
  $v = $nodes[$i + 1]
53
- if ($v.Name -eq 'string') { $v.InnerText = $value }
165
+ if ($v.Name -eq 'string') { $v.InnerText = $value; return }
54
166
  }
55
167
  }
168
+ # plist 里没有这个键就补上,不然 --name / --version 会静默不生效
169
+ $k = $pl.CreateElement('key')
170
+ $k.InnerText = $key
171
+ $v = $pl.CreateElement('string')
172
+ $v.InnerText = $value
173
+ $dict.AppendChild($k) | Out-Null
174
+ $dict.AppendChild($v) | Out-Null
56
175
  }
57
176
 
58
177
  function Get-Exe($app) {
@@ -68,8 +187,8 @@ function Get-Exe($app) {
68
187
  $b = New-Object byte[] 8
69
188
  $fs.Read($b, 0, 8) | Out-Null
70
189
  $fs.Close()
71
- $m = [BitConverter]::ToUInt32($b, 0)
72
- if ($m -eq 4277009103 -or $m -eq 4277009102 -or $m -eq 3199925962) { return $f.Name }
190
+ $m = [BitConverter]::ToUInt32($b, 0) # 64/32 位 Mach-O、fat 的魔数:64/32 位 Mach-O 或 fat
191
+ if ($m -eq 4277009103 -or $m -eq 4277009102 -or $m -eq 3405691582 -or $m -eq 3405691583 -or $m -eq 3199925962) { return $f.Name }
73
192
  }
74
193
  return $null
75
194
  }
@@ -81,6 +200,13 @@ function Find-App($dir) {
81
200
  }
82
201
 
83
202
  function Zip-Dir($src, $out) {
203
+ # .NET 的 CreateFromDirectory 不认符号链接,会把链接展开成整份文件副本。
204
+ # .app 里带 framework 符号链接时包里会多出一堆重复文件,这里先说清楚
205
+ $links = Get-ChildItem $src -Recurse -Force -ErrorAction SilentlyContinue |
206
+ Where-Object { $_.Attributes -band [IO.FileAttributes]::ReparsePoint }
207
+ if ($links) {
208
+ Write-Host "包里有 $($links.Count) 个符号链接,Windows 打包会展开成副本(结构能用但体积偏大)。要严格保留链接请在 macOS 上用 scripts/ipa"
209
+ }
84
210
  $parent = Split-Path -Parent $out
85
211
  if ($parent -and -not (Test-Path $parent)) { New-Item -ItemType Directory -Path $parent -Force | Out-Null }
86
212
  if (Test-Path $out) { Remove-Item $out -Force }
@@ -90,7 +216,7 @@ function Zip-Dir($src, $out) {
90
216
 
91
217
  # 有 p12 就走真证书签名(zsign -k / -m / -p),没有就走 -a ad-hoc。
92
218
  # 真证书签名 zsign 会联网查 OCSP 吊销状态,离线时可能变慢或告警,这是它本来行为。
93
- function Sign-Ipa($in, $out, $p12, $prov, $pass) {
219
+ function Sign-Ipa($in, $out, $p12, $prov, $pass, $ent) {
94
220
  if (-not (Test-Path $zsign)) { Die "没有 zsign.exe,先跑 scripts\bootstrap.ps1" }
95
221
  $parent = Split-Path -Parent $out
96
222
  if ($parent -and -not (Test-Path $parent)) { New-Item -ItemType Directory -Path $parent -Force | Out-Null }
@@ -102,6 +228,10 @@ function Sign-Ipa($in, $out, $p12, $prov, $pass) {
102
228
  if (-not (Test-Path $prov)) { Die "找不到描述文件: $prov" }
103
229
  $a = @('-k', (Resolve-Path $p12).Path, '-m', (Resolve-Path $prov).Path)
104
230
  if ($pass) { $a += @('-p', $pass) }
231
+ if ($ent) {
232
+ if (-not (Test-Path $ent)) { Die "找不到 entitlements 文件: $ent" }
233
+ $a += @('-e', (Resolve-Path $ent).Path)
234
+ }
105
235
  $a += @('-o', $out, $in)
106
236
  } else {
107
237
  if ($prov) { Write-Host "只有描述文件没有 p12,还是按伪签处理" }
@@ -110,6 +240,7 @@ function Sign-Ipa($in, $out, $p12, $prov, $pass) {
110
240
 
111
241
  # 直接用调用运算符传数组,PowerShell 会给带空格的参数自己加引号;
112
242
  # Start-Process 是把数组拼成一行再交给系统,密码里有空格就被拆成两个参数了
243
+ if ($pass) { Write-Host "提示:--password 会留在命令历史和进程列表里,建议改用环境变量 IPA_CERT_PASSWORD" }
113
244
  & $zsign @a
114
245
  if ($LASTEXITCODE -ne 0 -or -not (Test-Path $out)) {
115
246
  if ($p12) { Die "zsign 签名失败,退出码 $LASTEXITCODE。常见原因是 p12 密码不对,或者 bundle id 跟描述文件对不上。" }
@@ -188,36 +319,39 @@ function Cmd-Info($path) {
188
319
  $app = $found.FullName
189
320
  }
190
321
  $pl = Read-Plist $app
322
+ $exe = Get-Exe $app
191
323
  Write-Host "位置 $path"
192
- Write-Host "可执行 $(Get-Exe $app)"
324
+ Write-Host "可执行 $exe"
193
325
  Write-Host "标识符 $(Get-Value $pl 'CFBundleIdentifier')"
194
326
  Write-Host "版本 $(Get-Value $pl 'CFBundleShortVersionString') build $(Get-Value $pl 'CFBundleVersion')"
195
327
  Write-Host "最低系统 $(Get-Value $pl 'MinimumOSVersion')"
196
- $exe = Get-Exe $app
328
+ $iplist = Join-Path $app 'Info.plist'
329
+ if ($pl -eq $null -and (Test-Bplist $iplist)) {
330
+ Write-Host "plist 是二进制格式(bplist),字段读不出来。要看字段先在 macOS 上 plutil -convert xml1 转成 XML"
331
+ }
197
332
  if ($exe -ne $null) {
198
333
  $bin = Join-Path $app $exe
199
- $bytes = [IO.File]::ReadAllBytes($bin)
200
- $cpu = [BitConverter]::ToInt32($bytes, 4)
201
- $arch = '?'
202
- if ($cpu -eq 16777228) { $arch = 'arm64' }
203
- if ($cpu -eq 12) { $arch = 'armv7' }
204
- if ($cpu -eq 16777223) { $arch = 'x86_64' }
205
- Write-Host "架构 Mach-O $arch"
206
- Write-Host ("大小 " + [math]::Round($bytes.Length / 1KB) + " KB")
207
- $hasSig = $false
208
- $text = [Text.Encoding]::ASCII.GetString($bytes)
209
- if ($text.Contains('CodeDirectory')) { $hasSig = $true }
210
- Write-Host ("签名 " + $(if ($hasSig) { '有 CodeDirectory' } else { '没签' }))
334
+ $rep = Get-MachReport $bin
335
+ Write-Host "架构 $($rep[0])"
336
+ Write-Host "签名 $($rep[1])"
337
+ Write-Host ("大小 " + [math]::Round($rep[2] / 1KB) + " KB")
211
338
  }
212
339
  if (Test-Path (Join-Path $app '_CodeSignature')) { Write-Host "签名目录 有 _CodeSignature" }
213
340
  if ($tmp -ne $null) { Remove-Item $tmp -Recurse -Force -ErrorAction SilentlyContinue }
214
341
  }
215
342
 
343
+ # 密码:命令行的照收,但没有就用环境变量,省得进 shell 历史
344
+ function Get-Pass($opt) {
345
+ $p = Opt $opt @('--password', '--pass') $null
346
+ if (-not $p) { $p = $env:IPA_CERT_PASSWORD }
347
+ return $p
348
+ }
349
+
216
350
  function Cmd-Pack($argv) {
217
351
  if ($argv.Count -eq 0) { Die "用法: ipa.ps1 pack 某.app [-o 输出.ipa] [--bundle-id ...] [--p12 证书 --prov 描述文件 --password 密码]" }
218
352
  $src = $argv[0]
219
353
  if (-not (Test-Path $src)) { Die "没有这个路径: $src" }
220
- $opt = Opts @($argv[1..($argv.Count - 1)])
354
+ $opt = Opts @(Rest $argv)
221
355
 
222
356
  $work = Join-Path ([IO.Path]::GetTempPath()) ('pack_' + [guid]::NewGuid().ToString('N'))
223
357
  $payload = Join-Path $work 'Payload'
@@ -232,7 +366,8 @@ function Cmd-Pack($argv) {
232
366
  $bid = Opt $opt @('--bundle-id') $null
233
367
  $name = Opt $opt @('--name') $null
234
368
  $ver = Opt $opt @('--version') $null
235
- $pl = Read-Plist $app
369
+ $pl = $null
370
+ if ($bid -or $name -or $ver) { $pl = Read-Plist $app -Strict }
236
371
  if ($pl -ne $null) {
237
372
  if ($bid) { Set-Value $pl 'CFBundleIdentifier' $bid }
238
373
  if ($name) {
@@ -263,7 +398,7 @@ function Cmd-Pack($argv) {
263
398
  $tmp = Join-Path ([IO.Path]::GetTempPath()) ('pack_' + [guid]::NewGuid().ToString('N') + '.ipa')
264
399
  Zip-Dir $work $tmp
265
400
  if (Test-Path $zsign) {
266
- Sign-Ipa $tmp $out (Opt $opt @('--p12') $null) (Opt $opt @('--prov') $null) (Opt $opt @('--password', '--pass') $null)
401
+ Sign-Ipa $tmp $out (Opt $opt @('--p12') $null) (Opt $opt @('--prov') $null) (Get-Pass $opt) (Opt $opt @('--entitlements') $null)
267
402
  } else {
268
403
  Copy-Item $tmp $out -Force
269
404
  Write-Host "没有 zsign,包出来了但没签名"
@@ -278,7 +413,7 @@ function Cmd-Resign($argv) {
278
413
  $src = $argv[0]
279
414
  if (-not (Test-Path $src)) { Die "没有这个路径: $src" }
280
415
  if (-not (Test-Path $zsign)) { Die "没有 zsign.exe,先跑 scripts\bootstrap.ps1" }
281
- $opt = Opts @($argv[1..($argv.Count - 1)])
416
+ $opt = Opts @(Rest $argv)
282
417
 
283
418
  $in = $src
284
419
  if ($src -like '*.app') {
@@ -295,7 +430,7 @@ function Cmd-Resign($argv) {
295
430
  $tmp = Join-Path ([IO.Path]::GetTempPath()) ('bid_' + [guid]::NewGuid().ToString('N'))
296
431
  [IO.Compression.ZipFile]::ExtractToDirectory($in, $tmp)
297
432
  $a = Find-App (Join-Path $tmp 'Payload')
298
- $pl = Read-Plist $a.FullName
433
+ $pl = Read-Plist $a.FullName -Strict
299
434
  if ($pl -ne $null) {
300
435
  Set-Value $pl 'CFBundleIdentifier' $bid
301
436
  $pl.Save((Join-Path $a.FullName 'Info.plist'))
@@ -307,14 +442,20 @@ function Cmd-Resign($argv) {
307
442
  $out = Opt $opt @('-o', '--out') $null
308
443
  if (-not $out) {
309
444
  $leaf = [IO.Path]::GetFileNameWithoutExtension((Split-Path -Leaf $src))
310
- $out = Join-Path (Get-Location) "dist/${leaf}_signed.ipa"
445
+ $out = Join-Path (Get-Location) "dist/${leaf}_resigned.ipa"
311
446
  }
312
- Sign-Ipa $in $out (Opt $opt @('--p12') $null) (Opt $opt @('--prov') $null) (Opt $opt @('--password', '--pass') $null)
447
+ Sign-Ipa $in $out (Opt $opt @('--p12') $null) (Opt $opt @('--prov') $null) (Get-Pass $opt) (Opt $opt @('--entitlements') $null)
313
448
  Write-Host "产物 $out"
314
449
  }
315
450
 
316
451
  # WSL 里拼命令,每个参数单独用单引号包住,带空格的路径不会被拆开
317
- function Q($s) { "'" + ($s -replace "'", "'\\''") + "'" }
452
+ function Q($s) {
453
+ # 单引号里的撇号要写成 '\'' 这一串(关引号、转义撇号、重开引号),
454
+ # 用 Replace 拼,别用 -replace 的替换串,那边反斜杠和引号会被吃掉
455
+ $bs = [char]92
456
+ $q = [char]39
457
+ return $q + $s.Replace([string]$q, [string]$q + $bs + [string]$q + [string]$q) + $q
458
+ }
318
459
 
319
460
  function To-WslPath($p) {
320
461
  $s = $p -replace '\\', '/'
@@ -326,7 +467,7 @@ function Cmd-Build($argv) {
326
467
  if ($argv.Count -eq 0) { Die "用法: ipa.ps1 build 源码目录 --name 名字 --bundle-id com.a.b [--p12 证书 --prov 描述文件 --password 密码]" }
327
468
  $src = $argv[0]
328
469
  if (-not (Test-Path $src)) { Die "没有这个目录: $src" }
329
- $opt = Opts @($argv[1..($argv.Count - 1)])
470
+ $opt = Opts @(Rest $argv)
330
471
 
331
472
  $clang = Get-Command clang.exe -ErrorAction SilentlyContinue
332
473
  $lld = Get-Command ld64.lld.exe -ErrorAction SilentlyContinue
@@ -336,10 +477,26 @@ function Cmd-Build($argv) {
336
477
  $wsl = Get-Command wsl.exe -ErrorAction SilentlyContinue
337
478
  if ($wsl -ne $null) {
338
479
  Write-Host "本机没 clang,交给 WSL 编"
480
+ & wsl.exe bash -lc 'test -d "$HOME/.ipa-toolchain"'
481
+ if ($LASTEXITCODE -ne 0) {
482
+ Die "WSL 里还没铺过环境(那是 WSL 自己的 home,跟 Windows 这份不共用)。先在 WSL 里跑一次 bash scripts/bootstrap.sh,或者直接跑 scripts\bootstrap.ps1 把本机编译器装上。"
483
+ }
339
484
  $parts = @('bash', (Q (Join-Path $here 'ipa')), 'build', (Q (To-WslPath (Resolve-Path $src).Path)))
340
- foreach ($a in $argv[1..($argv.Count - 1)]) {
341
- if ($a -match '^[A-Za-z]:\\' -or $a -match '^\.\w') { $parts += (Q (To-WslPath $a)) }
342
- else { $parts += (Q $a) }
485
+ # 路径参数一律换到 /mnt/...,不然产物落在 WSL 的 home 里,用户在 Windows 目录找不到
486
+ $pathOpts = @('-o', '--out', '--icon', '--entitlements', '--p12', '--prov')
487
+ $expectPath = $false
488
+ foreach ($a in @(Rest $argv)) {
489
+ $looksPath = (Test-Path $a) -or ($a -match '^[A-Za-z]:') -or ($a -match '[/\\]')
490
+ if (-not $a.StartsWith('-') -and ($expectPath -or $looksPath)) {
491
+ $full = $a
492
+ if (Test-Path $a) { $full = (Resolve-Path $a).Path }
493
+ elseif (-not [IO.Path]::IsPathRooted($a)) { $full = Join-Path (Get-Location) $a }
494
+ $parts += (Q (To-WslPath $full))
495
+ $expectPath = $false
496
+ continue
497
+ }
498
+ $parts += (Q $a)
499
+ $expectPath = ($pathOpts -contains $a)
343
500
  }
344
501
  $cmd = $parts -join ' '
345
502
  & wsl.exe bash -lc $cmd
@@ -382,7 +539,7 @@ function Cmd-Build($argv) {
382
539
  $out = Opt $opt @('-o', '--out') $null
383
540
  if (-not $out) { $out = Join-Path (Get-Location) "dist/$name.ipa" }
384
541
  if (Test-Path $zsign) {
385
- Sign-Ipa $pre $out (Opt $opt @('--p12') $null) (Opt $opt @('--prov') $null) (Opt $opt @('--password', '--pass') $null)
542
+ Sign-Ipa $pre $out (Opt $opt @('--p12') $null) (Opt $opt @('--prov') $null) (Get-Pass $opt) (Opt $opt @('--entitlements') $null)
386
543
  } else { Copy-Item $pre $out; Write-Host "没签名,只是打了个包" }
387
544
  Remove-Item $pre -Force -ErrorAction SilentlyContinue
388
545
  Write-Host "产物 $out"
@@ -401,9 +558,9 @@ if ($args.Count -eq 0) {
401
558
 
402
559
  switch ($args[0]) {
403
560
  'doctor' { Cmd-Doctor }
404
- 'info' { Cmd-Info $args[1] }
405
- 'build' { Cmd-Build @($args[1..($args.Count - 1)]) }
406
- 'pack' { Cmd-Pack @($args[1..($args.Count - 1)]) }
407
- 'resign' { Cmd-Resign @($args[1..($args.Count - 1)]) }
561
+ 'info' { if ($args.Count -gt 1) { Cmd-Info $args[1] } else { Cmd-Info $null } }
562
+ 'build' { Cmd-Build @(Rest $args) }
563
+ 'pack' { Cmd-Pack @(Rest $args) }
564
+ 'resign' { Cmd-Resign @(Rest $args) }
408
565
  default { Write-Host "不认识的命令: $($args[0])"; exit 1 }
409
566
  }
@@ -6,8 +6,12 @@
6
6
  <key>CFBundleName</key><string>@NAME@</string>
7
7
  <key>CFBundleDisplayName</key><string>@NAME@</string>
8
8
  <key>CFBundlePackageType</key><string>APPL</string>
9
+ <key>CFBundleInfoDictionaryVersion</key><string>6.0</string>
10
+ <key>CFBundleSupportedPlatforms</key><array><string>iPhoneOS</string></array>
11
+ <key>LSRequiresIPhoneOS</key><true/>
9
12
  <key>CFBundleShortVersionString</key><string>1.0</string>
10
13
  <key>CFBundleVersion</key><string>1</string>
11
14
  <key>MinimumOSVersion</key><string>@MINIOS@</string>
12
15
  <key>UIDeviceFamily</key><array><integer>1</integer><integer>2</integer></array>
16
+ <key>UILaunchScreen</key><dict/>
13
17
  </dict></plist>
@@ -2,8 +2,13 @@
2
2
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
3
  <plist version="1.0">
4
4
  <dict>
5
- <key>get-task-allow</key><true/>
5
+ <!-- 调试用,ad-hoc 签名时最常用;正式分发要删掉 -->
6
+ <key>get-task-allow</key>
7
+ <true/>
8
+ <!-- 下面两条是越狱环境的高权限私有 entitlement,默认不开。
9
+ 要调试系统级进程时才放开,放开前先想清楚包会被谁装:
6
10
  <key>platform-application</key><true/>
7
11
  <key>com.apple.private.security.no-container</key><true/>
12
+ -->
8
13
  </dict>
9
14
  </plist>