Skip to content

Commit bce35d8

Browse files
committed
Declare internal source attributes in consuming projects
1 parent 8466e25 commit bce35d8

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

IDisposableAnalyzers/IDisposableAnalyzers.csproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@
6666
</ItemGroup>
6767

6868
<ItemGroup>
69-
<None Update="tools\*" Pack="true" PackagePath="" />
69+
<None Update="tools\*;build\*" Pack="true" PackagePath="" />
70+
<Compile Remove="build\*.cs" />
71+
<None Include="build\*.cs" Pack="true" PackagePath="build" />
72+
7073
<None Include="$(OutputPath)\$(AssemblyName).dll;$(OutputPath)\Gu.Roslyn.Extensions.dll" Pack="true" PackagePath="analyzers/dotnet/cs" Visible="false" />
7174
</ItemGroup>
7275
</Project>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<Project>
2+
3+
<PropertyGroup>
4+
<OwnershipAttributesPath Condition="'$(OwnershipAttributesPath)' == ''">$(MSBuildThisFileDirectory)OwnershipAttributes$(DefaultLanguageSourceExtension)</OwnershipAttributesPath>
5+
6+
<IncludeOwnershipAttributes Condition="'$(IncludeOwnershipAttributes)' == '' and Exists($(OwnershipAttributesPath))">true</IncludeOwnershipAttributes>
7+
</PropertyGroup>
8+
9+
<ItemGroup Condition="'$(IncludeOwnershipAttributes)' == 'true'">
10+
<Compile Include="$(OwnershipAttributesPath)" Visible="false" />
11+
</ItemGroup>
12+
13+
</Project>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
namespace IDisposableAnnotations
2+
{
3+
using System;
4+
5+
/// <summary>
6+
/// The return value must be disposed by the caller.
7+
/// </summary>
8+
[AttributeUsage(AttributeTargets.ReturnValue | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)]
9+
internal sealed class GivesOwnershipAttribute : Attribute
10+
{
11+
}
12+
13+
/// <summary>
14+
/// The return value must not be disposed by the caller.
15+
/// </summary>
16+
[AttributeUsage(AttributeTargets.ReturnValue | AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)]
17+
internal sealed class KeepsOwnershipAttribute : Attribute
18+
{
19+
}
20+
21+
/// <summary>
22+
/// The ownership of instance is transferred and the receiver is responsible for disposing.
23+
/// </summary>
24+
[AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = true)]
25+
internal sealed class TakesOwnershipAttribute : Attribute
26+
{
27+
}
28+
}

0 commit comments

Comments
 (0)