|
1 | 1 | <?xml version="1.0" encoding="utf-8"?>
|
2 |
| -<Project DefaultTargets="Cleanup;Build;Package" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
| 2 | +<Project DefaultTargets="Cleanup;Build;Package" ToolsVersion="12" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
3 | 3 | <PropertyGroup>
|
4 | 4 | <Root>$(MSBuildProjectDirectory)\</Root>
|
5 | 5 | <BuildPlatform Condition="$(BuildPlatform) == ''">Any CPU</BuildPlatform>
|
|
38 | 38 | <xunit Assembly="$(Root)src\GitReleaseNotes.AcceptanceTests\bin\$(Configuration)\GitReleaseNotes.AcceptanceTests.dll" ShadowCopy="False" />
|
39 | 39 | </Target>
|
40 | 40 |
|
| 41 | + <UsingTask TaskName="ReplaceFileText" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v$(MSBuildToolsVersion).dll"> |
| 42 | + <ParameterGroup> |
| 43 | + <InputFilename ParameterType="System.String" Required="true" /> |
| 44 | + <OutputFilename ParameterType="System.String" Required="true" /> |
| 45 | + <MatchExpression ParameterType="System.String" Required="true" /> |
| 46 | + <ReplacementText ParameterType="System.String" Required="true" /> |
| 47 | + </ParameterGroup> |
| 48 | + <Task> |
| 49 | + <Reference Include="System.Core" /> |
| 50 | + <Using Namespace="System" /> |
| 51 | + <Using Namespace="System.IO" /> |
| 52 | + <Using Namespace="System.Text.RegularExpressions" /> |
| 53 | + <Code Type="Fragment" Language="cs"> |
| 54 | + <![CDATA[ |
| 55 | + File.WriteAllText( |
| 56 | + OutputFilename, |
| 57 | + Regex.Replace(File.ReadAllText(InputFilename), MatchExpression, ReplacementText) |
| 58 | + ); |
| 59 | + ]]> |
| 60 | + </Code> |
| 61 | + </Task> |
| 62 | + </UsingTask> |
| 63 | + |
41 | 64 | <Target Name="Package" DependsOnTargets="Test">
|
42 | 65 | <ItemGroup>
|
43 |
| - <BuildOutput Include="$(Root)src\GitHubFlowVersion\bin\$(Configuration)\**\*.*"/> |
| 66 | + <BuildOutput Include="$(BuildOutputPath)\**\*.*" Exclude="$(BuildOutputPath)\**\*.vshost.exe"/> |
44 | 67 | </ItemGroup>
|
45 | 68 |
|
46 |
| - <Copy SourceFiles="@(BuildOutput)" |
47 |
| - DestinationFiles="@(BuildOutput->'$(DropPath)%(RecursiveDir)%(Filename)%(Extension)')" /> |
48 |
| - |
49 | 69 | <MakeDir Directories="$(DropPath)" />
|
50 |
| - <Exec Command="$(Root)src\.NuGet\NuGet.exe pack $(Root)GitReleaseNotes.nuspec -BasePath $(BuildOutputPath) -OutputDirectory $(DropPath) -Properties Version=$(GitHubFlowVersion_SemVer) -Tool"/> |
| 70 | + <MakeDir Directories="$(DropPath)\NuGet" /> |
| 71 | + <MakeDir Directories="$(DropPath)\Chocolatey" /> |
| 72 | + <MakeDir Directories="$(Root)\ChocolateyBackup" /> |
| 73 | + <Exec Command="$(Root)src\.NuGet\NuGet.exe pack $(Root)GitReleaseNotes.nuspec -BasePath $(BuildOutputPath) -OutputDirectory $(DropPath)NuGet -Properties Version=$(GitHubFlowVersion_SemVer) -Tool"/> |
| 74 | + |
| 75 | + <Zip Files="@(BuildOutput)" |
| 76 | + WorkingDirectory="$(BuildOutputPath)" |
| 77 | + ZipFileName="$(DropPath)GitReleaseNotes.$(GitHubFlowVersion_SemVer).zip" |
| 78 | + ZipLevel="9" /> |
| 79 | + |
| 80 | + <MakeDir Directories="$(Root)\ChocolateyBackup" /> |
| 81 | + <Copy SourceFiles="$(Root)Chocolatey\tools\chocolateyInstall.ps1" |
| 82 | + DestinationFolder="$(Root)\ChocolateyBackup" /> |
| 83 | + <Copy SourceFiles="$(Root)Chocolatey\GitReleaseNotes.nuspec" |
| 84 | + DestinationFolder="$(Root)\ChocolateyBackup" /> |
| 85 | + |
| 86 | + <ReplaceFileText InputFilename="$(Root)Chocolatey\tools\chocolateyInstall.ps1" |
| 87 | + OutputFilename="$(Root)Chocolatey\tools\chocolateyInstall.ps1" |
| 88 | + MatchExpression="__version__" |
| 89 | + ReplacementText="$(GitHubFlowVersion_SemVer)" /> |
| 90 | + |
| 91 | + <ReplaceFileText InputFilename="$(Root)Chocolatey\GitReleaseNotes.nuspec" |
| 92 | + OutputFilename="$(Root)Chocolatey\GitReleaseNotes.nuspec" |
| 93 | + MatchExpression="__version__" |
| 94 | + ReplacementText="$(GitHubFlowVersion_SemVer)" /> |
| 95 | + |
| 96 | + <Exec Command="cpack $(Root)Chocolatey\GitReleaseNotes.nuspec" WorkingDirectory="$(DropPath)\Chocolatey" /> |
| 97 | + |
| 98 | + <Copy SourceFiles="$(Root)\ChocolateyBackup\chocolateyInstall.ps1" |
| 99 | + DestinationFolder="$(Root)\Chocolatey\tools" /> |
| 100 | + <Copy SourceFiles="$(Root)ChocolateyBackup\GitReleaseNotes.nuspec" |
| 101 | + DestinationFolder="$(Root)\Chocolatey" /> |
| 102 | + |
| 103 | + <RemoveDir Directories="$(Root)ChocolateyBackup" /> |
51 | 104 | </Target>
|
52 | 105 | </Project>
|
0 commit comments