This repository has been archived by the owner on Jan 4, 2025. It is now read-only.
forked from Dofus-Batteries-Included/DDC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pack.ps1
65 lines (51 loc) · 1.67 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
param (
[string]$Configuration = "Release",
[string]$Output = "dist",
[switch]$Help
)
if ($Help)
{
echo "Usage: pack.ps1 [-configuration CONFIGURATION] [-output OUTPUT FOLDER]"
exit 0
}
$Projects = "DDC.Extractor";
echo "> Packing projects: $Projects"
echo "> Configuration: $Configuration"
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 = "Interop";
$InteropDlls = Get-ChildItem "$InteropFolder/*.dll" | % { Split-Path $_ -leaf } | % { $_.ToLowerInvariant() }
$Exceptions = @("newtonsoft.json.dll")
echo "Found $( $InteropDlls.Length ) interop DLLs."
foreach ($Project in $Projects)
{
echo "Packing project $Project..."
$OtherProjects = $Projects | Where-Object { $_ -ne $Project }
$Dir = Join-Path $Output $Project
$null = MkDir $Dir -Force
foreach ($File in Get-ChildItem "$Project/bin/$Configuration/net6.0/publish/*.dll")
{
$Filename = Split-Path $File -leaf
$FilenameLower = $Filename.ToLowerInvariant()
if (-not $Exceptions.Contains($FilenameLower) -and $InteropDlls.Contains($FilenameLower))
{
continue;
}
echo "Copying $File to $Dir..."
copy $File $Dir
}
$ResourcesFolder = "$Project/bin/$Configuration/net6.0/publish/Resources"
if (Test-Path $ResourcesFolder) {
copy "$ResourcesFolder" $Dir -Recurse
}
$RuntimesFolder = "$Project/bin/$Configuration/net6.0/publish/runtimes/win-x64"
if (Test-Path $RuntimesFolder) {
copy "$RuntimesFolder/**/*.dll" $Dir -Recurse
}
}