Imported Upstream version 5.0.0.42

Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-04-10 11:41:01 +00:00
parent 1190d13a04
commit 6bdd276d05
19939 changed files with 3099680 additions and 93811 deletions

View File

@@ -0,0 +1,8 @@
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\dir.props" />
<PropertyGroup>
<PackageVersion>1.1.0</PackageVersion>
<AssemblyVersion>1.0.32.0</AssemblyVersion>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<Project Include="System.Composition.AttributedModel.pkgproj" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
</Project>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<ItemGroup>
<ProjectReference Include="..\src\System.Composition.AttributedModel.builds">
<SupportedFramework>net45;netcore45;netcoreapp1.0;wp8;wpa81;$(AllXamarinFrameworks)</SupportedFramework>
</ProjectReference>
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<BuildConfigurations>
netstandard1.0;
netstandard;
</BuildConfigurations>
</PropertyGroup>
</Project>

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
<ProjectGuid>{C6257381-C624-494A-A9D9-5586E60856EA}</ProjectGuid>
<RootNamespace>System.Composition</RootNamespace>
<AssemblyName>System.Composition.AttributedModel</AssemblyName>
<PackageTargetFramework Condition="'$(TargetGroup)' == 'netstandard1.0'">netstandard1.0;portable-net45+win8+wp8+wpa81</PackageTargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netstandard1.0-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netstandard1.0-Release|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netstandard-Debug|AnyCPU'" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='netstandard-Release|AnyCPU'" />
<ItemGroup>
<Compile Include="System\Composition\Convention\AttributedModelProvider.cs" />
<Compile Include="System\Composition\ExportAttribute.cs" />
<Compile Include="System\Composition\ExportMetadataAttribute.cs" />
<Compile Include="System\Composition\ImportAttribute.cs" />
<Compile Include="System\Composition\ImportingConstructorAttribute.cs" />
<Compile Include="System\Composition\ImportManyAttribute.cs" />
<Compile Include="System\Composition\ImportMetadataConstraintAttribute.cs" />
<Compile Include="System\Composition\MetadataAttributeAttribute.cs" />
<Compile Include="System\Composition\OnImportsSatisfiedAttribute.cs" />
<Compile Include="System\Composition\PartMetadataAttribute.cs" />
<Compile Include="System\Composition\PartNotDiscoverableAttribute.cs" />
<Compile Include="System\Composition\SharedAttribute.cs" />
<Compile Include="System\Composition\SharingBoundaryAttribute.cs" />
</ItemGroup>
<ItemGroup Condition="'$(TargetGroup)' == 'netstandard1.0'">
<Reference Include="System.Diagnostics.Debug" />
<Reference Include="System.Diagnostics.Tools" />
<Reference Include="System.Reflection" />
<Reference Include="System.Runtime" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>

View File

@@ -0,0 +1,30 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.Generic;
using System.Reflection;
namespace System.Composition.Convention
{
/// <summary>
/// Provider of augmented reflection data in support of conventions.
/// </summary>
public abstract class AttributedModelProvider
{
/// <summary>
/// Provide the list of attributes applied to the specified member.
/// </summary>
/// <param name="reflectedType">The reflectedType the type used to retrieve the memberInfo.</param>
/// <param name="member">The member to supply attributes for.</param>
/// <returns>The list of applied attributes.</returns>
public abstract IEnumerable<Attribute> GetCustomAttributes(System.Type reflectedType, MemberInfo member);
/// <summary>
/// <param name="reflectedType">The reflectedType the type used to retrieve the parameterInfo.</param>
/// <param name="parameter">The member to supply attributes for.</param>
/// <returns>The list of applied attributes.</returns>
/// </summary>
public abstract IEnumerable<Attribute> GetCustomAttributes(System.Type reflectedType, ParameterInfo parameter);
}
}

View File

