Permalink
Fetching contributors…
Cannot retrieve contributors at this time
111 lines (93 sloc) 5.16 KB
<?xml version="1.0" encoding="utf-8"?>
<!--
CenterCLR.RelaxVersioner - Easy-usage, Git-based, auto-generate version informations toolset.
Copyright (c) 2016 Kouji Matsui (@kekyo2)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- ============================================================================= -->
<!-- Properties definition -->
<!-- ======================== -->
<!-- Common -->
<PropertyGroup>
<!-- This path identicate auto-generated source code by RelaxVersioner. -->
<RelaxVersionerOutputPath Condition="'$(RelaxVersionerOutputPath)' == ''">$([System.IO.Path]::Combine('$(ProjectDir)','$(IntermediateOutputPath)','RelaxVersioner$(DefaultLanguageSourceExtension)'))</RelaxVersionerOutputPath>
<!-- HACK: Code analysis cause CA1016 "Add AssemblyVersion attribute..." if not defined or version is [0.0.0.0] -->
<NoWarn>$(NoWarn) 1016</NoWarn>
</PropertyGroup>
<!-- ======================== -->
<!-- For F# -->
<PropertyGroup Condition="'$(Language)' == 'F#'">
<!-- HACK: https://github.com/fsharp/fsharp/issues/289 -->
<NoWarn>$(NoWarn) 2003</NoWarn>
</PropertyGroup>
<!-- ======================== -->
<!-- For C++ (or C++/CLI) -->
<PropertyGroup Condition="'$(Language)' == 'C++'">
<RelaxVersionerLanguage Condition="('$(RelaxVersionerLanguage)' == '') AND ('$(CLRSupport)' == 'true')">C++/CLI</RelaxVersionerLanguage>
<RelaxVersionerLanguage Condition="'$(RelaxVersionerLanguage)' == ''">C++</RelaxVersionerLanguage>
<BuildCompileTargets>
RelaxVersionerBuild;
$(BuildCompileTargets);
</BuildCompileTargets>
</PropertyGroup>
<!-- ======================== -->
<!-- For Wix -->
<PropertyGroup Condition="'$(WixInstallPath)' != ''">
<RelaxVersionerLanguage>Wix</RelaxVersionerLanguage>
</PropertyGroup>
<!-- ======================== -->
<!-- For all languages except C++ -->
<PropertyGroup Condition="'$(Language)' != 'C++'">
<RelaxVersionerLanguage Condition="'$(RelaxVersionerLanguage)' == ''">$(Language)</RelaxVersionerLanguage>
<CoreBuildDependsOn>
RelaxVersionerBuild;
$(CoreBuildDependsOn);
</CoreBuildDependsOn>
</PropertyGroup>
<!-- ============================================================================= -->
<!-- Build definition -->
<Target Name="RelaxVersionerBuild" BeforeTargets="BeforeCompile" Outputs="$(RelaxVersionerOutputPath)">
<!-- ======================== -->
<!-- For Windows environment -->
<Exec
Condition="'$(OS)' == 'Windows_NT'"
Command="CenterCLR.RelaxVersioner.exe &quot;$(SolutionDir.TrimEnd('\\'))&quot; &quot;$(ProjectDir.TrimEnd('\\'))&quot; &quot;$(RelaxVersionerOutputPath)&quot; &quot;$(TargetFrameworkVersion)&quot; &quot;$(TargetFrameworkProfile)&quot; &quot;$(RelaxVersionerLanguage)&quot;"
Outputs="$(RelaxVersionerOutputPath)"
WorkingDirectory="$(MSBuildThisFileDirectory)" />
<!-- ======================== -->
<!-- TODO: Mono environment -->
<Exec
Condition="'$(OS)' != 'Windows_NT'"
Command="mono --runtime=v4.0.30319 CenterCLR.RelaxVersioner.exe &quot;$(SolutionDir.TrimEnd('\\'))&quot; &quot;$(ProjectDir.TrimEnd('\\'))&quot; &quot;$(RelaxVersionerOutputPath)&quot; &quot;$(TargetFrameworkVersion)&quot; &quot;$(TargetFrameworkProfile)&quot; &quot;$(RelaxVersionerLanguage)&quot;"
Outputs="$(RelaxVersionerOutputPath)"
WorkingDirectory="$(MSBuildThisFileDirectory)" />
<!-- ============================================================================= -->
<!-- Add output rule -->
<!-- ======================== -->
<!-- For F# -->
<ItemGroup Condition="'$(Language)' == 'F#'">
<!-- HACK: F#'s EntryPoint expression is ignoring namespace/module if source code last compilation.
So, RelaxVersioner code insert before any source codes. -->
<CompileBefore Include="$(RelaxVersionerOutputPath)" />
</ItemGroup>
<!-- ======================== -->
<!-- For C++ (or C++/CLI) -->
<ItemGroup Condition="'$(Language)' == 'C++'">
<ClCompile Include="$(RelaxVersionerOutputPath)" />
</ItemGroup>
<!-- ======================== -->
<!-- For other languages -->
<ItemGroup Condition="('$(Language)' != 'F#') and ('$(Language)' != 'C++')">
<Compile Include="$(RelaxVersionerOutputPath)" />
</ItemGroup>
</Target>
</Project>