forked from devlooped/moq
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.proj
88 lines (75 loc) · 4.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
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0"
DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildThisFileDirectory)Common\ClariusLabs.tasks" />
<PropertyGroup>
<Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
<BuildRoot>$(MSBuildThisFileDirectory)</BuildRoot>
<DropDirectory>$(BuildRoot)build\</DropDirectory>
<NuGetExe>$(BuildRoot).nuget\NuGet.exe</NuGetExe>
<ReleaseNotes>$([System.IO.File]::ReadAllText('$(BuildRoot)ReleaseNotes.md'))</ReleaseNotes>
</PropertyGroup>
<Target Name="Build" DependsOnTargets="ReplaceCurrentVersions">
<MakeDir Directories="$(DropDirectory)" Condition="!Exists('$(DropDirectory)')" />
<Delete Files="$(DropDirectory)**\*.*" ContinueOnError="false" />
<MSBuild Projects="Source\Moq.csproj"
Properties="NuGet=true;TargetFrameworkVersion=v3.5;Configuration=$(Configuration)"
Targets="Rebuild" />
<Exec Command="xcopy "Source\bin\Release\Moq.*" "$(DropDirectory)lib\net35\" /Y" ContinueOnError="false" />
<MSBuild Projects="Source\Moq.csproj"
Properties="NuGet=true;TargetFrameworkVersion=v4.0;Configuration=$(Configuration)"
Targets="Rebuild" />
<Exec Command="xcopy "Source\bin\Release\Moq.*" "$(DropDirectory)lib\net40\" /Y" ContinueOnError="false" />
<MSBuild Projects="Source.Silverlight\Moq.Silverlight.csproj"
Properties="Configuration=$(Configuration)"
Targets="Rebuild" />
<Exec Command="xcopy "Source.Silverlight\bin\Release\Moq.*" "$(DropDirectory)lib\sl4\" /Y" ContinueOnError="false" />
<Copy SourceFiles="Moq.nuspec" DestinationFolder="$(DropDirectory)" />
<!-- Copy source for symbolsource integration -->
<ItemGroup>
<SymbolSource Include="Source\**\*.cs" />
</ItemGroup>
<Copy SourceFiles="@(SymbolSource)" DestinationFiles="@(SymbolSource->'$(DropDirectory)src\%(RecursiveDir)%(Filename)%(Extension)')" ContinueOnError="false" SkipUnchangedFiles="true" OverwriteReadOnlyFiles="true" />
<!-- Finally build the package -->
<Exec Command="$(NuGetExe) pack -NoPackageAnalysis $(DropDirectory)Moq.nuspec -Symbols -OutputDirectory $(DropDirectory) -Version $(PackageVersion)"
ContinueOnError="false" />
</Target>
<Target Name="ReplaceCurrentVersions">
<ReadAssemblyVersion File="Source\Properties\AssemblyInfo.cs">
<Output PropertyName="Major"
TaskParameter="Major"/>
<Output PropertyName="Minor"
TaskParameter="Minor"/>
</ReadAssemblyVersion>
<PropertyGroup Condition="'$(FileVersion)' == ''">
<!-- Build number is of the format (2 digit year)(2 digit month) -->
<Build>$([System.DateTime]::UtcNow.ToString("yyMM"))</Build>
<!-- Revision number is of the format (2 digit hour)(2 digit minutes) -->
<Revision>$([System.DateTime]::UtcNow.ToString("ddHH"))</Revision>
<FileVersion>$(Major).$(Minor).$(Build).$(Revision)</FileVersion>
<!-- TODO: maybe we should have two builds, one that builds the public simplified version
and one with the full build/revision -->
</PropertyGroup>
<PropertyGroup>
<PackageVersion>$(FileVersion)</PackageVersion>
</PropertyGroup>
<ItemGroup>
<_VersionRegexTransform Include="Source\Properties\AssemblyInfo.cs">
<Find>AssemblyFileVersion\(".*?"\)</Find>
<ReplaceWith>AssemblyFileVersion("$(FileVersion)")</ReplaceWith>
</_VersionRegexTransform>
<_VersionRegexTransform Include="Source\Properties\AssemblyInfo.cs">
<Find>AssemblyVersion\(".*?"\)</Find>
<ReplaceWith>AssemblyVersion("$(FileVersion)")</ReplaceWith>
</_VersionRegexTransform>
<_VersionRegexTransform Include="$(BuildRoot)**\*.nuspec"
Condition="'$(ReleaseNotes)' != ''">
<Find><![CDATA[<releaseNotes />|<releaseNotes/>|<releaseNotes>.*</releaseNotes>]]></Find>
<ReplaceWith><![CDATA[<releaseNotes>$(ReleaseNotes)</releaseNotes>]]></ReplaceWith>
<Options>Singleline</Options>
</_VersionRegexTransform>
</ItemGroup>
<RegexTransform Items="@(_VersionRegexTransform)" />
</Target>
</Project>