123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- <?xml version="1.0" encoding="utf-8"?>
- <!-- Copyright (c) 2009-2018 ZeroC, Inc. All rights reserved. -->
- <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Choose>
- <When Condition="'$(MSBuildAssemblyVersion)' == '' or '$(MSBuildAssemblyVersion)' < '15.0'">
- <PropertyGroup>
- <SliceCompileAssemblyDir>net45</SliceCompileAssemblyDir>
- </PropertyGroup>
- </When>
- <Otherwise>
- <PropertyGroup>
- <SliceCompileAssemblyDir>netstandard2.0</SliceCompileAssemblyDir>
- </PropertyGroup>
- </Otherwise>
- </Choose>
- <!-- Import our custom MSbuild tasks used to build Ice for CSharp projects -->
- <UsingTask TaskName="IceBuilder.MSBuild.Slice2CSharpTask"
- AssemblyFile="$(MSBuildThisFileDirectory)..\tools\$(SliceCompileAssemblyDir)\zeroc.icebuilder.msbuild.dll"/>
- <UsingTask TaskName="IceBuilder.MSBuild.Slice2CSharpDependTask"
- AssemblyFile="$(MSBuildThisFileDirectory)..\tools\$(SliceCompileAssemblyDir)\zeroc.icebuilder.msbuild.dll"/>
- <!-- Import IceBuilder common settings -->
- <Import Project="$(MSBuildThisFileDirectory)\zeroc.icebuilder.msbuild.common.props"/>
- <ItemGroup>
- <PropertyPageSchema Include="$(MSBuildThisFileDirectory)ProjectItemsSchema.xaml" />
- <!-- This capability is used to apply the Slice property page designer -->
- <ProjectCapability Include="SliceCompile" />
- <PropertyPageSchema Include="$(MSBuildThisFileDirectory)SliceCompile.CSharp.xaml">
- <Context>Project</Context>
- </PropertyPageSchema>
- <PropertyPageSchema Include="$(MSBuildThisFileDirectory)SliceCompile.CSharp.File.xaml">
- <Context>File;BrowseObject</Context>
- </PropertyPageSchema>
- <AvailableItemName Include="SliceCompile"/>
- </ItemGroup>
- <!--
- Settings that are only supported with MSBuild 15.0 and up. The item Update
- attribute is not supported with older MSBuild versions.
- -->
- <Import Project="$(MSBuildThisFileDirectory)\zeroc.icebuilder.msbuild.csharp.15.0.targets"
- Condition="'$(MSBuildAssemblyVersion)' != '' and '$(MSBuildAssemblyVersion)' > '14.0'"/>
- <Target Name="SliceCompile" BeforeTargets="CoreCompile"
- Condition="@(SliceCompile) != ''">
- <Error Text="Ice Installation invalid or not detected. Invalid IceHome setting `$(IceHome)'"
- Condition="!Exists('$(IceHome)')" />
- <Error Text="Ice Installation invalid or not detected. Invalid IceToolsPath setting `$(IceToolsPath)'"
- Condition="!Exists('$(IceToolsPath)')" />
- <Error Text="The Ice Builder requires Ice Version 3.6 or later. Invalid IceHome setting `$(IceHome)'"
- Condition="'$(IceIntVersion)' == '' Or '$(IceIntVersion)' < '30600'" />
- <MakeDir Directories="%(SliceCompile.OutputDir)"/>
- <!-- First we check dependencies and compute which Slice files need to be recompiled -->
- <Slice2CSharpDependTask
- WorkingDirectory = "$(MSBuildProjectDirectory)"
- IceHome = "$(IceHome)"
- IceToolsPath = "$(IceToolsPath)"
- Sources = "@(SliceCompile)">
- <Output
- ItemName = "_SliceCompile"
- TaskParameter = "ComputedSources"/>
- <Output
- PropertyName = "_SliceCompileGeneratedPaths"
- TaskParameter = "GeneratedCompiledPaths"/>
- </Slice2CSharpDependTask>
- <!-- Compile the Slice files -->
- <Slice2CSharpTask
- WorkingDirectory = "$(MSBuildProjectDirectory)"
- IceHome = "$(IceHome)"
- IceToolsPath = "$(IceToolsPath)"
- OutputDir = "%(_SliceCompile.OutputDir)"
- IncludeDirectories = "%(_SliceCompile.IncludeDirectories)"
- AdditionalOptions = "%(_SliceCompile.AdditionalOptions)"
- Sources = "@(_SliceCompile)"
- Condition = "'%(_SliceCompile.BuildRequired)' == 'True'"/>
- <!--
- Include all C# generated source items that have not been manually included. We want to delay this until we are
- running the SliceCompile target so that the Visual Studio extension has a chance to add these items to the project in
- a persistent way. If the extension is not enabled or we are building from the command line we just add the
- missing items in a transient way.
- The builder's depend task has an output property named GeneratedPaths that contains the paths of all generated items.
- -->
- <ItemGroup>
- <Compile Include="$(_SliceCompileGeneratedPaths)"
- Exclude="@(Compile->'%(FullPath)');@(Compile->'%(Identity)')" />
- </ItemGroup>
- </Target>
- <Target Name="SliceCompileClean" BeforeTargets="Clean">
- <Delete Files="@(SliceCompile->'%(OutputDir)\%(Filename).cs')"/>
- <Delete Files="@(SliceCompile->'%(OutputDir)\SliceCompile.%(Filename).d')"/>
- </Target>
- </Project>
|