@@ -0,0 +1,94 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Diagnostics.CodeAnalysis;
namespace System.Composition
{
/// <summary>
/// Specifies that a type, property, field, or method provides a particular export.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property,
AllowMultiple = true, Inherited = false)]
public class ExportAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="ExportAttribute"/> class, exporting the
/// type or member marked with this attribute under the default contract name.
/// </summary>
public ExportAttribute()
: this((string)null, (Type)null)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ExportAttribute"/> class, exporting the
/// type or member marked with this attribute under a contract name derived from the
/// specified type.
/// </summary>
/// <param name="contractType">
/// A <see cref="Type"/> of which to derive the contract name to export the type or
/// member marked with this attribute, under; or <see langword="null"/> to use the
/// default contract name.
/// </param>
public ExportAttribute(Type contractType)
: this((string)null, contractType)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ExportAttribute"/> class, exporting the
/// type or member marked with this attribute under the specified contract name.
/// </summary>
/// <param name="contractName">
/// A <see cref="String"/> containing the contract name to export the type or member
/// marked with this attribute, under; or <see langword="null"/> or an empty string
/// ("") to use the default contract name.
/// </param>
public ExportAttribute(string contractName)
: this(contractName, (Type)null)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ExportAttribute"/> class, exporting the
/// type or member marked with this attribute under the specified contract name.
/// </summary>
/// <param name="contractName">
/// A <see cref="String"/> containing the contract name to export the type or member
/// marked with this attribute, under; or <see langword="null"/> or an empty string
/// ("") to use the default contract name.
/// </param>
/// <param name="contractType">
/// A <see cref="Type"/> of which to derive the contract name to export the type or
/// member marked with this attribute, under; or <see langword="null"/> to use the
/// default contract name.
/// </param>
public ExportAttribute(string contractName, Type contractType)
{
ContractName = contractName;
ContractType = contractType;
}
/// <summary>
/// Gets the contract name to export the type or member under.
/// </summary>
/// <value>
/// A <see cref="String"/> containing the contract name to export the type or member
/// marked with this attribute, under. The default value is an empty string ("").
/// </value>
public string ContractName { get; private set; }
/// <summary>
/// Get the contract type that is exported by the member that this attribute is attached to.
/// </summary>
/// <value>
/// A <see cref="Type"/> of the export that is be provided. The default value is
/// <see langword="null"/> which means that the type will be obtained by looking at the type on
/// the member that this export is attached to.
/// </value>
public Type ContractType { get; private set; }
}
}

View File

@@ -0,0 +1,50 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Composition
{
/// <summary>
/// Specifies metadata for a type, property, field, or method marked with the
/// <see cref="ExportAttribute"/>.
/// </summary>
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface | AttributeTargets.Property,
AllowMultiple = true, Inherited = false)]
public sealed class ExportMetadataAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="ExportMetadataAttribute"/> with the
/// specified name and metadata value.
/// </summary>
/// <param name="name">
/// A <see cref="String"/> containing the name of the metadata value; or
/// <see langword="null"/> to set the <see cref="Name"/> property to an empty
/// string ("").
/// </param>
/// <param name="value">
/// An <see cref="object"/> containing the metadata value. This can be
/// <see langword="null"/>.
/// </param>
public ExportMetadataAttribute(string name, object value)
{
Name = name ?? string.Empty;
Value = value;
}
/// <summary>
/// Gets the name of the metadata value.
/// </summary>
/// <value>
/// A <see cref="String"/> containing the name of the metadata value.
/// </value>
public string Name { get; private set; }
/// <summary>
/// Gets the metadata value.
/// </summary>
/// <value>
/// An <see cref="object"/> containing the metadata value.
/// </value>
public object Value { get; private set; }
}
}

View File

