-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Keep facades of dynamically accessed exported types
- Loading branch information
Mateo Torres Ruiz
committed
Feb 26, 2021
1 parent
ed016c4
commit 39411d5
Showing
6 changed files
with
131 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...nker.Tests.Cases/TypeForwarding/UsedForwarderIsDynamicallyAccessedWithAssemblyCopyUsed.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// 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; | ||
using Mono.Linker.Tests.Cases.Expectations.Assertions; | ||
using Mono.Linker.Tests.Cases.Expectations.Metadata; | ||
using Mono.Linker.Tests.Cases.TypeForwarding.Dependencies; | ||
|
||
namespace Mono.Linker.Tests.Cases.TypeForwarding | ||
{ | ||
|
||
[SetupLinkerAction ("link", "test")] | ||
[SetupLinkerUserAction ("copyused")] | ||
[KeepTypeForwarderOnlyAssemblies ("false")] | ||
|
||
[SetupCompileBefore ("Forwarder.dll", new[] { "Dependencies/ReferenceImplementationLibrary.cs" }, defines: new[] { "INCLUDE_REFERENCE_IMPL" })] | ||
|
||
// After compiling the test case we then replace the reference impl with implementation + type forwarder | ||
[SetupCompileAfter ("Implementation.dll", new[] { "Dependencies/ImplementationLibrary.cs" })] | ||
[SetupCompileAfter ("Forwarder.dll", new[] { "Dependencies/ForwarderLibrary.cs" }, references: new[] { "Implementation.dll" })] | ||
|
||
[KeptAssembly ("Forwarder.dll")] | ||
[KeptMemberInAssembly ("Implementation.dll", typeof (ImplementationLibrary), "GetSomeValue()")] | ||
[RemovedForwarder ("Forwarder.dll", nameof (ImplementationStruct))] | ||
class UsedForwarderIsDynamicallyAccessedWithAssemblyCopyUsed | ||
{ | ||
static void Main () | ||
{ | ||
PointToTypeInFacade ("Mono.Linker.Tests.Cases.TypeForwarding.Dependencies.ImplementationLibrary, Forwarder"); | ||
} | ||
|
||
[Kept] | ||
static void PointToTypeInFacade ( | ||
[KeptAttributeAttribute (typeof(DynamicallyAccessedMembersAttribute))] | ||
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] string typeName) | ||
{ | ||
} | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
test/Mono.Linker.Tests.Cases/TypeForwarding/UsedTransitiveForwarderIsDynamicallyAccessed.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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.Diagnostics.CodeAnalysis; | ||
using Mono.Linker.Tests.Cases.Expectations.Assertions; | ||
using Mono.Linker.Tests.Cases.Expectations.Metadata; | ||
using Mono.Linker.Tests.Cases.TypeForwarding.Dependencies; | ||
|
||
namespace Mono.Linker.Tests.Cases.TypeForwarding | ||
{ | ||
[SetupLinkerAction ("link", "test")] | ||
[SetupLinkerUserAction ("copyused")] | ||
[KeepTypeForwarderOnlyAssemblies ("false")] | ||
|
||
[SetupCompileBefore ("SecondForwarder.dll", new[] { "Dependencies/ReferenceImplementationLibrary.cs" }, defines: new[] { "INCLUDE_REFERENCE_IMPL" })] | ||
[SetupCompileBefore ("FirstForwarder.dll", new[] { "Dependencies/ForwarderLibrary.cs" }, references: new[] { "SecondForwarder.dll" })] | ||
|
||
// After compiling the test case we then replace the reference impl with implementation + type forwarder | ||
[SetupCompileAfter ("Implementation.dll", new[] { "Dependencies/ImplementationLibrary.cs" })] | ||
[SetupCompileAfter ("SecondForwarder.dll", new[] { "Dependencies/ForwarderLibrary.cs" }, references: new[] { "Implementation.dll" })] | ||
|
||
[KeptAssembly ("FirstForwarder.dll")] | ||
[KeptAssembly ("SecondForwarder.dll")] | ||
[KeptMemberInAssembly ("Implementation.dll", typeof (ImplementationLibrary), "GetSomeValue()")] | ||
[RemovedForwarder ("FirstForwarder.dll", nameof (ImplementationStruct))] | ||
[RemovedForwarder ("SecondForwarder.dll", nameof (ImplementationStruct))] | ||
class UsedTransitiveForwarderIsDynamicallyAccessed | ||
{ | ||
static void Main () | ||
{ | ||
// FirstForwarder -> SecondForwarder -> Implementation | ||
PointToTypeInFacade ("Mono.Linker.Tests.Cases.TypeForwarding.Dependencies.ImplementationLibrary, FirstForwarder"); | ||
} | ||
|
||
[Kept] | ||
static void PointToTypeInFacade ( | ||
[KeptAttributeAttribute (typeof(DynamicallyAccessedMembersAttribute))] | ||
[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.All)] string typeName) | ||
{ | ||
} | ||
} | ||
} |