-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuild-App.ps1
More file actions
66 lines (56 loc) · 2.41 KB
/
Build-App.ps1
File metadata and controls
66 lines (56 loc) · 2.41 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
60
61
62
63
64
65
66
<#
.DESCRIPTION
Downloads specified source via 'download.ps1' and packages app after confirming the Content Prep Tool is available.
.PARAMETER URIOverride
Optional URL Override instead of whats already specified in 'download.ps1'
.PARAMETER ShowDownloadProgress
Displays Progress Bar for file download.
#>
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSReviewUnusedParameter', '', Justification = 'argument completer')]
param(
[Parameter(Mandatory, ParameterSetName = 'Name', Position = 1)]
[ValidateNotNullOrEmpty()]
[ArgumentCompleter({
param($Command, $Parameter, $WordToComplete, $CommandAst, $FakeBoundParams)
switch($Parameter){
'AppName' {
$AppsDirectory = Join-Path $PSScriptRoot '../Apps'
$Apps = Get-ChildItem -Path $AppsDirectory -Directory -Exclude '_template' -ErrorAction Stop | ForEach-Object { $_.Name }
$Apps | Where-Object { $_ -like "$WordToComplete*" } | ForEach-Object { "'$_'" } | Sort-Object
}
Default {}
}
})]
[string]$AppName,
[Parameter(ParameterSetName = 'Name', Position = 2)]
[uri]$URIOverride,
[Parameter(ParameterSetName = 'All')]
[switch]$All = $false
)
$template = '_template'
if($AppName -eq $template){
throw "You can't package the template app - Try an App name from '\Apps' instead!"
}
$RepoRoot = Join-Path $PSScriptRoot '../'
$AppsDirectory = Join-Path $RepoRoot 'Apps'
$PackagerDownloader = Join-Path $PSScriptRoot 'Download-IntuneWinAppUtil.ps1'
if($All){
$AppsToPackageRoot = Get-ChildItem -Path $AppsDirectory -Directory -Exclude $template -ErrorAction Stop
} else {
$AppsToPackageRoot = Get-Item (Join-Path $AppsDirectory -ChildPath $AppName) -ErrorAction Stop
}
## Download Intune Packager Tool if not found
$Packager = (Join-Path $RepoRoot 'IntuneWinAppUtil.exe')
& $PackagerDownloader
$AppsToPackageRoot | ForEach-Object {
Write-Output "-- Packaging '$($_.Name)' --"
$AppSource = Get-Item (Join-Path $_ -ChildPath 'source') -ErrorAction Stop
$OutFolder = Get-Item $_.FullName -ErrorAction Stop
$SourceDownloader = Get-Item (Join-Path $_ 'download.ps1') -ErrorAction Stop
$Override = @{}
if (-not [string]::IsNullOrEmpty($URIOverride)) {
$Override.Uri = $URIOverride
}
$SetupFile = & $SourceDownloader @Override
& $Packager -c $AppSource.FullName -s $SetupFile -o $OutFolder.FullName -q
}