This repository has been archived by the owner on Mar 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.proj
159 lines (126 loc) · 6.58 KB
/
build.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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="BuildAll" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildTarget Condition="'$(BuildTarget)' == ''">Rebuild</BuildTarget>
<BuildConfig Condition="'$(BuildConfig)' == ''">Debug</BuildConfig>
</PropertyGroup>
<PropertyGroup>
<MSBuildCommunityTasksPath>$(MSBuildProjectDirectory)\src\.build</MSBuildCommunityTasksPath>
</PropertyGroup>
<Import Project="$(MSBuildCommunityTasksPath)\MSBuild.Community.Tasks.targets"/>
<!-- Directories -->
<PropertyGroup>
<RootDir>$(MSBuildProjectDirectory)</RootDir>
<SrcDir>$(RootDir)\Src</SrcDir>
<BinDir>$(SrcDir)\bin</BinDir>
<OutputDir>$(SrcDir)\out</OutputDir>
<NuGetExe>$(SrcDir)\.nuget\nuget.exe</NuGetExe>
<PackagesOutDir>$(OutputDir)\packages</PackagesOutDir>
<PackagesSrcDir>$(OutputDir)\nuget</PackagesSrcDir>
<TestsBinDir>$(SrcDir)\bin\$(BuildConfig)</TestsBinDir>
</PropertyGroup>
<Import Project="$(RootDir)\PackageDefinitions.xml" />
<PropertyGroup>
<MainSolution>$(SrcDir)\Alphacloud.Common.sln</MainSolution>
<CoreDir>$(SrcDir)\Core</CoreDir>
<InfrastructureDir>$(SrcDir)\Infrastructure</InfrastructureDir>
<MemcachedAdapterDir>$(SrcDir)\Integration\Caching.Memcached</MemcachedAdapterDir>
<MemcachedCommonLoggingAdapterDir>$(SrcDir)\Integration\Caching.Memcached.CommonLogging</MemcachedCommonLoggingAdapterDir>
<CastleWindsorAdapterDir>$(SrcDir)\ServiceLocator.Castle</CastleWindsorAdapterDir>
<TestingNunitDir>$(SrcDir)\Testing.Nunit</TestingNunitDir>
<WebProjectsDir>$(SrcDir)\Web</WebProjectsDir>
</PropertyGroup>
<PropertyGroup>
<!--<UseHardLinks>CreateHardLinksForCopyAdditionalFilesIfPossible=true;CreateHardLinksForCopyFilesToOutputDirectoryIfPossible=true;CreateHardLinksForCopyLocalIfPossible=true;CreateHardLinksForAdditionalFilesIfPossible=true;CreateHardLinksForPublishFilesIfPossible=true</UseHardLinks>-->
</PropertyGroup>
<Target Name="UpdateVersionInfo">
<Message Text="Updating %(PackageDefinition.Identity), version: %(PackageDefinition.Version)" />
<Time>
<Output TaskParameter="Year" PropertyName="CurrentYear" />
</Time>
<FileUpdate Files="%(PackageDefinition.RootFolder)\Properties\AssemblyInfo.cs"
WarnOnNoUpdate="true"
Regex="((?:AssemblyVersion|AssemblyFileVersion)\s*\(\s*)\"(.+)\"(\s*\))"
ReplacementText="$1"%(PackageDefinition.Version)"$3" />
<XmlUpdate
Prefix="nu" Namespace="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"
XmlFileName="%(PackageDefinition.RootFolder)\%(PackageDefinition.NuspecFile)"
XPath="/nu:package/nu:metadata/nu:version"
Value="%(PackageDefinition.Version)" />
<XmlUpdate
Prefix="nu" Namespace="http://schemas.microsoft.com/packaging/2011/08/nuspec.xsd"
XmlFileName="%(PackageDefinition.RootFolder)\%(PackageDefinition.NuspecFile)"
XPath="/nu:package/nu:metadata/nu:copyright"
Value="Copyright (c) 2013-$(CurrentYear) Alphacloud.net" />
</Target>
<Target Name="BuildAndTest" DependsOnTargets="BuildAll">
<!--<CallTarget Targets="CleanAll"></CallTarget>-->
<!--<MSBuild Projects="$(RootDir)\build.proj" Targets="BuildAll" Properties="BuildConfig=Release;BuildTarget=Rebuild" />-->
<ItemGroup>
<NunitNet40TestAssemblies Include="$(TestsBinDir)\net40\Tests.*.Net40.dll">
</NunitNet40TestAssemblies>
<NunitNet45TestAssemblies Include="$(TestsBinDir)\net45\Tests.*.Net45.dll">
</NunitNet45TestAssemblies>
</ItemGroup>
<!-- todo: run tests -->
<Message Text="Runing .NET 4 tests - @(NunitNet40TestAssemblies)" />
<Message Text="Runing .NET 4.5 tests - @(NunitNet45TestAssemblies)" />
</Target>
<Target Name="BuildPackages">
<RemoveDir Directories="$(PackagesSrcDir);$(PackagesOutDir)" ContinueOnError="true" />
<MakeDir Directories="$(PackagesSrcDir);$(PackagesOutDir)" ContinueOnError="true" />
<Message Text="##teamcity[progressMessage 'Building NuGet packages...']" />
<Copy
SourceFiles="%(PackageDefinition.RootFolder)\%(PackageDefinition.NuspecFile)"
DestinationFiles="$(PackagesSrcDir)\%(PackageDefinition.Identity)\%(PackageDefinition.NuspecFile)"
UseHardlinksIfPossible="false" OverwriteReadOnlyFiles="true" Retries="5"
/>
<ItemGroup>
<PackageFiles Include="$(BinDir)\Release\**\Alphacloud.Common.%(PackageDefinition.Identity).dll;$(BinDir)\Release\**\Alphacloud.Common.%(PackageDefinition.Identity).xml">
<NuspecDir>%(PackageDefinition.Identity)</NuspecDir>
</PackageFiles>
</ItemGroup>
<!-- set dependency version in NuSpec files -->
<ItemGroup>
<NuSpecFiles Include="$(PackagesSrcDir)\**\*.nuspec">
</NuSpecFiles>
</ItemGroup>
<FileUpdate Files="@(NuSpecFiles)"
Regex="%Version\(%(PackageDefinition.Identity)\)"
ReplacementText="%(PackageDefinition.Version)"
/>
<Copy
SourceFiles="@(PackageFiles)"
DestinationFolder="$(PackagesSrcDir)\%(PackageFiles.NuspecDir)\lib\%(PackageFiles.RecursiveDir)\"
UseHardlinksIfPossible="true" OverwriteReadOnlyFiles="true" Retries="5"
/>
<NuGetPack File="$(PackagesSrcDir)\%(PackageDefinition.Identity)\%(PackageDefinition.NuspecFile)" OutputDirectory="$(PackagesOutDir)" />
<!--
<Message Text="##teamcity[progressMessage 'Building NuGet symbol packages...']" />
<ItemGroup>
<PdbFiles Include="$(BinDir)\Release\**\Alphacloud.Common.%(PackageDefinition.Identity).pdb">
<NuspecDir>%(PackageDefinition.Identity)</NuspecDir>
</PdbFiles>
</ItemGroup>
<Copy
SourceFiles="@(PdbFiles)"
DestinationFolder="$(PackagesSrcDir)\%(PdbFiles.NuspecDir)\lib\%(PdbFiles.RecursiveDir)\"
UseHardlinksIfPossible="true" OverwriteReadOnlyFiles="true" Retries="5"
/>
-->
<!--
todo: 2) Copy *.pdb and src\
todo: 3) Build symbols package
-->
</Target>
<Target Name="BuildAll">
<MSBuild Projects="$(SrcDir)\Alphacloud.Common.sln" Properties="Configuration=$(BuildConfig);$(UseHardLinks)" Targets="$(BuildTarget)"
BuildInParallel="false" />
</Target>
<Target Name="CleanAll">
<Message Text="Performing full clean-up..." />
<MSBuild Projects="$(MainSolution)" Properties="Configuration=Debug" Targets="Clean" BuildInParallel="true" />
<MSBuild Projects="$(MainSolution)" Properties="Configuration=Release" Targets="Clean" BuildInParallel="true" />
<DeleteTree Directories="$(SrcDir)\**\bin\**;$(SrcDir)\**\obj\**;$(SrcDir)\**\out\**;$(OutputDir);$(BinDir);$(SrcDir)\packages" />
</Target>
</Project>