-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.ps1
32 lines (25 loc) · 1.41 KB
/
build.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
if (-Not $PSScriptRoot) {
return 'Run this script from the root of the project'
}
Push-Location $PSScriptRoot
dotnet clean
dotnet restore
$moduleLibFolder = Join-Path $PSScriptRoot 'Module' 'lib'
if (-Not (Test-Path $moduleLibFolder)) {
$null = New-Item -ItemType Directory -Path $moduleLibFolder -Force
}
$csproj = Get-Item (Join-Path $PSScriptRoot 'src' 'PSTextMate.csproj')
$outputfolder = Join-Path $PSScriptRoot 'packages'
if (-Not (Test-Path -Path $outputfolder)) {
$null = New-Item -ItemType Directory -Path $outputfolder -Force
}
dotnet publish $csproj.FullName -c Release -o $outputfolder
Get-ChildItem -Path $moduleLibFolder -File | Remove-Item -Force
Get-ChildItem -Path (Join-Path $outputfolder 'runtimes' 'win-x64' 'native') -Filter *.dll | Move-Item -Destination $moduleLibFolder -Force
Get-ChildItem -Path (Join-Path $outputfolder 'runtimes' 'osx' 'native') -Filter *.dylib | Move-Item -Destination $moduleLibFolder -Force
Get-ChildItem -Path (Join-Path $outputfolder 'runtimes' 'linux-x64' 'native') -Filter *.so | Copy-Item -Destination $moduleLibFolder -Force
Move-Item (Join-Path $outputfolder 'PSTextMate.dll') -Destination (Split-Path $moduleLibFolder) -Force
Get-ChildItem -Path $outputfolder -File |
Where-Object { -Not $_.Name.StartsWith('System.Text') -And $_.Extension -notin '.json','.pdb' } |
Move-Item -Destination $moduleLibFolder -Force
Pop-Location