update build scripts

This commit is contained in:
Paddy Xu
2017-07-03 22:54:26 +03:00
parent a169cb0767
commit 32df836f08
8 changed files with 42 additions and 26 deletions

View File

@@ -6,25 +6,19 @@ cache:
- packages -> **\packages.config - packages -> **\packages.config
- '%USERPROFILE%\.nuget\packages -> **\project.json' - '%USERPROFILE%\.nuget\packages -> **\project.json'
before_build: before_build:
- cmd: >- - ps: >-
FOR /F %%i in ('git describe --always --tags') do set GIT_TAG=%%i $env:GIT_TAG = git describe --always --tags
nuget restore nuget restore
build: build:
verbosity: minimal verbosity: minimal
after_build: after_build:
- cmd: >- - ps: >-
type GitVersion.cs Get-Content GitVersion.cs
cd Build Move-Item Build\QuickLook-$env:GIT_TAG.msi QuickLook-$env:GIT_TAG.msi
move QuickLook.msi ..\QuickLook-%GIT_TAG%.msi Move-Item Build\QuickLook-$env:GIT_TAG.zip QuickLook-$env:GIT_TAG.zip
dir ..\QuickLook-%GIT_TAG%.msi
7z a ..\QuickLook-%GIT_TAG%.zip .\Package\* -r
7z l ..\QuickLook-%GIT_TAG%.zip
artifacts: artifacts:
- path: QuickLook-%GIT_TAG%.zip - path: QuickLook-%GIT_TAG%.zip

View File

@@ -18,6 +18,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<OutputPath>..\Build\</OutputPath> <OutputPath>..\Build\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath> <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>PackageDir=$(SolutionDir)Build\Package\</DefineConstants>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Include="C_QuickLookComponents.wxs" /> <Compile Include="C_QuickLookComponents.wxs" />
@@ -32,25 +33,24 @@
<ItemGroup> <ItemGroup>
<Content Include="gpl.rtf" /> <Content Include="gpl.rtf" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<ProjectReference Include="..\QuickLook\QuickLook.csproj">
<Name>QuickLook</Name>
<Project>{8b4a9ce5-67b5-4a94-81cb-3771f688fdeb}</Project>
<Private>True</Private>
<DoNotHarvest>True</DoNotHarvest>
<RefProjectOutputGroups>Binaries;Content;Satellites</RefProjectOutputGroups>
<RefTargetDir>INSTALLFOLDER</RefTargetDir>
</ProjectReference>
</ItemGroup>
<Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " /> <Import Project="$(WixTargetsPath)" Condition=" '$(WixTargetsPath)' != '' " />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " /> <Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets" Condition=" '$(WixTargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets') " />
<Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' "> <Target Name="EnsureWixToolsetInstalled" Condition=" '$(WixTargetsImported)' != 'true' ">
<Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" /> <Error Text="The WiX Toolset v3.11 (or newer) build tools must be installed to build this project. To download the WiX Toolset, see http://wixtoolset.org/releases/" />
</Target> </Target>
<PropertyGroup> <PropertyGroup>
<PreBuildEvent>robocopy "$(SolutionDir)Build\$(Configuration)" "$(SolutionDir)Build\Package" %2a.%2a /e /njh /njs /ndl /nfl /nc /ns /np /xf %2a.pdb /xf %2a.obj /xf %2a.ipdb /xf %2a.iobj /xf %2a.exp /xf %2a.lib /xf %2a.ilk /xf %2a.xml <PreBuildEvent>rmdir /S /Q "$(SolutionDir)Build\Package\%2a"
"$(WIX)bin\heat" dir "$(SolutionDir)Build\Package" -dr INSTALLFOLDER -cg QuickLookComponents -gg -g1 -sf -srd -sreg -var "var.QuickLook.TargetDir" -out "$(ProjectDir)C_QuickLookComponents.wxs"</PreBuildEvent> robocopy "$(SolutionDir)Build\$(Configuration)" "$(SolutionDir)Build\Package" %2a.%2a /e /njh /njs /ndl /nfl /nc /ns /np /xf %2a.pdb /xf %2a.obj /xf %2a.ipdb /xf %2a.iobj /xf %2a.exp /xf %2a.lib /xf %2a.ilk /xf %2a.xml
powershell -file "$(SolutionDir)Scripts\sign-package.ps1"
"$(WIX)bin\heat" dir "$(SolutionDir)Build\Package" -dr INSTALLFOLDER -cg QuickLookComponents -gg -g1 -sf -srd -sreg -var "var.PackageDir" -out "$(ProjectDir)C_QuickLookComponents.wxs"</PreBuildEvent>
</PropertyGroup>
<PropertyGroup>
<PostBuildEvent>powershell -file "$(SolutionDir)Scripts\sign-msi.ps1"
powershell -file "$(SolutionDir)Scripts\rename-pkg.ps1"</PostBuildEvent>
</PropertyGroup> </PropertyGroup>
<!-- <!--
To modify your build process, add your task inside one of the targets below and uncomment it. To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@@ -38,7 +38,9 @@ Project("{930C7802-8A8C-48F9-8165-68863BCCD9DD}") = "QuickLook.Installer", "Quic
{D31EE321-C2B0-4984-B749-736F7DE509F1} = {D31EE321-C2B0-4984-B749-736F7DE509F1} {D31EE321-C2B0-4984-B749-736F7DE509F1} = {D31EE321-C2B0-4984-B749-736F7DE509F1}
{AE041682-E3A1-44F6-8BB4-916A98D89FBE} = {AE041682-E3A1-44F6-8BB4-916A98D89FBE} {AE041682-E3A1-44F6-8BB4-916A98D89FBE} = {AE041682-E3A1-44F6-8BB4-916A98D89FBE}
{1B746D92-49A5-4A37-9D75-DCC490393290} = {1B746D92-49A5-4A37-9D75-DCC490393290} {1B746D92-49A5-4A37-9D75-DCC490393290} = {1B746D92-49A5-4A37-9D75-DCC490393290}
{45E94893-3076-4A8E-8969-6955B6340739} = {45E94893-3076-4A8E-8969-6955B6340739}
{A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D} = {A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D} {A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D} = {A82AC69C-EDF5-4F0D-8CBD-8E5E3C06E64D}
{863ECAAC-18D9-4256-A27D-0F308089FB47} = {863ECAAC-18D9-4256-A27D-0F308089FB47}
{AB1270AF-7EB4-4B4F-9E09-6404F1A28EA0} = {AB1270AF-7EB4-4B4F-9E09-6404F1A28EA0} {AB1270AF-7EB4-4B4F-9E09-6404F1A28EA0} = {AB1270AF-7EB4-4B4F-9E09-6404F1A28EA0}
{2C58F9B2-D8FA-4586-942B-5170CECE5963} = {2C58F9B2-D8FA-4586-942B-5170CECE5963} {2C58F9B2-D8FA-4586-942B-5170CECE5963} = {2C58F9B2-D8FA-4586-942B-5170CECE5963}
{DE2E3BC5-6AB2-4420-A160-48C7A7506C1C} = {DE2E3BC5-6AB2-4420-A160-48C7A7506C1C} {DE2E3BC5-6AB2-4420-A160-48C7A7506C1C} = {DE2E3BC5-6AB2-4420-A160-48C7A7506C1C}

