diff options
Diffstat (limited to 'packages/microsoft.dotnet.buildtools/2.1.0-rc1-02804-05/lib/notsupported.targets')
-rwxr-xr-x | packages/microsoft.dotnet.buildtools/2.1.0-rc1-02804-05/lib/notsupported.targets | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/packages/microsoft.dotnet.buildtools/2.1.0-rc1-02804-05/lib/notsupported.targets b/packages/microsoft.dotnet.buildtools/2.1.0-rc1-02804-05/lib/notsupported.targets new file mode 100755 index 0000000000..2df5a75bd2 --- /dev/null +++ b/packages/microsoft.dotnet.buildtools/2.1.0-rc1-02804-05/lib/notsupported.targets @@ -0,0 +1,59 @@ +<?xml version="1.0" encoding="utf-8"?> +<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> + + <PropertyGroup Condition="'$(GeneratePlatformNotSupportedAssembly)' == 'true' OR '$(GeneratePlatformNotSupportedAssemblyMessage)' != ''"> + <!-- Tell ResolveMatchingContract to run and resolve contract to project reference --> + <ResolveMatchingContract>true</ResolveMatchingContract> + <NotSupportedSourceFile>$(IntermediateOutputPath)$(TargetName).notsupported.cs</NotSupportedSourceFile> + <CoreCompileDependsOn>$(CoreCompileDependsOn);GenerateNotSupportedSource</CoreCompileDependsOn> + <!-- 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. --> + <RunApiCompat>false</RunApiCompat> + </PropertyGroup> + + <ItemGroup Condition="'$(GeneratePlatformNotSupportedAssembly)' == 'true' OR '$(GeneratePlatformNotSupportedAssemblyMessage)' != ''"> + <AssemblyMetadata Include="NotSupported"> + <Value>True</Value> + </AssemblyMetadata> + </ItemGroup> + + <!-- GenerateNotSupportedSource + Inputs: + * A contract assembly + * Reference assemblies + + Generates source for the contract that throws PlatformNotSupportedException + --> + <Target Name="GenerateNotSupportedSource" + DependsOnTargets="ResolveMatchingContract" + Inputs="@(ReferencePath);@(ResolvedMatchingContract)" + Outputs="$(NotSupportedSourceFile)"> + + <ItemGroup> + <!-- build out a list of directories where dependencies are located --> + <_referencePathDirectoriesWithDuplicates Include="@(ReferencePath->'%(RootDir)%(Directory)'->TrimEnd('\'))" /> + <!-- strip metadata, removing duplicates --> + <_referencePathDirectories Include="%(_referencePathDirectoriesWithDuplicates.Identity)" /> + </ItemGroup> + + <Error Text="No single matching contract found." Condition="'@(ResolvedMatchingContract->Count())' != '1'" /> + + <PropertyGroup> + <GenAPIArgs>-assembly:"%(ResolvedMatchingContract.Identity)"</GenAPIArgs> + <GenAPIArgs>$(GenAPIArgs) -libPath:"@(_referencePathDirectories)"</GenAPIArgs> + <GenAPIArgs>$(GenAPIArgs) -out:"$(NotSupportedSourceFile)"</GenAPIArgs> + <GenAPIArgs Condition="'$(GeneratePlatformNotSupportedAssembly)' == 'true' OR '$(GeneratePlatformNotSupportedAssemblyMessage)' != ''">$(GenAPIArgs) -throw:"$(GeneratePlatformNotSupportedAssemblyMessage)"</GenAPIArgs> + </PropertyGroup> + + <PropertyGroup> + <GenAPICmd>$(ToolHostCmd) "$(ToolsDir)GenAPI.exe"</GenAPICmd> + </PropertyGroup> + + <Exec Command="$(GenAPICmd) $(GenAPIArgs)" WorkingDirectory="$(ToolRuntimePath)" /> + + <ItemGroup> + <FileWrites Include="$(NotSupportedSourceFile)" /> + <Compile Include="$(NotSupportedSourceFile)" /> + </ItemGroup> + </Target> + +</Project> |