Repository navigation
Expand file tree
/
Copy pathbuildhelpers.ps1
More file actions
59 lines (46 loc) · 2.19 KB
/
Copy pathbuildhelpers.ps1
File metadata and controls
59 lines (46 loc) · 2.19 KB
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
function Replace($file, $before, $after)
{
$content = Get-Content $file | Foreach-Object {$_ -replace $before, $after }
$content | Set-Content $file -Encoding UTF8
}
function UpdateVersion($project, $version)
{
$file = "./$project/Properties/AssemblyInfo.cs"
Replace $file "AssemblyVersion\s*\([^\)]+\)" "AssemblyVersion (`"$version`")"
Replace $file "AssemblyFileVersion\s*\([^\)]+\)" "AssemblyFileVersion(`"$version`")"
}
function UpdateVsVersion($project, $version)
{
UpdateVersion $project $version
Replace "./$project/CodeAlignmentPackage.cs" `
"\[InstalledProductRegistration\(`"#110`", `"#112`", `"[^`"]+`", IconResourceID = 400\)\]" `
"[InstalledProductRegistration(`"#110`", `"#112`", `"$version`", IconResourceID = 400)]"
Replace "./$project/source.extension.vsixmanifest" `
"Id=`"2adcbb11-89c4-451e-97f2-14049154ccad`" Version=`"[^`"]+`"" `
"Id=`"2adcbb11-89c4-451e-97f2-14049154ccad`" Version=`"$version`""
}
function CollectNpp($is64)
{
$origin = $pwd
$outputMod = if ($is64) { "\x64" } else { "" }
$zipSuffix = if ($is64) { "x64.zip" } else { "x86.zip" }
$zipFileName = "CodeAlignmentNpp_$($env:APPVEYOR_REPO_TAG_NAME)_$zipSuffix"
$binDir = "CodeAlignment.Npp\bin$outputMod\$env:CONFIGURATION"
cd $binDir
$staging = "staging_release"
$targetPluginDir = "$staging\CodeAlignmentNpp"
New-Item -ItemType Directory -Path "$targetPluginDir\CodeAlignment" -Force | Out-Null
if (Test-Path "CodeAlignmentNpp.dll") {
Copy-Item "CodeAlignmentNpp.dll" -Destination "$targetPluginDir\" -Force
}
if (Test-Path "CodeAlignment\CodeAlignment.Common.dll") {
Copy-Item "CodeAlignment\CodeAlignment.Common.dll" -Destination "$targetPluginDir\CodeAlignment\" -Force
}
if (Test-Path "CodeAlignment\CodeAlignment.Common.WinForms.dll") {
Copy-Item "CodeAlignment\CodeAlignment.Common.WinForms.dll" -Destination "$targetPluginDir\CodeAlignment\" -Force
}
7z a $zipFileName "./$staging/*"
Push-AppveyorArtifact $zipFileName -FileName $zipFileName
Remove-Item $staging -Recurse -Force -ErrorAction SilentlyContinue
cd $origin
}