forked from git-tfs/git-tfs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Release.proj
124 lines (104 loc) · 5.45 KB
/
Release.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
<?xml version="1.0"?>
<Project ToolsVersion="4.0" DefaultTargets="Help" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OriginUrl>https://github.com/git-tfs/git-tfs.git</OriginUrl>
<SolutionDir>.</SolutionDir>
<BuildDir>$(SolutionDir)/GitTfs/bin/Release</BuildDir>
<PackagedDir>$(SolutionDir)/Releases</PackagedDir>
<TargetPlatform>AnyCPU</TargetPlatform>
<TargetPlatform Condition="Exists('$(SolutionDir)/GitTfs.Vs2008/GitTfs.Vs2008.csproj')">x86</TargetPlatform>
<VersionFilePath>$(SolutionDir)\Version.cs</VersionFilePath>
<Archive>$(PackagedDir)/GitTfs-$(Version).zip</Archive>
</PropertyGroup>
<PropertyGroup>
<PackagesConfig>$(SolutionDir)/.nuget/packages.config</PackagesConfig>
<RequireRestoreConsent>false</RequireRestoreConsent>
<MSBuildCommunityTasksPath>$(SolutionDir)/packages/MSBuildTasks.1.4.0.45/tools</MSBuildCommunityTasksPath>
<MSBuildCommunityTasksLib>$(MSBuildCommunityTasksPath)/MSBuild.Community.Tasks.dll</MSBuildCommunityTasksLib>
</PropertyGroup>
<Import Project="$(SolutionDir)/.nuget/nuget.targets" />
<Target Name="MSBuildCommunityTasks" DependsOnTargets="RestorePackages" />
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.TemplateFile" />
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Zip" />
<Target Name="Help">
<ReadLinesFromFile File="Releasing.md">
<Output TaskParameter="Lines" ItemName="DeployInstructions"/>
</ReadLinesFromFile>
<Message Text="@(DeployInstructions->'%(Identity)','%0a%0d')" />
</Target>
<Target Name="Release" DependsOnTargets="UpdateVersion; TagSource; Build; PushSource; Package">
</Target>
<Target Name="Build">
<MSBuild Projects="GitTfs.sln" Targets="Rebuild" Properties="Configuration=Release;Platform=$(TargetPlatform);WarningLevel=0" />
</Target>
<ItemGroup>
<ReleaseFiles Include="$(SolutionDir)\README.md" />
<ReleaseFiles Include="$(SolutionDir)\LICENSE" />
<ReleaseFiles Include="$(SolutionDir)\NOTICE" />
<ReleaseFiles Include="$(BuildDir)\git-tfs.exe" />
<ReleaseFiles Include="$(BuildDir)\*.config" />
<ReleaseFiles Include="$(BuildDir)\*.dll" Exclude="$(BuildDir)\Microsoft.*.dll" />
<ReleaseFiles Include="$(BuildDir)\NativeBinaries\**\*.dll" />
</ItemGroup>
<Target Name="Package" DependsOnTargets="MSBuildCommunityTasks">
<Zip Files="@(ReleaseFiles)" ZipFileName="$(Archive)" WorkingDirectory="$(BuildDir)" />
</Target>
<Target Name="UpdateVersion">
<Error Text="You should specify a version number!" Condition="'$(Version)' == ''" />
<WriteLinesToFile File="$(VersionFilePath)" Lines="partial class GitTfsProperties { public const string Version = %22$(Version)%22%3B ; }" Overwrite="true" Encoding="ASCII"/>
<Exec Command="git add $(VersionFilePath)" />
<Exec Command="git commit -m v$(Version)" />
</Target>
<Target Name="TagSource">
<Exec Command="git tag v$(Version)" />
</Target>
<Target Name="PushSource">
<Exec Command="git push $(OriginUrl) master v$(Version)" />
</Target>
<Target Name="Chocolatey" DependsOnTargets="CleanChocolateyTempDir; PushChocolateyPackage">
</Target>
<PropertyGroup>
<ChocolateyBuildDir>$(SolutionDir)\tmp\choc</ChocolateyBuildDir>
<ChocolateyTemplateDir>$(SolutionDir)\ChocolateyTemplates</ChocolateyTemplateDir>
<ChocolateyNupkg>$(ChocolateyBuildDir)\gittfs.$(Version).nupkg</ChocolateyNupkg>
</PropertyGroup>
<ItemGroup>
<ChocolateyTokens Include="PackageVersion">
<ReplacementValue>$(Version)</ReplacementValue>
</ChocolateyTokens>
<ChocolateyTokens Include="DownloadUrl">
<ReplacementValue>$(DownloadUrl)</ReplacementValue>
</ChocolateyTokens>
<!-- TemplateFile needs a full path, so we define the output files here so that MSBuild can resolve the paths. -->
<ChocolateyNuspec Include="$(ChocolateyBuildDir)\gittfs.nuspec" />
<ChocolateyInstallScript Include="$(ChocolateyBuildDir)/tools/chocolateyInstall.ps1" />
</ItemGroup>
<Target Name="ChocolateyProperties">
<Error Text="You should specify a version number! (/p:Version=X.Y.Z)" Condition="'$(Version)' == ''" />
<Error Text="You should specify a download url! (/p:DownloadUrl=http://host/path/GitTfs-X.Y.Z.zip)" Condition="'$(DownloadUrl)' == ''" />
</Target>
<Target Name="CleanChocolateyTempDir">
<RemoveDir Directories="$(ChocolateyBuildDir)" />
</Target>
<Target Name="ChocolateyTempDir">
<MakeDir Directories="$(ChocolateyBuildDir)\tools" />
</Target>
<Target Name="ChocolateyNuspec" DependsOnTargets="ChocolateyProperties; MSBuildCommunityTasks; ChocolateyTempDir">
<TemplateFile
Template="$(ChocolateyTemplateDir)\gittfs.nuspec"
OutputFilename="%(ChocolateyNuspec.FullPath)"
Tokens="@(ChocolateyTokens)" />
</Target>
<Target Name="ChocolateyInstallScript" DependsOnTargets="ChocolateyProperties; MSBuildCommunityTasks; ChocolateyTempDir">
<TemplateFile
Template="$(ChocolateyTemplateDir)\chocolateyInstall.ps1"
OutputFilename="%(ChocolateyInstallScript.FullPath)"
Tokens="@(ChocolateyTokens)" />
</Target>
<Target Name="BuildChocolateyPackage" DependsOnTargets="ChocolateyNuspec; ChocolateyInstallScript">
<Exec Command="cpack" WorkingDirectory="$(ChocolateyBuildDir)" />
</Target>
<Target Name="PushChocolateyPackage" DependsOnTargets="BuildChocolateyPackage">
<Exec Command="cpush $(ChocolateyNupkg)" />
</Target>
</Project>