mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-08 12:18:50 +02:00
Merge appveor build script and visual studio build script into one
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
param([string]$config, [string]$solution)
|
||||||
|
Write-Host "Current config is $config"
|
||||||
|
|
||||||
function Build-Version {
|
function Build-Version {
|
||||||
if ([string]::IsNullOrEmpty($env:APPVEYOR_BUILD_VERSION)) {
|
if ([string]::IsNullOrEmpty($env:APPVEYOR_BUILD_VERSION)) {
|
||||||
$v = "1.2.0"
|
$v = "1.2.0"
|
||||||
@@ -10,10 +13,12 @@ function Build-Version {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Build-Path {
|
function Build-Path {
|
||||||
if ([string]::IsNullOrEmpty($env:APPVEYOR_BUILD_FOLDER)) {
|
if (![string]::IsNullOrEmpty($env:APPVEYOR_BUILD_FOLDER)) {
|
||||||
$p = Convert-Path .
|
|
||||||
} else {
|
|
||||||
$p = $env:APPVEYOR_BUILD_FOLDER
|
$p = $env:APPVEYOR_BUILD_FOLDER
|
||||||
|
} elseif (![string]::IsNullOrEmpty($solution)) {
|
||||||
|
$p = $solution
|
||||||
|
} else {
|
||||||
|
$p = Get-Location
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "Build Folder: $p"
|
Write-Host "Build Folder: $p"
|
||||||
@@ -22,6 +27,29 @@ function Build-Path {
|
|||||||
return $p
|
return $p
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Copy-Resources ($path, $config) {
|
||||||
|
$project = "$path\Wox"
|
||||||
|
$output = "$path\Output"
|
||||||
|
$target = "$output\$config"
|
||||||
|
Copy-Item -Recurse -Force $project\Themes\* $target\Themes\
|
||||||
|
Copy-Item -Recurse -Force $project\Images\* $target\Images\
|
||||||
|
Copy-Item -Recurse -Force $path\Plugins\HelloWorldPython $target\Plugins\HelloWorldPython
|
||||||
|
Copy-Item -Recurse -Force $path\JsonRPC $target\JsonRPC
|
||||||
|
Copy-Item -Force $path\packages\squirrel*\tools\Squirrel.exe $output\Update.exe
|
||||||
|
}
|
||||||
|
|
||||||
|
function Delete-Unused ($path, $config) {
|
||||||
|
$target = "$path\Output\$config"
|
||||||
|
$included = @(
|
||||||
|
"Wox.Plugin.pdb", "Wox.Plugin.dll", "Wox.Core.*", "Wox.Infrastructure.*",
|
||||||
|
"ICSharpCode.*", "JetBrains.*", "Pinyin4Net.*", "NLog.*"
|
||||||
|
)
|
||||||
|
foreach ($i in $included){
|
||||||
|
Remove-Item -Path $target\Plugins -Include $i -Recurse
|
||||||
|
}
|
||||||
|
Remove-Item -Path $target -Include "*.xml" -Recurse
|
||||||
|
}
|
||||||
|
|
||||||
function Validate-Directory ($output) {
|
function Validate-Directory ($output) {
|
||||||
New-Item $output -ItemType Directory -Force
|
New-Item $output -ItemType Directory -Force
|
||||||
}
|
}
|
||||||
@@ -65,13 +93,14 @@ function Pack-Squirrel-Installer ($path, $version, $output) {
|
|||||||
$nupkg = "$output\Wox.$version.nupkg"
|
$nupkg = "$output\Wox.$version.nupkg"
|
||||||
Write-Host "nupkg path: $nupkg"
|
Write-Host "nupkg path: $nupkg"
|
||||||
$icon = "$path\Wox\Resources\app.ico"
|
$icon = "$path\Wox\Resources\app.ico"
|
||||||
|
Write-Host "icon: $icon"
|
||||||
# Squirrel.com: https://github.com/Squirrel/Squirrel.Windows/issues/369
|
# Squirrel.com: https://github.com/Squirrel/Squirrel.Windows/issues/369
|
||||||
New-Alias Squirrel $path\packages\squirrel*\tools\Squirrel.exe -Force
|
New-Alias Squirrel $path\packages\squirrel*\tools\Squirrel.exe -Force
|
||||||
# why we need Write-Output: https://github.com/Squirrel/Squirrel.Windows/issues/489#issuecomment-156039327
|
# why we need Write-Output: https://github.com/Squirrel/Squirrel.Windows/issues/489#issuecomment-156039327
|
||||||
# directory of releaseDir in fucking squirrel can't be same as directory ($nupkg) in releasify
|
# directory of releaseDir in fucking squirrel can't be same as directory ($nupkg) in releasify
|
||||||
$temp = "$output\Temp"
|
$temp = "$output\Temp"
|
||||||
|
|
||||||
Squirrel --releasify $nupkg --releaseDir $temp --setupIcon $iconPath --no-msi | Write-Output
|
Squirrel --releasify $nupkg --releaseDir $temp --setupIcon $icon --no-msi | Write-Output
|
||||||
Move-Item $temp\* $output -Force
|
Move-Item $temp\* $output -Force
|
||||||
Remove-Item $temp
|
Remove-Item $temp
|
||||||
|
|
||||||
@@ -84,23 +113,27 @@ function Pack-Squirrel-Installer ($path, $version, $output) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Main {
|
function Main {
|
||||||
$v = Build-Version
|
|
||||||
$p = Build-Path
|
$p = Build-Path
|
||||||
$o = "$p\Output\Packages"
|
$v = Build-Version
|
||||||
New-Alias Nuget $p\packages\NuGet.CommandLine.*\tools\NuGet.exe -Force
|
Copy-Resources $p $config
|
||||||
|
|
||||||
Validate-Directory $o
|
if ($config -eq "Release"){
|
||||||
|
|
||||||
|
Delete-Unused $p $config
|
||||||
|
$o = "$p\Output\Packages"
|
||||||
|
Validate-Directory $o
|
||||||
|
New-Alias Nuget $p\packages\NuGet.CommandLine.*\tools\NuGet.exe -Force
|
||||||
|
Pack-Squirrel-Installer $p $v $o
|
||||||
|
|
||||||
$isInCI = $env:APPVEYOR
|
$isInCI = $env:APPVEYOR
|
||||||
if ($isInCI) {
|
if ($isInCI) {
|
||||||
Pack-Nuget $p $v $o
|
Pack-Nuget $p $v $o
|
||||||
Zip-Release $p $v $o
|
Zip-Release $p $v $o
|
||||||
|
}
|
||||||
|
|
||||||
|
Write-Host "List output directory"
|
||||||
|
Get-ChildItem $o
|
||||||
}
|
}
|
||||||
|
|
||||||
Pack-Squirrel-Installer $p $v $o
|
|
||||||
|
|
||||||
Write-Host "List output directory"
|
|
||||||
Get-ChildItem $o
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Main
|
Main
|
||||||
@@ -433,33 +433,7 @@
|
|||||||
<ItemGroup />
|
<ItemGroup />
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PostBuildEvent>
|
<PostBuildEvent>powershell.exe -NoProfile -File $(SolutionDir)Scripts\build.ps1 $(ConfigurationName) $(SolutionDir)</PostBuildEvent>
|
||||||
xcopy /Y /E $(ProjectDir)Themes\* $(TargetDir)Themes\
|
|
||||||
xcopy /Y /E $(ProjectDir)Images\* $(TargetDir)Images\
|
|
||||||
xcopy /Y /D /E $(SolutionDir)Plugins\HelloWorldPython\* $(TargetDir)Plugins\HelloWorldPython\*
|
|
||||||
xcopy /Y /E $(SolutionDir)JsonRPC\* $(TargetDir)JsonRPC\
|
|
||||||
|
|
||||||
cd $(SolutionDir)packages\squirrel*\tools
|
|
||||||
copy /Y Squirrel.exe $(TargetDir)..\Update.exe
|
|
||||||
cd $(SolutionDir)
|
|
||||||
|
|
||||||
if $(ConfigurationName) == Release (
|
|
||||||
cd "$(TargetDir)Plugins" & del /s /q NLog.dll
|
|
||||||
cd "$(TargetDir)Plugins" & del /s /q NLog.config
|
|
||||||
cd "$(TargetDir)Plugins" & del /s /q Wox.Plugin.pdb
|
|
||||||
cd "$(TargetDir)Plugins" & del /s /q Wox.Plugin.dll
|
|
||||||
cd "$(TargetDir)Plugins" & del /s /q Wox.Core.dll
|
|
||||||
cd "$(TargetDir)Plugins" & del /s /q Wox.Core.pdb
|
|
||||||
cd "$(TargetDir)Plugins" & del /s /q ICSharpCode.SharpZipLib.dll
|
|
||||||
cd "$(TargetDir)Plugins" & del /s /q NAppUpdate.Framework.dll
|
|
||||||
cd "$(TargetDir)Plugins" & del /s /q Wox.Infrastructure.dll
|
|
||||||
cd "$(TargetDir)Plugins" & del /s /q Wox.Infrastructure.pdb
|
|
||||||
cd "$(TargetDir)Plugins" & del /s /q Newtonsoft.Json.dll
|
|
||||||
cd "$(TargetDir)Plugins" & del /s /q JetBrains.Annotations.dll
|
|
||||||
cd "$(TargetDir)Plugins" & del /s /q Pinyin4Net.dll
|
|
||||||
cd "$(TargetDir)" & del /s /q *.xml
|
|
||||||
)
|
|
||||||
</PostBuildEvent>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PreBuildEvent>taskkill /f /fi "IMAGENAME eq Wox.exe"</PreBuildEvent>
|
<PreBuildEvent>taskkill /f /fi "IMAGENAME eq Wox.exe"</PreBuildEvent>
|
||||||
|
|||||||
Reference in New Issue
Block a user