forked from RWS/dxa-web-application-dotnet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ciBuild.proj
118 lines (94 loc) · 7.43 KB
/
ciBuild.proj
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
114
115
116
117
118
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.5">
<PropertyGroup>
<!-- Input parameters -->
<Version Condition="'$(VERSION)' == ''">0.0.0.0</Version>
<Version Condition="'$(VERSION)' != ''">$(VERSION)</Version>
<IsPreRelease>true</IsPreRelease>
<BuildConfiguration>Release</BuildConfiguration>
<ProjectDirectory>$(MSBuildProjectDirectory)</ProjectDirectory>
<CdTestDeployFolder>\\saintjohn01.ams.dev\C$\inetpub\wwwroot\GitVersion</CdTestDeployFolder>
<NuGetRepositoryUrl></NuGetRepositoryUrl>
<NuGet>"$(ProjectDirectory)\_tools\NuGet.exe"</NuGet>
<NuGetPackageDirectory>$(ProjectDirectory)\_NuGet</NuGetPackageDirectory>
<DxaFrameworkPackageDirectory>$(NuGetPackageDirectory)\Sdl.Dxa.Framework</DxaFrameworkPackageDirectory>
<VersionMajor>$(Version.Split('.')[0])</VersionMajor>
<VersionMinor>$(Version.Split('.')[1])</VersionMinor>
<VersionPatch>$(Version.Split('.')[2])</VersionPatch>
<VersionBuild>$(Version.Split('.')[3])</VersionBuild>
<PreReleaseLabel Condition="'$(IsPreRelease)' == 'true'">-alpha-$([System.DateTime]::Now.ToString("yyyyMMddHHmm"))</PreReleaseLabel>
<PackageVersion>$(VersionMajor).$(VersionMinor).$(VersionPatch)$(PreReleaseLabel)</PackageVersion>
<!--Tools-->
<MsBuildExe>C:\Program Files (x86)\MSBuild\12.0\Bin\MSBuild.exe</MsBuildExe>
</PropertyGroup>
<!-- ============================================================================================================================================= -->
<Target Name="Build">
<Message Text="Start build..." Importance="high" />
<CallTarget Targets="PrepareBuild"/>
<CallTarget Targets="RunBuild"/>
<CallTarget Targets="CreatePackages"/>
<CallTarget Targets="PublishPackages" Condition="'$(NuGetRepositoryUrl)' != ''"/>
</Target>
<!-- ============================================================================================================================================= -->
<Target Name="PrepareBuild">
<Message Text="Preparing build..." Importance="high" />
<Message Text="Restoring NuGet packages..."/>
<Exec Command="_tools\RestorePackages DxaFramework.sln" WorkingDirectory="$(ProjectDirectory)" />
<ItemGroup>
<AssemblyInfo Include="[assembly: AssemblyVersion("$(VersionMajor).$(VersionMinor).$(VersionPatch).0")]" />
<AssemblyInfo Include="[assembly: AssemblyFileVersion("$(Version)")]" />
<AssemblyInfo Include="[assembly: AssemblyInformationalVersion("$(PackageVersion)")]" />
<AssemblyInfo Include="[assembly: AssemblyCopyright("Copyright © 2014-$([System.DateTime]::Now.ToString("yyyy")) SDL Group")]" />
</ItemGroup>
<Message Text="Updating CommonAssemblyInfo..."/>
<WriteLinesToFile File="$(ProjectDirectory)\CommonAssemblyInfo.cs" Overwrite="False" Lines="@(AssemblyInfo)" />
</Target>
<!-- ============================================================================================================================================= -->
<Target Name="RunBuild">
<Message Text="Running build commands..." Importance="high" />
<!-- Build the Sdl.Web.Tridion project for SDL Web 8 (Release/Debug) and 2013 SP1 (Release_7.1) -->
<MSBuild Projects="$(ProjectDirectory)\Sdl.Web.Tridion\Sdl.Web.Tridion.csproj" Properties="Configuration=$(BuildConfiguration);Platform=AnyCPU" StopOnFirstFailure="true" />
<MSBuild Projects="$(ProjectDirectory)\Sdl.Web.Tridion\Sdl.Web.Tridion.csproj" Properties="Configuration=Release_7.1;Platform=AnyCPU" StopOnFirstFailure="true" />
<!-- Build the Site project for SDL Web 8 (Release/Debug) and 2013 SP1 (Release_7.1); there is only difference in Sdl.Web.Tridion artifacts (see above). -->
<MSBuild Projects="$(ProjectDirectory)\Site\Sdl.Web.Site.csproj" Properties="Configuration=$(BuildConfiguration);Platform=AnyCPU" StopOnFirstFailure="true" />
<MSBuild Projects="$(ProjectDirectory)\Site\Sdl.Web.Site.csproj" Properties="Configuration=Release_7.1;Platform=AnyCPU" StopOnFirstFailure="true" />
</Target>
<!-- ============================================================================================================================================= -->
<Target Name="CreatePackages">
<Message Text="Creating NuGet packages in '$(NuGetPackageDirectory)' ..." Importance="high" />
<Message Text="Package Version: $(PackageVersion)" />
<!--Versionize the path to DXA Framework libs in the {package_id}.targets files -->
<XmlPoke
XmlInputPath="$(DxaFrameworkPackageDirectory)\Sdl.Dxa.Framework.Web8.targets"
Namespaces="<Namespace Prefix='msb' Uri='http://schemas.microsoft.com/developer/msbuild/2003' />"
Query="//msb:DxaFrameworkLibs/@Include"
Value="..\packages\Sdl.Dxa.Framework.Web8.$(PackageVersion)\lib\net452\*.*" />
<XmlPoke
XmlInputPath="$(DxaFrameworkPackageDirectory)\Sdl.Dxa.Framework.2013SP1.targets"
Namespaces="<Namespace Prefix='msb' Uri='http://schemas.microsoft.com/developer/msbuild/2003' />"
Query="//msb:DxaFrameworkLibs/@Include"
Value="..\packages\Sdl.Dxa.Framework.2013SP1.$(PackageVersion)\lib\net452\*.*" />
<Exec Command="$(NuGet) pack Sdl.Dxa.Framework.Web8.nuspec -Version $(PackageVersion)" WorkingDirectory="$(DxaFrameworkPackageDirectory)" />
<Exec Command="$(NuGet) pack Sdl.Dxa.Framework.2013SP1.nuspec -Version $(PackageVersion)" WorkingDirectory="$(DxaFrameworkPackageDirectory)" />
</Target>
<!-- ============================================================================================================================================= -->
<Target Name="PublishPackages">
<Message Text="Publishing NuGet packages to '$(NuGetRepositoryUrl)' ..." Importance="high" />
<Exec Command="$(NuGet) push Sdl.Dxa.Framework.Web8.$(PackageVersion).nupkg -Source $(NuGetRepositoryUrl)" WorkingDirectory="$(DxaFrameworkPackageDirectory)" />
<Exec Command="$(NuGet) push Sdl.Dxa.Framework.2013SP1.$(PackageVersion).nupkg -Source $(NuGetRepositoryUrl)" WorkingDirectory="$(DxaFrameworkPackageDirectory)" />
</Target>
<!-- ============================================================================================================================================= -->
<Target Name="DeployOutput">
<Message Text="Deploying output to '$(CdTestDeployFolder)'..." />
<ItemGroup>
<ConfigFiles Include="$(ProjectDirectory)\Site\*.config;$(ProjectDirectory)\Site\Global.asax" />
<ViewFiles Include="$(ProjectDirectory)\Site\Views\**\*" />
<AreaFiles Include="$(ProjectDirectory)\Site\Areas\**\*" />
<BinFiles Include="$(ProjectDirectory)\Site\bin\*" />
</ItemGroup>
<Copy SourceFiles="@(ConfigFiles)" DestinationFolder="$(CdTestDeployFolder)" />
<Copy SourceFiles="@(ViewFiles)" DestinationFolder="$(CdTestDeployFolder)\Views\%(RecursiveDir)" />
<Copy SourceFiles="@(AreaFiles)" DestinationFolder="$(CdTestDeployFolder)\Areas\%(RecursiveDir)" />
<Copy SourceFiles="@(BinFiles)" DestinationFolder="$(CdTestDeployFolder)\bin\%(RecursiveDir)" />
</Target>
</Project>