Skip to content

Instantly share code, notes, and snippets.

@lambdageek
Created July 7, 2021 18:45
Show Gist options
  • Save lambdageek/7bb9672fa0a95bb232926aa7630962f4 to your computer and use it in GitHub Desktop.
Save lambdageek/7bb9672fa0a95bb232926aa7630962f4 to your computer and use it in GitHub Desktop.
mono runtime components testing proj
  1. Save component-manifest.sample.proj to the base directory of dotnet/runtime

  2. Build with

    ./build.sh  --os iossimulator -c Release
    
  3. Test with

    ./dotnet.sh build component-manifest.sample.proj /p:RuntimeIdentifier=iossimulator-x64 /p:'MonoComponentOverride="hot_reload;debugger"' /v:d
    

Other RIDs should work too, but the sample.proj will need to adjust where it reads the .json file

<Project DefaultTarget="Hello">
<!-- Import Project="src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/RuntimeComponentManifest.props" / -->
<PropertyGroup>
<JsonToItemsTaskFactoryTasksAssemblyPath Condition="'$(MSBuildRuntimeType)' == 'Core'">$(MSBuildThisFileDirectory)artifacts\bin\JsonToItemsTaskFactory\Release\net6.0\JsonToItemsTaskFactory.dll</JsonToItemsTaskFactoryTasksAssemblyPath>
<JsonToItemsTaskFactoryTasksAssemblyPath Condition="'$(MSBuildRuntimeType)' != 'Core'">$(MSBuildThisFileDirectory)..\tasks\net472\JsonToItemsTaskFactory.dll</JsonToItemsTaskFactoryTasksAssemblyPath>
</PropertyGroup>
<UsingTask TaskName="MonoRuntimeComponentManifestReadTask" TaskFactory="JsonToItemsTaskFactory.JsonToItemsTaskFactory" AssemblyFile="$(JsonToItemsTaskFactoryTasksAssemblyPath)">
<ParameterGroup>
<_MonoRuntimeComponentSharedLibExt ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="false" Output="true" />
<_MonoRuntimeComponentStaticLibExt ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="false" Output="true" />
<_MonoRuntimeComponentLinking ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="false" Output="true" />
<_MonoRuntimeAvailableComponents ParameterType="Microsoft.Build.Framework.ITaskItem[]" Required="false" Output="true" />
</ParameterGroup>
<Task>debug</Task>
</UsingTask>
<PropertyGroup>
<_MonoRuntimeComponentManifestJsonFilePath>artifacts\bin\mono\iOSSimulator.x64.Release\build\RuntimeComponentManifest.json</_MonoRuntimeComponentManifestJsonFilePath>
</PropertyGroup>
<Target Name="Hello" DependsOnTargets="SelectComponents;PrintComponents">
</Target>
<Target Name="SelectComponents" DependsOnTargets="_MonoComputeAvailableComponentDefinitions">
<ItemGroup>
<!-- _MonoComponent Condition="'$(MonoComponentOverride)' == ''" Include="hot_reload"/ -->
<_MonoComponent Condition="'$(MonoComponentOverride)' != ''" Include="$(MonoComponentOverride)" />
</ItemGroup>
<Message Text="Available Components: @(_MonoRuntimeComponentName)" Importance="High" />
<Message Text="Selected Components: @(_MonoComponent)" Importance="High"/>
</Target>
<Target Name="PrintComponents" DependsOnTargets="_MonoSelectRuntimeComponents">
<Message Importance="High" Text="Runtime identifier: $(RuntimeIdentifier)" />
<Message Importance="High" Text="Selected : @(_MonoRuntimeSelectedComponents) %(ComponentLib)" />
<Message Importance="High" Text="Stubbed out : @(_MonoRuntimeSelectedStubComponents) %(ComponentStubLib)" />
<Message Importance="High" Text="Linking with lib @(_MonoRuntimeComponentLink) Stub: %(IsStub) Linking: %(Linking) Component: %(ComponentName)"/>
<Message Importance="High" Text="UnSelected : @(_MonoRuntimeUnSelectedComponents) %(ComponentLib)" />
<Message Importance="High" Text="Exclude these from linking: @(_MonoRuntimeComponentDontLink) Stub: %(IsStub) Linking: %(Linking) Component: %(ComponentName)" />
</Target>
<Import Project="src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/RuntimeComponentManifest.targets" />
</Project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment