dc43a8180c
Fix warnings and problems introduced by #1019 (Test assembly was no more loadable by the xunit console runner on my computer) and update build file to build in x86
234 lines
11 KiB
XML
234 lines
11 KiB
XML
<?xml version="1.0"?>
|
|
<Project ToolsVersion="4.0" DefaultTargets="Help" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
|
|
<PropertyGroup>
|
|
<!-- Where the solution lives, relative to this file. -->
|
|
<SolutionDir>.</SolutionDir>
|
|
|
|
<!-- The file that includes the AssemblyVersionAttribute. -->
|
|
<VersionFilePath>$(SolutionDir)\Version.cs</VersionFilePath>
|
|
|
|
<!-- git-tfs can run as 32-bit or 64-bit. -->
|
|
<TargetPlatform>x86</TargetPlatform>
|
|
|
|
<!-- Where git-tfs.exe and its dependencies are built. -->
|
|
<BuildDir>$(SolutionDir)/GitTfs/bin/Release</BuildDir>
|
|
|
|
<!-- The name of the output zip file. -->
|
|
<PackagedDir>$(SolutionDir)/Releases</PackagedDir>
|
|
<PackageFile>GitTfs-$(Version).zip</PackageFile>
|
|
<Archive>$(PackagedDir)/$(PackageFile)</Archive>
|
|
|
|
<!-- The default location of the release notes -->
|
|
<ReleaseNotes Condition="'$(ReleaseNotes)' == ''">$(SolutionDir)/doc/release-notes/v$(VERSION).md</ReleaseNotes>
|
|
|
|
<!-- Where to push the release tag. -->
|
|
<GitHubOwner>git-tfs</GitHubOwner>
|
|
<GitHubRepository>git-tfs</GitHubRepository>
|
|
<OriginUrl>https://github.com/$(GitHubOwner)/$(GitHubRepository).git</OriginUrl>
|
|
|
|
<!-- The API doesn't provide this, but it follows a pattern that we can mimic. -->
|
|
<DownloadUrl>https://github.com/git-tfs/git-tfs/releases/download/v$(Version)/$(PackageFile)</DownloadUrl>
|
|
|
|
<!-- A directory to use when changing the download button on the website. -->
|
|
<WebSiteDir>$(PackagedDir)/git-tfs.github.com</WebSiteDir>
|
|
<DownloadButton>_includes/download_button.html</DownloadButton>
|
|
<WebSiteRepository>https://github.com/$(GitHubOwner)/git-tfs.github.com.git</WebSiteRepository>
|
|
|
|
<DryRun Condition="'$(DryRun)' == ''">True</DryRun>
|
|
</PropertyGroup>
|
|
|
|
<!-- Internal. -->
|
|
<Target Name="VersionRequired">
|
|
<Error Text="You must specify a version number! (/p:Version=X.Y.Z)" Condition="'$(Version)' == ''" />
|
|
</Target>
|
|
|
|
<!-- Try to load the oauth token -->
|
|
<Import Project="Auth.targets" Condition="Exists('Auth.targets')" />
|
|
|
|
<!-- Internal. -->
|
|
<Target Name="AuthTokenRequired">
|
|
<Error Text="You must set a github.com auth token in auth.targets (see auth.targets.example)" Condition="'$(DryRun)' == 'False' And '$(GitHubAuthToken)' == ''" />
|
|
</Target>
|
|
|
|
<!-- The contents of the zip. -->
|
|
<Target Name="DefineReleaseFiles">
|
|
<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)\LibGit2Sharp.dll" />
|
|
<ReleaseFiles Include="$(BuildDir)\NDesk.Options.dll" />
|
|
<ReleaseFiles Include="$(BuildDir)\StructureMap.dll" />
|
|
<ReleaseFiles Include="$(BuildDir)\NativeBinaries\**\*.dll" />
|
|
<ReleaseFiles Include="$(BuildDir)\GitTfs.Vs20*\GitTfs.Vs20*.dll" />
|
|
<ReleaseFiles Include="$(BuildDir)\GitTfs.Vs2015\*.dll" Exclude="$(BuildDir)\GitTfs.Vs2015\GitTfs.Vs20*.dll" />
|
|
</ItemGroup>
|
|
</Target>
|
|
|
|
<!-- The zip. -->
|
|
<ItemGroup>
|
|
<ArchiveFile Include="$(Archive)">
|
|
<ContentType>application/zip</ContentType>
|
|
</ArchiveFile>
|
|
</ItemGroup>
|
|
|
|
<!-- Use nuget get dependencies. (Dependencies are not checked in to git.) -->
|
|
<PropertyGroup>
|
|
<MSBuildCommunityTasksPath>$(SolutionDir)/packages/MSBuildTasks/tools</MSBuildCommunityTasksPath>
|
|
<MSBuildCommunityTasksLib>$(MSBuildCommunityTasksPath)/MSBuild.Community.Tasks.dll</MSBuildCommunityTasksLib>
|
|
<MSBuildGitTfsTasksLib>$(SolutionDir)/packages/MSBuildGitTfsTasks/GitTfsTasks.dll</MSBuildGitTfsTasksLib>
|
|
</PropertyGroup>
|
|
<Target Name="RestorePackages">
|
|
<Exec Command="$(SolutionDir)\.paket\paket.bootstrapper.exe" />
|
|
<Exec Command="$(SolutionDir)\.paket\paket.exe restore" />
|
|
</Target>
|
|
|
|
<!-- Load some extra tasks. -->
|
|
<Target Name="MSBuildCommunityTasks" DependsOnTargets="RestorePackages" />
|
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.TemplateFile" />
|
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.Zip" />
|
|
<UsingTask AssemblyFile="$(MSBuildCommunityTasksLib)" TaskName="MSBuild.Community.Tasks.FileUpdate" />
|
|
<UsingTask AssemblyFile="$(MSBuildGitTfsTasksLib)" TaskName="GitTfsTasks.CreateRelease" />
|
|
|
|
<!-- Default: Show the howto. -->
|
|
<Target Name="Help">
|
|
<ReadLinesFromFile File="Releasing.md">
|
|
<Output TaskParameter="Lines" ItemName="DeployInstructions"/>
|
|
</ReadLinesFromFile>
|
|
<Message Text="@(DeployInstructions->'%(Identity)','%0a%0d')" />
|
|
</Target>
|
|
|
|
<!-- Public: Build the release and put it on github.com -->
|
|
<Target Name="Release" DependsOnTargets="EverythingRequired; UpdateVersion; Build; TagSource; PushSource; Package; ReleaseOnGitHub; Chocolatey">
|
|
</Target>
|
|
|
|
<!-- Internal: If we don't have all the information we need, bail early. -->
|
|
<Target Name="EverythingRequired" DependsOnTargets="VersionRequired; AuthTokenRequired">
|
|
</Target>
|
|
|
|
<!-- Internal: Called by Release to set the new version. -->
|
|
<Target Name="UpdateVersion" DependsOnTargets="UpdateAssemblyVersionAttribute; UpdateVersionInAppVeyorConfig">
|
|
<!-- This is OK to fail. If a previous release attempt failed, the commit will now be empty. -->
|
|
<Exec Condition="'$(DryRun)' == 'False'" Command="git commit -m v$(Version) $(VersionFilePath) appveyor.yml" IgnoreExitCode="true" />
|
|
<Message Condition="'$(DryRun)' != 'False'" Text="(would git commit -m v$(Version) $(VersionFilePath) appveyor.yml)" />
|
|
</Target>
|
|
|
|
<!-- Internal. -->
|
|
<Target Name="UpdateAssemblyVersionAttribute" DependsOnTargets="VersionRequired">
|
|
<WriteLinesToFile File="$(VersionFilePath)" Lines="partial class GitTfsProperties ; { ; public const string Version = %22$(Version)%22%3B ; }" Overwrite="true" Encoding="ASCII"/>
|
|
</Target>
|
|
|
|
<!-- Internal. -->
|
|
<Target Name="UpdateVersionInAppVeyorConfig" DependsOnTargets="VersionRequired; MSBuildCommunityTasks">
|
|
<FileUpdate Files="appveyor.yml" Regex="version: .*\.{build}" ReplacementText="version: $(Version).{build}" />
|
|
</Target>
|
|
|
|
<!-- Internal: Called by release to compile git-tfs.exe -->
|
|
<Target Name="Build">
|
|
<MSBuild Projects="GitTfs.sln" Targets="Rebuild" Properties="Configuration=Release;Platform=$(TargetPlatform);WarningLevel=0" />
|
|
</Target>
|
|
|
|
<!-- Internal: Called by Release to tag the git-tfs repository. -->
|
|
<Target Name="TagSource" DependsOnTargets="VersionRequired">
|
|
<Exec Command="git tag -f v$(Version)" />
|
|
</Target>
|
|
|
|
<!-- Internal: Called by Release to push the release tag to github.com -->
|
|
<Target Name="PushSource" DependsOnTargets="VersionRequired">
|
|
<!-- Do these separately so that the push to master blocks the push of the tag. -->
|
|
<Exec Condition="'$(DryRun)' == 'False'" Command="git push $(OriginUrl) HEAD:refs/heads/master" />
|
|
<Exec Condition="'$(DryRun)' == 'False'" Command="git push $(OriginUrl) v$(Version)" />
|
|
<Message Condition="'$(DryRun)' != 'False'" Text="(would push to github.com)" />
|
|
</Target>
|
|
|
|
<!-- Internal: Called by Release to create the zip. -->
|
|
<Target Name="Package" DependsOnTargets="VersionRequired; MSBuildCommunityTasks; DefineReleaseFiles">
|
|
<Zip Files="@(ReleaseFiles)" ZipFileName="$(Archive)" WorkingDirectory="$(BuildDir)" />
|
|
</Target>
|
|
|
|
<!-- Internal: Create a release on github.com -->
|
|
<Target Name="ReleaseOnGitHub" DependsOnTargets="VersionRequired; AuthTokenRequired; MSBuildCommunityTasks">
|
|
<CreateRelease Condition="'$(DryRun)' == 'False'" Repository="$(GitHubOwner)/$(GitHubRepository)" TagName="v$(Version)" Files="@(ArchiveFile)" OauthToken="$(GitHubAuthToken)" ReleaseNotesFile="$(ReleaseNotes)" ContinueOnError="ErrorAndContinue" />
|
|
<Message Condition="'$(DryRun)' != 'False'" Text="(would create release on github.com)" />
|
|
</Target>
|
|
|
|
<!-- Internal: Build and upload a chocolatey package. -->
|
|
<Target Name="Chocolatey" DependsOnTargets="CleanChocolateyTempDir; PushChocolateyPackage">
|
|
</Target>
|
|
|
|
<!-- Chocolatey-releated properties. -->
|
|
<PropertyGroup>
|
|
<ChocolateyBuildDir>$(SolutionDir)\tmp\choc</ChocolateyBuildDir>
|
|
<ChocolateyTemplateDir>$(SolutionDir)\ChocolateyTemplates</ChocolateyTemplateDir>
|
|
<ChocolateyNupkg>$(ChocolateyBuildDir)\gittfs.$(Version).nupkg</ChocolateyNupkg>
|
|
</PropertyGroup>
|
|
|
|
<!-- Chocolatey-related files. -->
|
|
<ItemGroup>
|
|
<!-- 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>
|
|
|
|
<!-- Internal. -->
|
|
<Target Name="CleanChocolateyTempDir">
|
|
<RemoveDir Directories="$(ChocolateyBuildDir)" />
|
|
</Target>
|
|
|
|
<!-- Internal. -->
|
|
<Target Name="ChocolateyTempDir">
|
|
<MakeDir Directories="$(ChocolateyBuildDir)\tools" />
|
|
</Target>
|
|
|
|
<!-- Internal. -->
|
|
<Target Name="ChocolateyReadReleaseNotes">
|
|
<ReadLinesFromFile File="$(ReleaseNotes)" Condition="'$(ReleaseNotes)' != ''">
|
|
<Output TaskParameter="Lines" ItemName="ReleaseNotesContents" />
|
|
</ReadLinesFromFile>
|
|
<ItemGroup Condition="'$(ReleaseNotes)' == ''">
|
|
<ReleaseNotesContents Include="See https://github.com/git-tfs/git-tfs/releases/tag/v$(Version)" />
|
|
</ItemGroup>
|
|
</Target>
|
|
|
|
<!-- Internal: Generate a nuspec file for the chocolatey package. -->
|
|
<Target Name="ChocolateyNuspec" DependsOnTargets="VersionRequired; MSBuildCommunityTasks; ChocolateyTempDir; ChocolateyReadReleaseNotes">
|
|
<ItemGroup>
|
|
<ChocolateyTokens Include="PackageVersion">
|
|
<ReplacementValue>$(Version)</ReplacementValue>
|
|
</ChocolateyTokens>
|
|
<ChocolateyTokens Include="DownloadUrl">
|
|
<ReplacementValue>$(DownloadUrl)</ReplacementValue>
|
|
</ChocolateyTokens>
|
|
<ChocolateyTokens Include="ReleaseNotesContents">
|
|
<ReplacementValue>https://github.com/git-tfs/git-tfs/tree/master/doc/release-notes</ReplacementValue>
|
|
</ChocolateyTokens>
|
|
</ItemGroup>
|
|
<TemplateFile
|
|
Template="$(ChocolateyTemplateDir)\gittfs.nuspec"
|
|
OutputFilename="%(ChocolateyNuspec.FullPath)"
|
|
Tokens="@(ChocolateyTokens)" />
|
|
</Target>
|
|
|
|
<!-- Internal: Generate an install script for the chocolatey package. -->
|
|
<Target Name="ChocolateyInstallScript" DependsOnTargets="VersionRequired; MSBuildCommunityTasks; ChocolateyTempDir">
|
|
<TemplateFile
|
|
Template="$(ChocolateyTemplateDir)\chocolateyInstall.ps1"
|
|
OutputFilename="%(ChocolateyInstallScript.FullPath)"
|
|
Tokens="@(ChocolateyTokens)" />
|
|
</Target>
|
|
|
|
<!-- Internal. -->
|
|
<Target Name="BuildChocolateyPackage" DependsOnTargets="ChocolateyNuspec; ChocolateyInstallScript">
|
|
<Exec Command="cpack" WorkingDirectory="$(ChocolateyBuildDir)" />
|
|
</Target>
|
|
|
|
<!-- Internal. -->
|
|
<Target Name="PushChocolateyPackage" DependsOnTargets="BuildChocolateyPackage">
|
|
<Exec Condition="'$(DryRun)' == 'False'" Command="cpush $(ChocolateyNupkg)" />
|
|
<Message Condition="'$(DryRun)' != 'False'" Text="(would push chocolatey package)" />
|
|
</Target>
|
|
</Project>
|