@@ -0,0 +1,55 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Diagnostics.CodeAnalysis;
namespace System.Composition
{
/// <summary>
/// Specifies that a property, field, or parameter imports a particular export.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")]
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter,
AllowMultiple = false, Inherited = false)]
public class ImportAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="ImportAttribute"/> class, importing the
/// export without a contract name.
/// </summary>
public ImportAttribute()
: this((string)null)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ImportAttribute"/> class, importing the
/// export with the specified contract name.
/// </summary>
/// <param name="contractName">
/// A <see cref="String"/> containing the contract name of the export to import, or
/// <see langword="null"/> or an empty string ("") to use the default contract name.
/// </param>
public ImportAttribute(string contractName)
{
ContractName = contractName;
}
/// <summary>
/// Gets the contract name of the export to import.
/// </summary>
/// <value>
/// A <see cref="String"/> containing the contract name of the export to import. The
/// default value is null.
/// </value>
public string ContractName { get; private set; }
/// <summary>
/// Gets or sets a value indicating whether the property, field or parameter will be left
/// at its default value when an export with the contract name is not present in
/// the container.
/// </summary>
public bool AllowDefault { get; set; }
}
}

View File

@@ -0,0 +1,48 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Diagnostics.CodeAnalysis;
namespace System.Composition
{
/// <summary>
/// Specifies that a property, field, or parameter imports a particular set of exports.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1813:AvoidUnsealedAttributes")]
[AttributeUsage(AttributeTargets.Property | AttributeTargets.Parameter,
AllowMultiple = false, Inherited = false)]
public class ImportManyAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="ImportManyAttribute"/> class, importing the
/// set of exports without a contract name.
/// </summary>
public ImportManyAttribute()
: this((string)null)
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ImportManyAttribute"/> class, importing the
/// set of exports with the specified contract name.
/// </summary>
/// <param name="contractName">
/// A <see cref="String"/> containing the contract name of the exports to import, or
/// <see langword="null"/>.
/// </param>
public ImportManyAttribute(string contractName)
{
ContractName = contractName;
}
/// <summary>
/// Gets the contract name of the exports to import.
/// </summary>
/// <value>
/// A <see cref="String"/> containing the contract name of the exports to import. The
/// default value is null.
/// </value>
public string ContractName { get; private set; }
}
}

View File

@@ -0,0 +1,37 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Composition
{
/// <summary>
/// When applied on an import, requires certain metadata values on the exporter.
/// </summary>
[AttributeUsage(AttributeTargets.Property, Inherited = false)]
public sealed class ImportMetadataConstraintAttribute : Attribute
{
private readonly string _name;
private readonly object _value;
/// <summary>
/// Require a specific metadata value on the exporter.
/// </summary>
/// <param name="name">The name of the metadata item to match.</param>
/// <param name="value">The value to match.</param>
public ImportMetadataConstraintAttribute(string name, object value)
{
_name = name;
_value = value;
}
/// <summary>
/// The metadata key to match.
/// </summary>
public string Name { get { return _name; } }
/// <summary>
/// The value to match.
/// </summary>
public object Value { get { return _value; } }
}
}

View File

@@ -0,0 +1,25 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Composition
{
/// <summary>
/// Specifies that a constructor should be used when constructing an attributed part.
/// </summary>
/// <remarks>
/// By default, only a default parameter-less constructor, if available, is used to
/// construct an attributed part. Use this attribute to indicate that a specific constructor
/// should be used.
/// </remarks>
[AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)]
public sealed class ImportingConstructorAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="ImportingConstructorAttribute"/> class.
/// </summary>
public ImportingConstructorAttribute()
{
}
}
}

View File

@@ -0,0 +1,22 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Composition
{
/// <summary>
/// Specifies that an attribute can be used to provide metadata for a type, property, field,
/// or method marked with the <see cref="ExportAttribute"/>.
/// </summary>
[AttributeUsage(AttributeTargets.Class,
AllowMultiple = false, Inherited = true)]
public sealed class MetadataAttributeAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="MetadataAttributeAttribute"/> class.
/// </summary>
public MetadataAttributeAttribute()
{
}
}
}

View File

@@ -0,0 +1,16 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Composition
{
/// <summary>
/// When applied to a void, parameterless instance method on a part,
/// MEF will call that method when composition of the part has
/// completed. The method must be public or internal.
/// </summary>
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
public sealed class OnImportsSatisfiedAttribute : Attribute
{
}
}

View File

