-
Notifications
You must be signed in to change notification settings - Fork 0
/
prepare_artifacts.ps1
41 lines (32 loc) · 1.33 KB
/
prepare_artifacts.ps1
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
param(
# Name of plugin to pack
[Parameter(Mandatory = $true)]
[string] $pluginName,
# Workspace path to use
[Parameter(Mandatory = $true)]
[string] $workspacePath,
# Binary files path pattern to use '$' is replaced with assembly/project name
[Parameter(Mandatory = $false)]
[string] $binPathPattern = "/$/bin/Release/net48/$",
# Additional dependencies to pack
[Parameter(Mandatory = $false)]
[string[]] $dependencies = @(),
# Additional includes to pack
[Parameter(Mandatory = $false)]
[string[]] $includes = @()
)
# Prepare artifacts
New-Item -ItemType Directory -Force -Path D:/a/plugin/Artifacts
Copy-Item "$workspacePath/$binPathPattern.dll".Replace("$", $pluginName) -Destination D:/a/plugin/Artifacts
if ($dependencies.Length -gt 0 -or $includes.Length -gt 0) {
$files = New-Object System.Collections.Generic.List[string]
if ($dependencies.Length -gt 0) {
$dependencies = $dependencies | ForEach-Object -Process { "$workspacePath/$binPathPattern.dll".Replace("$", $_) }
$files.AddRange($dependencies)
}
if ($includes.Length -gt 0) {
$includes = $includes | ForEach-Object -Process { "$workspacePath/$_" }
$files.AddRange($includes)
}
Compress-Archive $files.ToArray() -DestinationPath D:/a/plugin/Artifacts/dependencies.zip
}