-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpack.ps1
67 lines (53 loc) · 1.66 KB
/
pack.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
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
param (
[string]$Configuration = "Release",
[string]$Output = "dist",
[switch]$Help
)
if ($Help)
{
echo "Usage: pack.ps1 [-configuration CONFIGURATION] [-output OUTPUT FOLDER]"
exit 0
}
$Projects = "Core", "TreasureSolver";
echo "> Packing projects: $Projects"
echo "> Output path: $Output"
if (Test-Path -Path $Output)
{
echo "Cleaning output folder $Output..."
rm $Output -r -force
}
echo "Creating output folder $Output..."
$null = md $Output
$InteropFolder = "src/Interop";
$InteropDlls = Get-ChildItem "$InteropFolder/*.dll" | % { Split-Path $_ -leaf }
echo "Found $( $InteropDlls.Length ) interop DLLs."
foreach ($Project in $Projects)
{
echo "Packing project $Project..."
$OtherProjects = $Projects | Where-Object { $_ -ne $Project }
$OtherProjectsDll = $OtherProjects | % { "DofusBatteriesIncluded.Plugins.$_.dll" }
$Dir = Join-Path $Output $Project
$null = MkDir $Dir -Force
foreach ($File in Get-ChildItem "src/$Project/bin/$Configuration/net6.0/publish/*.dll")
{
$Filename = Split-Path $File -leaf
if ( $InteropDlls.Contains($Filename))
{
continue;
}
if ( $OtherProjectsDll.Contains($Filename))
{
continue;
}
echo "Copying $File to $Dir..."
copy $File $Dir
}
$ResourcesFolder = "src/$Project/bin/$Configuration/net6.0/publish/Resources"
if (Test-Path $ResourcesFolder) {
copy "$ResourcesFolder" $Dir -Recurse
}
$RuntimesFolder = "src/$Project/bin/$Configuration/net6.0/publish/runtimes/win-x64"
if (Test-Path $RuntimesFolder) {
copy "$RuntimesFolder/**/*.dll" $Dir -Recurse
}
}