@@ -0,0 +1,49 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Composition
{
/// <summary>
/// Specifies metadata for a type to be used as a part.
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
public class PartMetadataAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="PartMetadataAttribute"/> with the
/// specified name and metadata value.
/// </summary>
/// <param name="name">
/// A <see cref="String"/> containing the name of the metadata value; or
/// <see langword="null"/> to use an empty string ("").
/// </param>
/// <param name="value">
/// An <see cref="object"/> containing the metadata value. This can be
/// <see langword="null"/>.
/// </param>
public PartMetadataAttribute(string name, object value)
{
if (name == null) throw new ArgumentNullException(nameof(name));
Name = name;
Value = value;
}
/// <summary>
/// Gets the name of the metadata value.
/// </summary>
/// <value>
/// A <see cref="String"/> containing the name of the metadata value.
/// </value>
public string Name { get; private set; }
/// <summary>
/// Gets the metadata value.
/// </summary>
/// <value>
/// An <see cref="object"/> containing the metadata value.
/// </value>
public object Value { get; private set; }
}
}

View File

@@ -0,0 +1,20 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Composition
{
/// <summary>
/// Place on a type that should not be discovered as a MEF part.
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
public sealed class PartNotDiscoverableAttribute : Attribute
{
/// <summary>
/// Initializes a new instance of the <see cref="PartNotDiscoverableAttribute"/> class.
/// </summary>
public PartNotDiscoverableAttribute()
{
}
}
}

View File

@@ -0,0 +1,44 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
namespace System.Composition
{
/// <summary>
/// Marks a part as being constrained to sharing within the named boundary.
/// </summary>
/// <example>
/// [Export,
/// Shared("HttpRequest")]
/// public class HttpResponseWriter { }
/// </example>
/// <seealso cref="SharingBoundaryAttribute"/>
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
public class SharedAttribute : PartMetadataAttribute
{
private const string SharingBoundaryPartMetadataName = "SharingBoundary";
/// <summary>
/// Mark a part as globally shared.
/// </summary>
public SharedAttribute()
: base(SharingBoundaryPartMetadataName, null)
{
}
/// <summary>
/// Construct a <see cref="SharedAttribute"/> for the specified
/// boundary name.
/// </summary>
/// <param name="sharingBoundaryName">The boundary outside of which this part is inaccessible.</param>
public SharedAttribute(string sharingBoundaryName)
: base(SharingBoundaryPartMetadataName, sharingBoundaryName)
{
}
/// <summary>
/// he boundary outside of which this part is inaccessible.
/// </summary>
public string SharingBoundary { get { return (string)base.Value; } }
}
}

View File

@@ -0,0 +1,43 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Collections.ObjectModel;
namespace System.Composition
{
/// <summary>
/// Applied to an import for ExportFactory{T}, this attribute marks the
/// boundary of a sharing scope. The ExportLifetimeContext{T} instances
/// returned from the factory will be boundaries for sharing of components that are bounded
/// by the listed boundary names.
/// </summary>
/// <example>
/// [Import, SharingBoundary("HttpRequest")]
/// public ExportFactory&lt;HttpRequestHandler&gt; HandlerFactory { get; set; }
/// </example>
/// <seealso cref="SharedAttribute" />
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property, Inherited = false)]
[MetadataAttribute]
[CLSCompliant(false)]
public sealed class SharingBoundaryAttribute : Attribute
{
private readonly string[] _sharingBoundaryNames;
/// <summary>
/// Construct a <see cref="SharingBoundaryAttribute"/> for the specified boundary names.
/// </summary>
/// <param name="sharingBoundaryNames">Boundaries implemented by the created ExportLifetimeContext{T}s.</param>
public SharingBoundaryAttribute(params string[] sharingBoundaryNames)
{
if (sharingBoundaryNames == null) throw new ArgumentNullException(nameof(sharingBoundaryNames));
_sharingBoundaryNames = sharingBoundaryNames;
}
/// <summary>
/// Boundaries implemented by the created ExportLifetimeContext{T}s.
/// </summary>
public ReadOnlyCollection<string> SharingBoundaryNames { get { return new ReadOnlyCollection<string>(_sharingBoundaryNames); } }
}
}