Skip to content
This repository has been archived by the owner on Dec 24, 2022. It is now read-only.

Commit

Permalink
add build-deps.csproj
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Mar 27, 2019
1 parent 8b9a110 commit 2535566
Showing 1 changed file with 85 additions and 0 deletions.
85 changes: 85 additions & 0 deletions build/build-deps.proj
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Default"
xmlns='http://schemas.microsoft.com/developer/msbuild/2003' ToolsVersion="4.0">
<Import Project="$(MSBuildProjectDirectory)/build.tasks" />

<PropertyGroup>
<MajorVersion Condition="$(MajorVersion) == ''">5</MajorVersion>
<MinorVersion Condition="$(MinorVersion) == ''">0</MinorVersion>
<PatchVersion Condition="$(PatchVersion) == ''">$(BUILD_NUMBER)</PatchVersion>
</PropertyGroup>

<PropertyGroup>
<BuildSolutionDir>$(MSBuildProjectDirectory)/..</BuildSolutionDir>
<SrcDir>$(BuildSolutionDir)/src</SrcDir>
<Configuration Condition="$(Configuration) == ''">Release</Configuration>
<NuGetPackageDir>$(BuildSolutionDir)/NuGet/</NuGetPackageDir>
<PackageVersion>$(MajorVersion).$(MinorVersion).$(PatchVersion)</PackageVersion>
</PropertyGroup>

<PropertyGroup>
<DoBuildSolutionsDependsOn>
BeforeBuildSolutions;
BuildSolutions
</DoBuildSolutionsDependsOn>
</PropertyGroup>

<Target Name="BeforeBuildSolutions">
<Message Text="*****Before building solution*****" Importance="high"/>
<CallTarget Targets="UpdateVersion" />
</Target>

<Target Name="BuildSolutions">
<CallTarget Targets="ClearNuGetRestoreCaches" />
<MSBuild Projects="$(BuildSolutionDir)/src/ServiceStack.Text/ServiceStack.Text.csproj" Targets="Restore" />
</Target>

<!-- need to remove old caches from nuget restore from .Core csproj's -->
<Target Name="ClearNuGetRestoreCaches">
<RemoveDir Directories="$(SrcDir)/ServiceStack.Text/obj" />
</Target>

<Target Name="UpdateVersion">
<!-- Update Version -->
<ItemGroup>
<RegexTransform Include="$(SrcDir)/ServiceStack.Text/Env.cs">
<Find>ServiceStackVersion = \d+\.\d+m;</Find>
<ReplaceWith>ServiceStackVersion = $(MajorVersion).$(MinorVersion)$(PatchVersion)m;</ReplaceWith>
</RegexTransform>

<RegexTransform Include="$(SrcDir)/ServiceStack.Text/Env.cs">
<Find>new DateTime.*</Find>
<ReplaceWith>new DateTime($([System.DateTime]::Now.ToString(`yyyy,MM,dd`)));</ReplaceWith>
</RegexTransform>

<!--Update Min Dependency Version -->
<RegexTransform Include="$(BuildSolutionDir)/src/Directory.Build.props;$(BuildSolutionDir)/tests/Directory.Build.props">
<Find>&lt;Version&gt;[^&lt;]*</Find>
<ReplaceWith>&lt;Version&gt;$(PackageVersion)</ReplaceWith>
</RegexTransform>
</ItemGroup>

<RegexTransform Items="@(RegexTransform)" />
</Target>

<Target Name="Default" DependsOnTargets="$(DoBuildSolutionsDependsOn)">

<!-- ServiceStack.Memory -->
<MSBuild Projects="$(BuildSolutionDir)/src/ServiceStack.Memory/ServiceStack.Memory.csproj"
Targets="Build;Pack"
Properties="Configuration=$(Configuration)" />

<!-- ServiceStack.Text -->
<MSBuild Projects="$(BuildSolutionDir)/src/ServiceStack.Text/ServiceStack.Text.csproj"
Targets="Build;Pack"
Properties="Configuration=$(Configuration)" />


<!-- Copy all *.nupkg to /NuGet -->
<ItemGroup>
<NugetPackagesToMove Include="$(BuildSolutionDir)/src/**/bin/$(Configuration)/*.nupkg"/>
</ItemGroup>
<Move SourceFiles="@(NugetPackagesToMove)" DestinationFolder="$(NuGetPackageDir)" />

</Target>
</Project>

0 comments on commit 2535566

Please sign in to comment.