summaryrefslogtreecommitdiffstats
path: root/win/CS/build.xml
blob: ffdc3a5e78c8225be097ccad1b0f28cddc5c6d53 (plain)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!--
  build.xml
  This file is part of the HandBrake source code.
  Homepage: <http://handbrake.fr>.
  It may be used under the terms of the GNU General Public License
  
  HandBrake Build Script for usage with Jenkins.
  Usage: 
    msbuild build.xml /t:Nightly
    msbuild build.xml /t:Release
  Example with code signing:
    msbuild build.xml /t:Release /p:SignThumbprint=XYZ /p:SignTimestampServer=http://time.certum.pl/
    msbuild build.xml /t:Release /p:PfxFile=file.pfx /p:PfxPwd=XYZ /p:SignTimestampServer=http://time.certum.pl/
    
  Requires: libhb.dll to be in the release folder.
  
-->
<Project DefaultTargets="Nightly" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <!-- Setup -->
  <PropertyGroup>
    <Configuration>Debug</Configuration>
    <Platform>x64</Platform>
    <PlatformTarget>x64</PlatformTarget>
  </PropertyGroup>

  <!-- Build all the main cproj files.-->
  <ItemGroup>
    <ProjectsToBuild Include="HandBrake.Interop\*proj" Exclude="$(MSBuildProjectFile)"/>
    <ProjectsToBuild Include="HandBrakeWPF\*proj" Exclude="$(MSBuildProjectFile)"/>
    <ProjectsToBuild Include="HandBrake.Installer\*wixproj" Exclude="$(MSBuildProjectFile)"/>
  </ItemGroup>

  <!-- Builds /t: -->
  <Target Name="Nightly" DependsOnTargets="$(NightlyDependsOn)"/>
  <Target Name="Release" DependsOnTargets="$(InstallDependsOn)"/>

  <!-- Dependencies -->
  <PropertyGroup>
    <NightlyDependsOn>SetupForNightly;BuildRelease;NightlyPostBuild;CodeSign</NightlyDependsOn>
    <InstallDependsOn>SetupForRelease;BuildRelease;ReleasePostBuild;CodeSign</InstallDependsOn>
  </PropertyGroup>
  
  <!-- Setup -->
  <Target Name="SetupForNightly">
    <PropertyGroup>
      <Configuration>Debug</Configuration>
    </PropertyGroup>
  </Target>

  <Target Name="SetupForRelease">
    <PropertyGroup>
      <Configuration>Release</Configuration>
    </PropertyGroup>
  </Target>

  <!-- Code Signing Configuration -->
  <PropertyGroup Condition="'$(SignToolLocation)'==''">
    <SignToolLocation>C:\Program Files (x86)\Windows Kits\10\bin\10.0.18362.0\x64\SignTool.exe</SignToolLocation>
  </PropertyGroup>

  <PropertyGroup Condition="'$(SignTimestampServer)'!=''">
    <SignTimestamp  Condition="'$(SignTimestampServer)'!=''" >/t</SignTimestamp>
  </PropertyGroup>

  <PropertyGroup Condition="'$(SignThumbprint)'!=''">
    <SignType>/sha1</SignType>
    <SignEnabled>true</SignEnabled>
  </PropertyGroup>

  <PropertyGroup Condition="'$(PfxFile)'!=''">
    <SignType>/f</SignType>
    <SignPwd Condition="'$(PfxPwd)'!=''">/p</SignPwd>
    <SignEnabled>true</SignEnabled>
  </PropertyGroup>

  <!-- Build All Components (WPF, Interop, Interop) -->
  <Target Name="BuildRelease">
    <Message Text="Project File Name = $(Platform)" />
    <MSBuild Projects ="@(ProjectsToBuild)"
             ContinueOnError ="false"
             Properties="Configuration=$(Configuration);Platform=$(Platform)" >
      <Output ItemName="OutputFiles" TaskParameter="TargetOutputs"/>
    </MSBuild>
  </Target>

  <!-- Post Build Events -->
  <Target Name="NightlyPostBuild">
    <Exec Command="copy $(MSBuildProjectDirectory)\HandBrakeWPF\Installer\MakeNightly64.nsi $(MSBuildProjectDirectory)\HandBrakeWPF\bin\x64\$(Configuration) /Y" />
    <Exec Command="copy $(MSBuildProjectDirectory)\HandBrakeWPF\Installer\InstallerBackground.bmp $(MSBuildProjectDirectory)\HandBrakeWPF\bin\x64\$(Configuration) /Y" />
    <Exec Command="copy $(MSBuildProjectDirectory)\HandBrakeWPF\handbrakepineapple.ico $(MSBuildProjectDirectory)\HandBrakeWPF\bin\x64\$(Configuration) /Y" />
    <Exec Command="xcopy $(MSBuildProjectDirectory)\doc $(MSBuildProjectDirectory)\HandBrakeWPF\bin\x64\$(Configuration)\doc /I /Y" />
    <Exec Command="makensis $(MSBuildProjectDirectory)\HandBrakeWPF\bin\x64\$(Configuration)\MakeNightly64.nsi" />

    <Exec Command="copy $(MSBuildProjectDirectory)\HandBrake.Installer\bin\$(Platform)\$(Configuration)\HandBrake.msi $(MSBuildProjectDirectory)\HandBrakeWPF\bin\x64\$(Configuration)\HandBrake-Nightly-x86_64-Win_GUI.msi /Y" />
  </Target>

  <Target Name="ReleasePostBuild">
    <Exec Command="copy $(MSBuildProjectDirectory)\HandBrakeWPF\Installer\Installer64.nsi $(MSBuildProjectDirectory)\HandBrakeWPF\bin\x64\$(Configuration) /Y" />
    <Exec Command="copy $(MSBuildProjectDirectory)\HandBrakeWPF\Installer\InstallerBackground.bmp $(MSBuildProjectDirectory)\HandBrakeWPF\bin\x64\$(Configuration) /Y" />
    <Exec Command="copy $(MSBuildProjectDirectory)\HandBrakeWPF\handbrakepineapple.ico $(MSBuildProjectDirectory)\HandBrakeWPF\bin\x64\$(Configuration) /Y" />
    <Exec Command="xcopy $(MSBuildProjectDirectory)\doc $(MSBuildProjectDirectory)\HandBrakeWPF\bin\x64\$(Configuration)\doc /I /Y" />
    <Exec Command="makensis $(MSBuildProjectDirectory)\HandBrakeWPF\bin\x64\$(Configuration)\Installer64.nsi" />

    <Exec Command="copy $(MSBuildProjectDirectory)\HandBrake.Installer\bin\$(Platform)\$(Configuration)\HandBrake.msi $(MSBuildProjectDirectory)\HandBrakeWPF\bin\x64\$(Configuration)\HandBrake-Version-x86_64-Win_GUI.msi /Y" />
  </Target>

  <Target Name="CodeSign" Condition="'$(SignEnabled)' == 'true'">
    <Exec Command="&quot;$(SignToolLocation)&quot; sign $(SignType) $(SignThumbprint)$(PfxFile) $(SignPwd) $(PfxPwd) $(SignTimestamp) $(SignTimestampServer) /v &quot;$(MSBuildProjectDirectory)\HandBrakeWPF\bin\$(Platform)\$(Configuration)\*Win_GUI.exe&quot;" />
    <Exec Command="&quot;$(SignToolLocation)&quot; sign $(SignType) $(SignThumbprint)$(PfxFile) $(SignPwd) $(PfxPwd) $(SignTimestamp) $(SignTimestampServer) /v &quot;$(MSBuildProjectDirectory)\HandBrakeWPF\bin\$(Platform)\$(Configuration)\*Win_GUI.msi&quot;" />
  </Target>

</Project>