View File

@@ -255,6 +255,6 @@
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup> <PropertyGroup>
<PreBuildEvent>"$(SolutionDir)update-version.cmd" "$(SolutionDir)" "$(SolutionDir)GitVersion.cs"</PreBuildEvent> <PreBuildEvent>"$(SolutionDir)Scripts\update-version.cmd" "$(SolutionDir)" "$(SolutionDir)GitVersion.cs"</PreBuildEvent>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

4
Scripts/rename-pkg.ps1 Normal file
View File

@@ -0,0 +1,4 @@
$version = git describe --always --tags
Rename-Item ..\Build\QuickLook.msi QuickLook-$version.msi
Compress-Archive ..\Build\Package\* ..\Build\QuickLook-$version.zip

8
Scripts/sign-msi.ps1 Normal file
View File

@@ -0,0 +1,8 @@
if(-not (Test-Path env:CI))
{
$signExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x86\signtool.exe'
$file = '..\Build\QuickLook.msi'
$timestampUrl = 'http://time.certum.pl/'
.$signExe sign /a /v /fd sha256 /t $timestampUrl $file
}

8
Scripts/sign-package.ps1 Normal file
View File

@@ -0,0 +1,8 @@
if(-not (Test-Path env:CI))
{
$signExe = 'C:\Program Files (x86)\Windows Kits\10\bin\10.0.15063.0\x86\signtool.exe'
$files = gci '..\Build\Package\*' -Recurse -Include *.exe,*.dll | %{('"{0}"' -f $_.FullName)}
$timestampUrl = 'http://time.certum.pl/'
.$signExe sign /a /v /fd sha256 /t $timestampUrl $files
}