-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
9 changed files
with
162 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
@echo off | ||
|
||
WHERE msbuild >NUL 2>NUL | ||
IF ERRORLEVEL 1 goto :setup | ||
goto :powershell | ||
|
||
:setup | ||
if "%VS140COMNTOOLS%" NEQ "" ( | ||
call "%VS140COMNTOOLS%vsvars32.bat" | ||
goto :powershell | ||
) | ||
if "%VS150COMNTOOLS%" NEQ "" ( | ||
call "%VS150COMNTOOLS%VsDevCmd.bat" | ||
goto :powershell | ||
) | ||
if "%VS160COMNTOOLS%" NEQ "" ( | ||
call "%VS160COMNTOOLS%VsDevCmd.bat" | ||
goto :powershell | ||
) else ( | ||
echo "Run this script from the Visual Studio Developer Command Prompt" | ||
exit /B 1 | ||
) | ||
|
||
:powershell | ||
WHERE pwsh >NUL 2>NUL | ||
IF ERRORLEVEL 1 ( | ||
echo "Installing 'pwsh' (PowerShell Core)" | ||
dotnet tool install --global powershell | ||
) | ||
|
||
pwsh -f Common/fix_versions.ps1 | ||
|
||
REM Restore NuGet packages: | ||
msbuild -t:restore XmlDiff.sln /verbosity:minimal /p:Configuration=Release "/p:Platform=Any CPU" | ||
if ERRORLEVEL 1 exit /B 1 | ||
|
||
REM Build XmlDiff: | ||
msbuild XmlDiff.sln /verbosity:minimal /p:Configuration=Release "/p:Platform=Any CPU" | ||
if ERRORLEVEL 1 exit /B 1 | ||
|
||
if "%MyKeyFile%" == "" goto :eof | ||
|
||
REM sign assemblies | ||
pwsh -f Common\full_sign.ps1 | ||
|
||
REM create .nupkg | ||
nuget pack XmlDiffView\XmlDiff.nuspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path | ||
$RootDir = Split-Path -Parent $ScriptDir | ||
Set-Location $RootDir | ||
|
||
$props = Join-Path -Path $RootDir -ChildPath "Common\version.props" | ||
$nuspec = Join-Path -Path $RootDir -ChildPath "XmlDiffView\XmlDiff.nuspec" | ||
|
||
function UpdateVersion($line) | ||
{ | ||
if ($line -match "\w*\<version\>([^\<]*)\</version\>") { | ||
# this is the SgmlReader.nuspec | ||
return $line.Replace($Matches.1, "$version") | ||
} | ||
elseif ($line -match "\w*\<Version\>([^\<]*)\</Version\>") { | ||
# this is in version.props. | ||
return $line.Replace($Matches.1, "$version") | ||
} | ||
elseif ($line -match "\w*\<FileVersion\>([^\<]*)\</FileVersion\>") { | ||
# this is in version.props. | ||
return $line.Replace($Matches.1, "$version") | ||
} | ||
elseif ($line -match "\w*\<AssemblyVersion\>([^\<]*)\</AssemblyVersion\>") { | ||
# this is in version.props. | ||
return $line.Replace($Matches.1, "$version") | ||
} | ||
elseif ($line -match "\w*\[assembly\: AssemblyVersion\(\`"([^<]*)\`"\)\]") { | ||
return $line.Replace($Matches.1, "$version") | ||
} | ||
elseif ($line -match "\w*\[assembly\: AssemblyFileVersion\(\`"([^<]*)\`"\)\]") { | ||
return $line.Replace($Matches.1, "$version") | ||
} | ||
return $line | ||
} | ||
|
||
function FixFile($filename) | ||
{ | ||
if ($filename -eq "") { | ||
Write-Error "Missing filename parameter" | ||
Exit 1 | ||
} | ||
|
||
$nl = [Environment]::NewLine | ||
$versionFile = Join-Path -Path $ScriptDir -ChildPath "version.txt" | ||
$version = Get-Content -Path $versionFile | Join-String -Separator $nl | ||
$version = $version.Trim() | ||
|
||
$fullPath = $filename | ||
if (-Not (Test-Path $fullPath)) { | ||
$x = Get-Location | ||
$fullPath = Join-Path -Path $x -ChildPath $filename | ||
} | ||
|
||
$localcontent = Get-Content -Path $fullPath | ForEach { UpdateVersion $_ } | Join-String -Separator $nl | ||
$encoding = New-Object System.Text.UTF8Encoding $False | ||
|
||
$write = $false | ||
while (-not $write) { | ||
try { | ||
Write-Host "updating version in $filename" | ||
[IO.File]::WriteAllText($filename, $localcontent, $encoding) | ||
$write = $true | ||
} catch { | ||
Write-Host "file locked, trying again in 1 second: $filename" | ||
Start-Sleep -s 1 | ||
} | ||
} | ||
} | ||
|
||
FixFile($props) | ||
FixFile($nuspec) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# This script performs the full signing of all the assemblies used in the .nuspec after the build does delay signing | ||
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path | ||
|
||
$testpath = $ScriptDir + "\..\XmlDiff\bin\Release\net46\XmlDiffPatch.dll" | ||
if (-not (Test-Path -Path $testpath)){ | ||
Write-Host "Please build release build of XmlDiff.sln" | ||
exit 1 | ||
} | ||
|
||
$doc = [System.Xml.Linq.XDocument]::Load("$ScriptDir\..\XmlDiffView\XmlDiff.nuspec") | ||
$ns = $doc.Root.Name.Namespace.NamespaceName | ||
foreach ($e in $doc.Root.Descendants()) { | ||
if ($e.Name.LocalName -eq "file") { | ||
$src = $e.Attribute("src").Value | ||
if ($src.EndsWith(".dll") -or $src.EndsWith(".exe")) { | ||
Write-Host "signing $src" | ||
$path = $ScriptDir + "\..\XmlDiffView\" + $src | ||
signtool sign /a /i "Sectigo Public Code Signing CA R36" /t http://timestamp.sectigo.com /fd sha256 $path | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<Project> | ||
<PropertyGroup> | ||
<Company>Lovett Software</Company> | ||
<Copyright>Copyright © Lovett Software</Copyright> | ||
<FileVersion>1.0.5</FileVersion> | ||
<AssemblyVersion>1.0.5</AssemblyVersion> | ||
<Version>1.0.5</Version> | ||
</PropertyGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.0.5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters