[Tizen] Add BuildTools 2.1.0-rc1-02804-05
[platform/upstream/coreclr.git] / packages / microsoft.dotnet.buildtools / 2.1.0-rc1-02804-05 / lib / notsupported.targets
1 <?xml version="1.0" encoding="utf-8"?>
2 <Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3
4   <PropertyGroup Condition="'$(GeneratePlatformNotSupportedAssembly)' == 'true' OR '$(GeneratePlatformNotSupportedAssemblyMessage)' != ''">
5     <!-- Tell ResolveMatchingContract to run and resolve contract to project reference -->
6     <ResolveMatchingContract>true</ResolveMatchingContract>
7     <NotSupportedSourceFile>$(IntermediateOutputPath)$(TargetName).notsupported.cs</NotSupportedSourceFile>
8     <CoreCompileDependsOn>$(CoreCompileDependsOn);GenerateNotSupportedSource</CoreCompileDependsOn>
9     <!-- Not supported sources are created from the ref assembly, we currently don't produce finalizers in dummmy assemblies, so we disable ApiCompat to not fail. -->
10     <RunApiCompat>false</RunApiCompat>
11   </PropertyGroup>
12
13   <ItemGroup Condition="'$(GeneratePlatformNotSupportedAssembly)' == 'true' OR '$(GeneratePlatformNotSupportedAssemblyMessage)' != ''">
14     <AssemblyMetadata Include="NotSupported">
15       <Value>True</Value>
16     </AssemblyMetadata>
17   </ItemGroup>
18
19   <!-- GenerateNotSupportedSource
20        Inputs:
21          * A contract assembly
22          * Reference assemblies
23
24        Generates source for the contract that throws PlatformNotSupportedException
25   -->
26   <Target Name="GenerateNotSupportedSource" 
27           DependsOnTargets="ResolveMatchingContract"
28           Inputs="@(ReferencePath);@(ResolvedMatchingContract)"
29           Outputs="$(NotSupportedSourceFile)">
30
31     <ItemGroup>
32       <!-- build out a list of directories where dependencies are located -->
33       <_referencePathDirectoriesWithDuplicates Include="@(ReferencePath->'%(RootDir)%(Directory)'->TrimEnd('\'))" />
34       <!-- strip metadata, removing duplicates -->
35       <_referencePathDirectories Include="%(_referencePathDirectoriesWithDuplicates.Identity)" />
36     </ItemGroup>
37
38     <Error Text="No single matching contract found." Condition="'@(ResolvedMatchingContract->Count())' != '1'" />
39
40     <PropertyGroup>
41       <GenAPIArgs>-assembly:"%(ResolvedMatchingContract.Identity)"</GenAPIArgs>
42       <GenAPIArgs>$(GenAPIArgs) -libPath:"@(_referencePathDirectories)"</GenAPIArgs>
43       <GenAPIArgs>$(GenAPIArgs) -out:"$(NotSupportedSourceFile)"</GenAPIArgs>
44       <GenAPIArgs Condition="'$(GeneratePlatformNotSupportedAssembly)' == 'true' OR '$(GeneratePlatformNotSupportedAssemblyMessage)' != ''">$(GenAPIArgs) -throw:"$(GeneratePlatformNotSupportedAssemblyMessage)"</GenAPIArgs>
45     </PropertyGroup>
46
47     <PropertyGroup>
48       <GenAPICmd>$(ToolHostCmd) "$(ToolsDir)GenAPI.exe"</GenAPICmd>
49     </PropertyGroup>
50
51     <Exec Command="$(GenAPICmd) $(GenAPIArgs)" WorkingDirectory="$(ToolRuntimePath)" />
52
53     <ItemGroup>
54       <FileWrites Include="$(NotSupportedSourceFile)" />
55       <Compile Include="$(NotSupportedSourceFile)" />
56     </ItemGroup>
57   </Target>
58
59 </Project>