-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extend host-probes-rid-assets and add a variant that uses the legacy graph for probing with .NET 8+.
- Loading branch information
Showing
14 changed files
with
138 additions
and
77 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
using System.Runtime.InteropServices; | ||
|
||
// Try load the native libraries packed under the rid folders. | ||
NativeLibrary.Load("mylib-unix", typeof(Program).Assembly, DllImportSearchPath.ApplicationDirectory); | ||
NativeLibrary.Load("mylib-sdkrid", typeof(Program).Assembly, DllImportSearchPath.ApplicationDirectory); |
18 changes: 18 additions & 0 deletions
18
host-probes-rid-assets-legacy/app/host-probes-rid-assets.csproj
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,18 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>$(TestTargetFramework)</TargetFramework> | ||
<RestoreSources>$(MSBuildThisFileDirectory)/../packages</RestoreSources> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="host-probes-rid-assets-mylib-unix" Version="1.0.0" /> | ||
<PackageReference Include="host-probes-rid-assets-mylib-sdkrid" Version="1.0.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<RuntimeHostConfigurationOption Include="System.Runtime.Loader.UseRidGraph" Value="true" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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,17 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>netstandard2.1</TargetFramework> | ||
<PackageId>host-probes-rid-assets-$(LibName)</PackageId> | ||
<!-- We need a native library for this test. Pick one from the runtime. --> | ||
<NativeLibrary>$(NetCoreRoot)/shared/Microsoft.NETCore.App/$(BundledNETCoreAppPackageVersion)/libSystem.Native.so</NativeLibrary> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<!-- Place it under the rid specific folder and rename it based on the Rid and LibName properties. --> | ||
<Content Include="$(NativeLibrary)"> | ||
<PackagePath>runtimes/$(Rid)/native/$(LibName).so</PackagePath> | ||
<Pack>true</Pack> | ||
</Content> | ||
</ItemGroup> | ||
</Project> |
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,11 @@ | ||
{ | ||
"name": "host-probes-rid-assets-legacy", | ||
"enabled": true, | ||
"requiresSdk": true, | ||
"version": "8.0", // test opts into using the legacy graph. | ||
"versionSpecific": false, | ||
"type": "bash", | ||
"cleanup": true, | ||
"ignoredRIDs":[ | ||
] | ||
} |
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,18 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euox pipefail | ||
|
||
# This test is testing the same functionality as host-probes-rid-assets | ||
# but when opting in to use the legacy graph (by setting System.Runtime.Loader.UseRidGraph=true). | ||
|
||
# The lib project packages a native library in a rid-specific folder. | ||
# Only one rid is considered per nuget package. | ||
# We pack it once for the sdk rid, and once for a base rid ('unix'). | ||
mkdir -p packages | ||
dotnet pack lib -o packages /p:Rid=unix /p:LibName=mylib-unix | ||
dotnet pack lib -o packages /p:Rid=$(../runtime-id --sdk) /p:LibName=mylib-sdkrid | ||
|
||
# This app reference the 'lib' NuGet packages, and loads the native libraries they contains. | ||
dotnet run --project app | ||
|
||
echo "PASS" |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
using System.Runtime.InteropServices; | ||
|
||
// Try load the native library packaged from the 'lib' class. | ||
NativeLibrary.Load("mylib", typeof(Program).Assembly, DllImportSearchPath.ApplicationDirectory); | ||
// Try load the native libraries packed under the rid folders. | ||
NativeLibrary.Load("mylib-unix", typeof(Program).Assembly, DllImportSearchPath.ApplicationDirectory); | ||
NativeLibrary.Load("mylib-sdkrid", typeof(Program).Assembly, DllImportSearchPath.ApplicationDirectory); |
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 |
---|---|---|
@@ -1,12 +1,14 @@ | ||
<Project Sdk="Microsoft.NET.Sdk.Web"> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<RestoreSources>$(MSBuildThisFileDirectory)/../packages</RestoreSources> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>$(TestTargetFramework)</TargetFramework> | ||
<RestoreSources>$(MSBuildThisFileDirectory)/../packages</RestoreSources> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="lib" Version="1.0.0" /> | ||
<PackageReference Include="host-probes-rid-assets-mylib-unix" Version="1.0.0" /> | ||
<PackageReference Include="host-probes-rid-assets-mylib-sdkrid" Version="1.0.0" /> | ||
</ItemGroup> | ||
|
||
</Project> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
set -x | ||
set -euox pipefail | ||
|
||
# The lib project packages a native library in a rid-specific folder. | ||
# Only one rid is considered per nuget package. | ||
# We pack it once for the sdk rid, and once for a base rid ('unix'). | ||
mkdir -p packages | ||
# This NuGet package packs a native library in a rid-specific folder. | ||
dotnet pack lib -o packages | ||
# This app reference the 'lib' NuGet package, and loads the native library it contains. | ||
dotnet pack lib -o packages /p:Rid=unix /p:LibName=mylib-unix | ||
dotnet pack lib -o packages /p:Rid=$(../runtime-id --sdk) /p:LibName=mylib-sdkrid | ||
|
||
# This app reference the 'lib' NuGet packages, and loads the native libraries they contains. | ||
dotnet run --project app | ||
|
||
echo "PASS" |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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