|
98 | 98 | </ItemGroup>
|
99 | 99 | <Delete Files="@(ExeFilesToDelete)" />
|
100 | 100 | </Target>
|
| 101 | + <UsingTask TaskName="ReplaceFileText" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll"> |
| 102 | + <ParameterGroup> |
| 103 | + <InputFilename ParameterType="System.String" Required="true" /> |
| 104 | + <OutputFilename ParameterType="System.String" Required="true" /> |
| 105 | + <MatchExpression ParameterType="System.String" Required="true" /> |
| 106 | + <ReplacementText ParameterType="System.String" Required="true" /> |
| 107 | + </ParameterGroup> |
| 108 | + <Task> |
| 109 | + <Reference Include="System.Core" /> |
| 110 | + <Using Namespace="System" /> |
| 111 | + <Using Namespace="System.IO" /> |
| 112 | + <Using Namespace="System.Text.RegularExpressions" /> |
| 113 | + <Code Type="Fragment" Language="cs"> |
| 114 | + <![CDATA[ |
| 115 | + File.WriteAllText( |
| 116 | + OutputFilename, |
| 117 | + Regex.Replace(File.ReadAllText(InputFilename), MatchExpression, ReplacementText) |
| 118 | + ); |
| 119 | + ]]> |
| 120 | + </Code> |
| 121 | + </Task> |
| 122 | + </UsingTask> |
101 | 123 | <Target Name="AfterBuild" DependsOnTargets="Clean">
|
102 | 124 | <!-- NugetExeBuild -->
|
103 | 125 | <MakeDir Directories="$(SolutionDir)NuGetExeBuild" />
|
|
122 | 144 | <GemFiles Include="$(ProjectDir)GemAssets\*.gemspec" />
|
123 | 145 | </ItemGroup>
|
124 | 146 | <Copy SourceFiles="@(GemFiles)" DestinationFiles="@(GemFiles->'$(SolutionDir)GemBuild\%(RecursiveDir)%(Filename)%(Extension)')" />
|
| 147 | + <Copy SourceFiles="$(ProjectDir)GemAssets\gitversion" DestinationFolder="$(SolutionDir)GemBuild\bin" /> |
| 148 | + <Copy SourceFiles="$(ProjectDir)GemAssets\gitversion.gemspec" DestinationFolder="$(SolutionDir)GemBuild" /> |
| 149 | + |
| 150 | + <ReplaceFileText |
| 151 | + InputFilename="$(SolutionDir)GemBuild\gitversion.gemspec" |
| 152 | + OutputFilename="$(SolutionDir)GemBuild\gitversion.gemspec" |
| 153 | + MatchExpression="\$version\$" |
| 154 | + ReplacementText="$(GitVersion_SemVer)" |
| 155 | + Condition="'$(GitVersion_SemVer)' != ''"/> |
| 156 | + |
| 157 | + <Exec Command="gem build gitversion.gemspec" ContinueOnError="True" |
| 158 | + WorkingDirectory="$(SolutionDir)GemBuild" Condition="'$(GitVersion_SemVer)' != ''" /> |
125 | 159 | </Target>
|
126 | 160 | <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
127 | 161 | <PropertyGroup>
|
|
0 commit comments