diff --git a/docs/design/mono/diagnostics-tracing.md b/docs/design/mono/diagnostics-tracing.md
index 9b5632c433fd77..9d1f668871caef 100644
--- a/docs/design/mono/diagnostics-tracing.md
+++ b/docs/design/mono/diagnostics-tracing.md
@@ -33,11 +33,11 @@ Depending on platform, there are different recommended and supported ways to inc
### Android
-Android is build using dynamic component support, meaning that components are included as shared objects and runtime will try to load them from the same location as `libmonosgen-2.0.so`. If runtime fails to load component, it will be disabled, if it successfully loads the component at runtime, it will be enabled and used. Enabling/disabling components is then a matter of including/excluding the needed shared library files in the APK (in same folder as `libmonosgen-2.0.so`). The same runtime build can be used to support any combination of components.
+Android is built using dynamic component support, meaning that components are included as shared objects and runtime will try to load them from the same location as `libmonosgen-2.0.so`. If runtime fails to load component, it will be disabled, if it successfully loads the component at runtime, it will be enabled and used. Enabling/disabling components is then a matter of including/excluding the needed shared library files in the APK (in same folder as `libmonosgen-2.0.so`). The same runtime build can be used to support any combination of components.
-If `AndroidAppBuilderTask` is used, there is a msbuild property, `RuntimeComponents` that can be used to include specific components in the generated application. By default, its empty, meaning all components will be disabled, using a `*` will enabled all components and by specify individual components, only those will be enabled. Enabling tracing would look like this, `RuntimeComponents="diagnostics_tracing"`, more components can be enabled by separating them with `;`.
+Android runtime pack has the following runtime components included: `debugger`, `hot_reload`, `diagnostics_tracing`, `marshal-ilgen`.
-Android runtime pack have the following component libraries included. For default scenarios, the dynamic versions should be used together with `libmonosgen-2.0.so`, but runtime pack also includes static versions of the components that can be used if runtime is built statically using `libmonosgen-2.0.a`. In case of static linking, using `libmono-component-*-stub-static.a` library will disable the component, using `libmono-component-*-static.a` will enable it.
+For default scenarios, the dynamic versions should be used together with `libmonosgen-2.0.so`, but runtime pack also includes static versions of the components that can be used if runtime is built statically using `libmonosgen-2.0.a`. In case of static linking, using `libmono-component-*-stub-static.a` library will disable the component, using `libmono-component-*-static.a` will enable it.
```
libmono-component-diagnostics_tracing.so
@@ -45,13 +45,15 @@ libmono-component-diagnostics_tracing-static.a
libmono-component-diagnostics_tracing-stub-static.a
```
+In order to enable the `diagnostic tracing` runtime component in your build, please take a look at [Enabling runtime components](#enabling-runtime-components) section.
+
### iOS
-iOS is build using static component support, meaning that components are included as static libraries that needs to be linked together with `libmonosgen-2.0.a` to produce final application. Static components come in two flavors, the component library, and a stub library. Linking the component library will enable the component in final application, while linking the stub library disables the component. Depending on linked component flavors it is possible to create a build that enables specific components while disabling others. All components needs to be linked in (using component or stub library) or there will be unresolved symbols in `libmonosgen-2.0.a`.
+iOS is built using static component support, meaning that components are included as static libraries that needs to be linked together with `libmonosgen-2.0.a` to produce final application. Static components come in two flavors, the component library, and a stub library. Linking the component library will enable the component in final application, while linking the stub library disables the component. Depending on linked component flavors it is possible to create a build that enables specific components while disabling others. All components needs to be linked in (using component or stub library) or there will be unresolved symbols in `libmonosgen-2.0.a`.
-If `AppleAppBuilderTask` is used, there is a msbuild property, `RuntimeComponents` that can be used to include specific components in the build application. By default, its empty, meaning all components will be disabled, using a `*` will enabled all components and by specify individual components, only those will be enabled. Enabling tracing would look like this, `RuntimeComponents="diagnostics_tracing"`, more components can be enabled by separating them with `;`.
+iOS runtime pack has the following runtime components included: `debugger`, `hot_reload`, `diagnostics_tracing`, `marshal-ilgen`.
-iOS runtime pack have the following component libraries included. Using `libmono-component-*-stub-static.a` library will disable the component, using `libmono-component-*-static.a` will enable it.
+Using `libmono-component-*-stub-static.a` library will disable the component, using `libmono-component-*-static.a` will enable it.
```
libmono-component-diagnostics_tracing-static.a
@@ -60,6 +62,39 @@ libmono-component-diagnostics_tracing-stub-static.a
NOTE, running on iOS simulator offers some additional capabilities, so runtime pack for iOS includes shared as well as static library builds, like the Android use case described above.
+In order to enable the `diagnostic tracing` runtime component in your build, please take a look at [Enabling runtime components](#enabling-runtime-components) section.
+
+### Enabling runtime components
+
+When using `AndroidAppBuilderTask` to target `Android`, or `AppleAppBuilderTask` to target `iOS` platforms, there is a MSBuild item: `RuntimeComponents` that can be used to include specific components in the generated application. By default, its empty, meaning all components will be disabled.
+To enable a single component (eg: `diagnostic tracing`), by adding the following to your project file:
+```xml
+
+
+
+```
+will enable only that runtime component.
+
+On the other hand, if it is desired to include all components, there are two options:
+1. Manually, include all supported components manually via:
+```xml
+
+
+
+
+
+
+```
+2. Automatically, use provided MSBuild property that includes all the supported components for you, in the following way:
+ - Import `AndroidBuild.props/targets` in your project file (the file can be found [here](../../../src/mono/msbuild/android/build/AndroidBuild.targets))
+ - Set `UseAllRuntimeComponents` MSBuild property to `true` via:
+ - By adding: `-p:UseAllRuntimeComponents=true` to your build command, or
+ - By adding the following in your project file:
+ ```xml
+
+ true
+
+ ```
## Install diagnostic client tooling
```
diff --git a/src/libraries/System.Diagnostics.Tracing/tests/System.Diagnostics.Tracing.Tests.csproj b/src/libraries/System.Diagnostics.Tracing/tests/System.Diagnostics.Tracing.Tests.csproj
index a650b53c7975c8..8c5a0b086946fb 100644
--- a/src/libraries/System.Diagnostics.Tracing/tests/System.Diagnostics.Tracing.Tests.csproj
+++ b/src/libraries/System.Diagnostics.Tracing/tests/System.Diagnostics.Tracing.Tests.csproj
@@ -5,9 +5,10 @@
true
true
-
- diagnostics_tracing;marshal-ilgen
-
+
+
+
+
diff --git a/src/libraries/sendtohelix-mobile.targets b/src/libraries/sendtohelix-mobile.targets
index 8bc9b527ac7d9d..6ad05011487a1e 100644
--- a/src/libraries/sendtohelix-mobile.targets
+++ b/src/libraries/sendtohelix-mobile.targets
@@ -58,6 +58,7 @@
<_XHarnessAppleCustomCommand Condition="'$(NeedsiOSSDK)' == 'true'">
source build-apple-app.sh
+ <_RuntimeComponentManifestDir>$([MSBuild]::NormalizeDirectory('$(MonoArtifactsPath)', 'build'))
@@ -66,6 +67,8 @@
+
linux
<_IsLibraryMode Condition="'$(UseNativeAOTRuntime)' != 'true' and '$(NativeLib)' != ''">true
+ <_ReadRuntimeComponentsManifestTargetName Condition="'$(UseNativeAOTRuntime)' != 'true'">_MonoReadAvailableComponentsManifest
Publish
+ $(_ReadRuntimeComponentsManifestTargetName);
_InitializeCommonProperties;
_BeforeAndroidBuild;
_AndroidResolveReferences;
@@ -21,5 +23,11 @@
_AndroidGenerateAppBundle;
_AfterAndroidBuild
+
+
+ <_CommonTargetsDir Condition="'$(_CommonTargetsDir)' == ''">$([MSBuild]::NormalizeDirectory($(MSBuildThisFileDirectory), '..', '..', 'common'))
+
+
+
\ No newline at end of file
diff --git a/src/mono/msbuild/android/build/AndroidBuild.targets b/src/mono/msbuild/android/build/AndroidBuild.targets
index 99a226aafc603a..917aed88506697 100644
--- a/src/mono/msbuild/android/build/AndroidBuild.targets
+++ b/src/mono/msbuild/android/build/AndroidBuild.targets
@@ -41,16 +41,12 @@
<_MonoHeaderPath>$([MSBuild]::NormalizeDirectory($(MicrosoftNetCoreAppRuntimePackRidNativeDir), 'include', 'mono-2.0'))
-
-
- <_RuntimeComponentList Include="$(RuntimeComponents)" />
- <_RuntimeComponentList Include="marshal-ilgen" KeepDuplicates="false"/>
+
+
+
+
-
- @(_RuntimeComponentList)
-
-
<_CommonLinkerArgs Include="-l:libz.so" />
<_CommonLinkerArgs Include="-l:liblog.so" />
@@ -58,23 +54,14 @@
<_CommonLinkerArgs Include="-l:libm.so" />
<_CommonLinkerArgs Include="--build-id=sha1" />
-
-
-
-
-
- <_UsedComponents
- Condition="'$(RuntimeComponents)' != '' and '$(RuntimeComponents)' != '*'"
- Include="$(RuntimeComponents)" />
-
- <_RuntimeLibraries
- Include="$(AndroidBuildDir)\*-stub-static.a" />
- <_RuntimeLibraries
- Include="$(AndroidBuildDir)\*.a"
- Exclude="$(AndroidBuildDir)\*-static.a" />
-
- <_RuntimeLibraries Remove="$(AndroidBuildDir)\libmono-component-%(_UsedComponents.Identity)-stub-static.a" />
- <_RuntimeLibraries Include="$(AndroidBuildDir)\libmono-component-%(_UsedComponents.Identity)-static.a" />
+
+ <_RuntimeLibraries Include="$(AndroidBuildDir)\*.a" Exclude="$(AndroidBuildDir)\libmono-component-*.a" />
+
+ <_RuntimeLibraries Include="$(AndroidBuildDir)\libmono-component-*-stub-static.a" />
+
+ <_RuntimeLibraries Condition="'@(RuntimeComponents)' != ''" Remove="$(AndroidBuildDir)\libmono-component-%(RuntimeComponents.Identity)-stub-static.a" />
+ <_RuntimeLibraries Condition="'@(RuntimeComponents)' != ''" Include="$(AndroidBuildDir)\libmono-component-%(RuntimeComponents.Identity)-static.a" />
+
@@ -283,7 +270,7 @@
NativeDependencies="@(_NativeDependencies)"
OutputDir="$(AndroidBundleDir)"
ProjectName="$(AssemblyName)"
- RuntimeComponents="$(RuntimeComponents)"
+ RuntimeComponents="@(RuntimeComponents)"
RuntimeIdentifier="$(RuntimeIdentifier)"
StripDebugSymbols="False">
diff --git a/src/mono/msbuild/apple/build/AppleBuild.LocalBuild.props b/src/mono/msbuild/apple/build/AppleBuild.LocalBuild.props
index 1b26d384c4b995..8fe589c70e94fc 100644
--- a/src/mono/msbuild/apple/build/AppleBuild.LocalBuild.props
+++ b/src/mono/msbuild/apple/build/AppleBuild.LocalBuild.props
@@ -19,7 +19,6 @@
$(AppleBuildSupportDir) - directory which has all the tasks, targets, and runtimepack
-->
-
@@ -84,4 +83,7 @@
$([MSBuild]::NormalizePath('$(MonoTargetsTasksDir)', 'MonoTargetsTasks.dll'))
+
+
+
diff --git a/src/mono/msbuild/apple/build/AppleBuild.props b/src/mono/msbuild/apple/build/AppleBuild.props
index 860ab8c6976aff..211b35e7004e1a 100644
--- a/src/mono/msbuild/apple/build/AppleBuild.props
+++ b/src/mono/msbuild/apple/build/AppleBuild.props
@@ -24,9 +24,11 @@
<_AotCompileTargetName Condition="'$(UseNativeAOTRuntime)' == 'true'">_AppleNativeAotCompile
<_AotCompileTargetName Condition="'$(UseNativeAOTRuntime)' != 'true'">_AppleAotCompile
ComputeIlcCompileInputs;SetupOSSpecificProps;PrepareForILLink
+ <_ReadRuntimeComponentsManifestTargetName Condition="'$(UseNativeAOTRuntime)' != 'true'">_MonoReadAvailableComponentsManifest
Publish
+ $(_ReadRuntimeComponentsManifestTargetName);
_InitializeCommonProperties;
_BeforeAppleBuild;
_AppleResolveReferences;
@@ -37,5 +39,11 @@
_AppleGenerateAppBundle;
_AfterAppleBuild
+
+
+ <_CommonTargetsDir Condition="'$(_CommonTargetsDir)' == ''">$([MSBuild]::NormalizeDirectory($(MSBuildThisFileDirectory), '..', '..', 'common'))
+
+
+
\ No newline at end of file
diff --git a/src/mono/msbuild/apple/build/AppleBuild.targets b/src/mono/msbuild/apple/build/AppleBuild.targets
index 936bb275516e16..6629acfa5bcf8f 100644
--- a/src/mono/msbuild/apple/build/AppleBuild.targets
+++ b/src/mono/msbuild/apple/build/AppleBuild.targets
@@ -58,9 +58,11 @@
$(AssemblyName)
-
- marshal-ilgen
-
+
+
+
+
+
@@ -106,47 +108,35 @@
-
-
- true
-
+
-
-
+
-
+
-
+
-
+
-
- @(RuntimeComponentList)
-
-
-
-
-
-
- <_UsedComponents
- Condition="'$(RuntimeComponents)' != '' and '$(RuntimeComponents)' != '*'"
- Include="$(RuntimeComponents)" />
-
+
<_RuntimeLibraries Include="$(AppleBuildDir)\*.a" Exclude="$(AppleBuildDir)\libmono-component-*.a" />
+
<_RuntimeLibraries Include="$(AppleBuildDir)\libmono-component-*-stub-static.a" />
- <_RuntimeLibraries Remove="$(AppleBuildDir)\libmono-component-%(_UsedComponents.Identity)-stub-static.a" />
- <_RuntimeLibraries Include="$(AppleBuildDir)\libmono-component-%(_UsedComponents.Identity)-static.a" />
+
+ <_RuntimeLibraries Condition="'@(RuntimeComponents)' != ''" Remove="$(AppleBuildDir)\libmono-component-%(RuntimeComponents.Identity)-stub-static.a" />
+ <_RuntimeLibraries Condition="'@(RuntimeComponents)' != ''" Include="$(AppleBuildDir)\libmono-component-%(RuntimeComponents.Identity)-static.a" />
+
@@ -325,7 +315,7 @@
Optimized="$(Optimized)"
OutputDirectory="$(AppleBundleDir)"
ProjectName="$(AppName)"
- RuntimeComponents="$(RuntimeComponents)"
+ RuntimeComponents="@(RuntimeComponents)"
StripSymbolTable="$(StripDebugSymbols)"
TargetOS="$(TargetOS)"
UseConsoleUITemplate="$(UseConsoleUITemplate)"
diff --git a/src/mono/msbuild/apple/data/Directory.Build.props b/src/mono/msbuild/apple/data/Directory.Build.props
index d86cea231468b3..8e1cebe431fe3d 100644
--- a/src/mono/msbuild/apple/data/Directory.Build.props
+++ b/src/mono/msbuild/apple/data/Directory.Build.props
@@ -2,17 +2,17 @@
$(HELIX_CORRELATION_PAYLOAD)\build\
<_AppleTargetsDir>$(AppleBuildSupportDir)\apple\
- <_LibraryTargetsDir>$(AppleBuildSupportDir)\common\
+ <_CommonTargetsDir>$(AppleBuildSupportDir)\common\
<_AppleTargetsDir Condition="'$(_AppleTargetsDir)' == '' and '$(RuntimeSrcDir)' != ''">$(RuntimeSrcDir)\src\mono\msbuild\apple\build\
<_AppleTargetsDir Condition="'$(_AppleTargetsDir)' != ''">$([MSBuild]::EnsureTrailingSlash($(_AppleTargetsDir)))
- <_LibraryTargetsDir Condition="'$(_LibraryTargetsDir)' == '' and '$(RuntimeSrcDir)' != ''">$(RuntimeSrcDir)\src\mono\msbuild\common\
- <_LibraryTargetsDir Condition="'$(_LibraryTargetsDir)' != ''">$([MSBuild]::EnsureTrailingSlash($(_LibraryTargetsDir)))
+ <_CommonTargetsDir Condition="'$(_CommonTargetsDir)' == '' and '$(RuntimeSrcDir)' != ''">$(RuntimeSrcDir)\src\mono\msbuild\common\
+ <_CommonTargetsDir Condition="'$(_CommonTargetsDir)' != ''">$([MSBuild]::EnsureTrailingSlash($(_CommonTargetsDir)))
-
+
PrepareForAppleBuild;$(AppleBuildDependsOn)
diff --git a/src/mono/msbuild/apple/data/Directory.Build.targets b/src/mono/msbuild/apple/data/Directory.Build.targets
index 329f06b80dee2f..59ea9bc47ba208 100644
--- a/src/mono/msbuild/apple/data/Directory.Build.targets
+++ b/src/mono/msbuild/apple/data/Directory.Build.targets
@@ -14,6 +14,6 @@
-
+
diff --git a/src/mono/msbuild/apple/data/ProxyProjectForAOTOnHelix.proj b/src/mono/msbuild/apple/data/ProxyProjectForAOTOnHelix.proj
index 37be991b09c922..1bdf85d6403b15 100644
--- a/src/mono/msbuild/apple/data/ProxyProjectForAOTOnHelix.proj
+++ b/src/mono/msbuild/apple/data/ProxyProjectForAOTOnHelix.proj
@@ -53,9 +53,14 @@
- diagnostics_tracing;marshal-ilgen
127.0.0.1:9000,nosuspend,listen
+
+
+
+
+
+
+
+ false
+
+ <_RuntimeComponentManifestDir Condition="'$(_RuntimeComponentManifestDir)' == '' and '$(BuildTestsOn)' != 'helix' and '$(MonoArtifactsPath)' != ''">$([MSBuild]::NormalizePath('$(MonoArtifactsPath)', 'build'))
+ <_RuntimeComponentManifestDir Condition="'$(_RuntimeComponentManifestDir)' == '' and '$(BuildTestsOn)' != 'helix' and '$(RuntimeBinDir)' != ''">$([MSBuild]::NormalizePath('$(RuntimeBinDir)', 'build'))
+ <_RuntimeComponentManifestDir Condition="'$(_RuntimeComponentManifestDir)' == '' and '$(MicrosoftNetCoreAppRuntimePackRidDir)' != ''">$([MSBuild]::NormalizePath('$(MicrosoftNetCoreAppRuntimePackRidDir)', 'build'))
+ <_RuntimeComponentManifestDir>$([MSBuild]::EnsureTrailingSlash('$(_RuntimeComponentManifestDir)'))
+ <_MonoRuntimeComponentManifestJsonFilePath Condition="'$(_MonoRuntimeComponentManifestJsonFilePath)' == '' and '$(_RuntimeComponentManifestDir)' != ''">$(_RuntimeComponentManifestDir)RuntimeComponentManifest.json
+
+
+
+
+ <_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" />
+
+
+
\ No newline at end of file
diff --git a/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/RuntimeComponentManifest.targets b/src/mono/msbuild/common/RuntimeComponentManifest.targets
similarity index 100%
rename from src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Sdk/RuntimeComponentManifest.targets
rename to src/mono/msbuild/common/RuntimeComponentManifest.targets
diff --git a/src/mono/nuget/Microsoft.NET.Runtime.LibraryBuilder.Sdk/Microsoft.NET.Runtime.LibraryBuilder.Sdk.pkgproj b/src/mono/nuget/Microsoft.NET.Runtime.LibraryBuilder.Sdk/Microsoft.NET.Runtime.LibraryBuilder.Sdk.pkgproj
index f01678f86f6ded..81017a4279a17d 100644
--- a/src/mono/nuget/Microsoft.NET.Runtime.LibraryBuilder.Sdk/Microsoft.NET.Runtime.LibraryBuilder.Sdk.pkgproj
+++ b/src/mono/nuget/Microsoft.NET.Runtime.LibraryBuilder.Sdk/Microsoft.NET.Runtime.LibraryBuilder.Sdk.pkgproj
@@ -16,6 +16,8 @@
+
+
diff --git a/src/mono/nuget/Microsoft.NET.Runtime.LibraryBuilder.Sdk/Sdk/Sdk.targets.in b/src/mono/nuget/Microsoft.NET.Runtime.LibraryBuilder.Sdk/Sdk/Sdk.targets.in
index dbe8e157a0026e..633a0414b80d16 100644
--- a/src/mono/nuget/Microsoft.NET.Runtime.LibraryBuilder.Sdk/Sdk/Sdk.targets.in
+++ b/src/mono/nuget/Microsoft.NET.Runtime.LibraryBuilder.Sdk/Sdk/Sdk.targets.in
@@ -10,6 +10,7 @@
$(_TasksDir)LibraryBuilder.dll
$(_TasksDir)MobileBuildTasks.dll
+ <_CommonTargetsDir>$(MSBuildThisFileDirectory)
diff --git a/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Microsoft.NET.Runtime.MonoTargets.Sdk.pkgproj b/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Microsoft.NET.Runtime.MonoTargets.Sdk.pkgproj
index 8d9e3dea06baf8..f2db3fcf82d2d1 100644
--- a/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Microsoft.NET.Runtime.MonoTargets.Sdk.pkgproj
+++ b/src/mono/nuget/Microsoft.NET.Runtime.MonoTargets.Sdk/Microsoft.NET.Runtime.MonoTargets.Sdk.pkgproj
@@ -13,7 +13,7 @@
-
+
diff --git a/src/mono/sample/Android/AndroidSampleApp.csproj b/src/mono/sample/Android/AndroidSampleApp.csproj
index c5316052559933..7fb665824e5bea 100644
--- a/src/mono/sample/Android/AndroidSampleApp.csproj
+++ b/src/mono/sample/Android/AndroidSampleApp.csproj
@@ -10,6 +10,10 @@
false
+
+
+
+
@@ -46,14 +50,9 @@
- <_RuntimeComponentList Include="$(RuntimeComponents)" />
- <_RuntimeComponentList Include="marshal-ilgen" KeepDuplicates="false"/>
+
-
- @(_RuntimeComponentList)
-
-
<_AotOutputType>Library
<_AotLibraryFormat>So
@@ -116,7 +115,7 @@
MonoRuntimeHeaders="$(MicrosoftNetCoreAppRuntimePackDir)runtimes\android-$(TargetArchitecture)\native\include\mono-2.0"
OutputDir="$(ApkDir)"
ProjectName="HelloAndroid"
- RuntimeComponents="$(RuntimeComponents)"
+ RuntimeComponents="@(RuntimeComponents)"
RuntimeIdentifier="$(RuntimeIdentifier)"
StripDebugSymbols="$(StripDebugSymbols)">
diff --git a/src/mono/sample/Android/Makefile b/src/mono/sample/Android/Makefile
index 7c741f0c96b835..64f5e13a5e89a6 100644
--- a/src/mono/sample/Android/Makefile
+++ b/src/mono/sample/Android/Makefile
@@ -7,15 +7,13 @@ AOT_WITH_LIBRARY_FILES=false
INTERP=false
DEPLOY_AND_RUN?=true
-#If DIAGNOSTIC_PORTS is enabled, RUNTIME_COMPONENTS must also be enabled.
-#If RUNTIME_COMPONENTS is enabled, DIAGNOSTIC_PORTS is optional.
-#If RUNTIME_COMPONENTS is enabled, DIAGNOSTIC_PORTS is disabled, use DOTNET_DiagnosticPorts when launching application to enable diagnostics.
-#RUNTIME_COMPONENTS=marshal-ilgen;diagnostics_tracing
+#If DIAGNOSTIC_PORTS is enabled, @(RuntimeComponents) must also include 'diagnostics_tracing'.
+#If @(RuntimeComponents) includes 'diagnostics_tracing', DIAGNOSTIC_PORTS is optional.
+#If @(RuntimeComponents) includes 'diagnostics_tracing', and DIAGNOSTIC_PORTS is disabled, then use DOTNET_DiagnosticPorts when launching application to enable diagnostics.
#DIAGNOSTIC_PORTS=10.0.2.2:9000,nosuspend
#DIAGNOSTIC_PORTS=10.0.2.2:9000,suspend
#DIAGNOSTIC_PORTS=$(DOTNET_DiagnosticPorts)
-
all: runtimepack run
runtimepack:
@@ -33,7 +31,6 @@ run:
/p:MonoForceInterpreter=$(INTERP) \
/p:UseLLVM=$(USE_LLVM) \
/p:RunActivity=false \
- '/p:RuntimeComponents="$(RUNTIME_COMPONENTS)"' \
'/p:DiagnosticPorts="$(DIAGNOSTIC_PORTS)"'
clean:
rm -rf ../../../../artifacts/bin/AndroidSampleApp
diff --git a/src/mono/sample/iOS/Makefile b/src/mono/sample/iOS/Makefile
index 9c55609d72382b..e3c8320dcd96e3 100644
--- a/src/mono/sample/iOS/Makefile
+++ b/src/mono/sample/iOS/Makefile
@@ -8,10 +8,9 @@ APP_SANDBOX?=false
STRIP_DEBUG_SYMBOLS?=false # only used when measuring SOD via build-appbundle make target
HYBRID_GLOBALIZATION?=false
-#If DIAGNOSTIC_PORTS is enabled, RUNTIME_COMPONENTS must also be enabled.
-#If RUNTIME_COMPONENTS is enabled, DIAGNOSTIC_PORTS is optional.
-#If RUNTIME_COMPONENTS is enabled, DIAGNOSTIC_PORTS is disabled, use DOTNET_DiagnosticPorts when launching application to enable diagnostics.
-#RUNTIME_COMPONENTS=marshal-ilgen;diagnostics_tracing
+#If DIAGNOSTIC_PORTS is enabled, @(RuntimeComponents) must also include 'diagnostics_tracing'.
+#If @(RuntimeComponents) includes 'diagnostics_tracing', DIAGNOSTIC_PORTS is optional.
+#If @(RuntimeComponents) includes 'diagnostics_tracing', and DIAGNOSTIC_PORTS is disabled, then use DOTNET_DiagnosticPorts when launching application to enable diagnostics.
#DIAGNOSTIC_PORTS=127.0.0.1:9000,nosuspend
#DIAGNOSTIC_PORTS=127.0.0.1:9000,suspend
#DIAGNOSTIC_PORTS=$(DOTNET_DiagnosticPorts)
@@ -45,7 +44,6 @@ run: clean appbuilder
/p:TargetArchitecture=$(MONO_ARCH) \
/p:MonoEnableLLVM=$(USE_LLVM) \
/p:DeployAndRun=$(DEPLOY_AND_RUN) \
- '/p:RuntimeComponents="$(RUNTIME_COMPONENTS)"' \
'/p:DiagnosticPorts="$(DIAGNOSTIC_PORTS)"' \
/bl
@@ -57,7 +55,6 @@ run-sim: clean appbuilder
/p:MonoEnableLLVM=$(USE_LLVM) \
/p:MonoForceInterpreter=false \
/p:DeployAndRun=$(DEPLOY_AND_RUN) \
- '/p:RuntimeComponents="$(RUNTIME_COMPONENTS)"' \
'/p:DiagnosticPorts="$(DIAGNOSTIC_PORTS)"' \
/bl
@@ -69,7 +66,6 @@ run-sim-interp: clean appbuilder
/p:MonoEnableLLVM=$(USE_LLVM) \
/p:MonoForceInterpreter=true \
/p:DeployAndRun=$(DEPLOY_AND_RUN) \
- '/p:RuntimeComponents="$(RUNTIME_COMPONENTS)"' \
'/p:DiagnosticPorts="$(DIAGNOSTIC_PORTS)"' \
/bl
@@ -82,7 +78,6 @@ run-catalyst: clean appbuilder
/p:MonoForceInterpreter=false \
/p:DeployAndRun=$(DEPLOY_AND_RUN) \
/p:EnableAppSandbox=$(APP_SANDBOX) \
- '/p:RuntimeComponents="$(RUNTIME_COMPONENTS)"' \
/bl
run-catalyst-interp: clean appbuilder
@@ -94,7 +89,6 @@ run-catalyst-interp: clean appbuilder
/p:MonoForceInterpreter=true \
/p:DeployAndRun=$(DEPLOY_AND_RUN) \
/p:EnableAppSandbox=$(APP_SANDBOX) \
- '/p:RuntimeComponents="$(RUNTIME_COMPONENTS)"' \
/bl
clean:
diff --git a/src/mono/sample/iOS/Program.csproj b/src/mono/sample/iOS/Program.csproj
index f7b0306ba23c1d..ad1fa59aa6f906 100644
--- a/src/mono/sample/iOS/Program.csproj
+++ b/src/mono/sample/iOS/Program.csproj
@@ -26,13 +26,17 @@
Publish
+
+
+
+
-
+
diff --git a/src/tasks/AndroidAppBuilder/AndroidAppBuilder.cs b/src/tasks/AndroidAppBuilder/AndroidAppBuilder.cs
index ddbbe5bc64d195..626a6d2b191705 100644
--- a/src/tasks/AndroidAppBuilder/AndroidAppBuilder.cs
+++ b/src/tasks/AndroidAppBuilder/AndroidAppBuilder.cs
@@ -66,7 +66,7 @@ public class AndroidAppBuilderTask : Task
///
/// List of enabled runtime components
///
- public string? RuntimeComponents { get; set; } = ""!;
+ public string[] RuntimeComponents { get; set; } = Array.Empty();
///
/// Diagnostic ports configuration string
diff --git a/src/tasks/AndroidAppBuilder/ApkBuilder.cs b/src/tasks/AndroidAppBuilder/ApkBuilder.cs
index d215ffcb271ec2..9b2a4e36456627 100644
--- a/src/tasks/AndroidAppBuilder/ApkBuilder.cs
+++ b/src/tasks/AndroidAppBuilder/ApkBuilder.cs
@@ -35,7 +35,7 @@ public partial class ApkBuilder
public bool InvariantGlobalization { get; set; }
public bool EnableRuntimeLogging { get; set; }
public bool StaticLinkedRuntime { get; set; }
- public string? RuntimeComponents { get; set; }
+ public string[] RuntimeComponents { get; set; } = Array.Empty();
public string? DiagnosticPorts { get; set; }
public bool IsLibraryMode { get; set; }
public ITaskItem[] Assemblies { get; set; } = Array.Empty();
@@ -98,19 +98,9 @@ public ApkBuilder(TaskLoggingHelper logger)
throw new InvalidOperationException("Interpreter and AOT cannot be enabled at the same time");
}
- if (!string.IsNullOrEmpty(DiagnosticPorts))
+ if (!string.IsNullOrEmpty(DiagnosticPorts) && !Array.Exists(RuntimeComponents, runtimeComponent => string.Equals(runtimeComponent, "diagnostics_tracing", StringComparison.OrdinalIgnoreCase)))
{
- bool validDiagnosticsConfig = false;
-
- if (string.IsNullOrEmpty(RuntimeComponents))
- validDiagnosticsConfig = false;
- else if (RuntimeComponents.Equals("*", StringComparison.OrdinalIgnoreCase))
- validDiagnosticsConfig = true;
- else if (RuntimeComponents.Contains("diagnostics_tracing", StringComparison.OrdinalIgnoreCase))
- validDiagnosticsConfig = true;
-
- if (!validDiagnosticsConfig)
- throw new ArgumentException("Using DiagnosticPorts require diagnostics_tracing runtime component.");
+ throw new ArgumentException($"Using DiagnosticPorts requires diagnostics_tracing runtime component, which was not included in 'RuntimeComponents' item group. @RuntimeComponents: '{string.Join(", ", RuntimeComponents)}'");
}
// Try to get the latest build-tools version if not specified
@@ -278,34 +268,19 @@ public ApkBuilder(TaskLoggingHelper logger)
if (StaticLinkedRuntime)
{
string[] staticComponentStubLibs = Directory.GetFiles(AppDir, "libmono-component-*-stub-static.a");
- bool staticLinkAllComponents = false;
- string[] staticLinkedComponents = Array.Empty();
-
- if (!string.IsNullOrEmpty(RuntimeComponents) && RuntimeComponents.Equals("*", StringComparison.OrdinalIgnoreCase))
- staticLinkAllComponents = true;
- else if (!string.IsNullOrEmpty(RuntimeComponents))
- staticLinkedComponents = RuntimeComponents.Split(";");
// by default, component stubs will be linked and depending on how mono runtime has been build,
// stubs can disable or dynamic load components.
foreach (string staticComponentStubLib in staticComponentStubLibs)
{
string componentLibToLink = staticComponentStubLib;
- if (staticLinkAllComponents)
+ foreach (string runtimeComponent in RuntimeComponents)
{
- // static link component.
- componentLibToLink = componentLibToLink.Replace("-stub-static.a", "-static.a", StringComparison.OrdinalIgnoreCase);
- }
- else
- {
- foreach (string staticLinkedComponent in staticLinkedComponents)
+ if (componentLibToLink.Contains(runtimeComponent, StringComparison.OrdinalIgnoreCase))
{
- if (componentLibToLink.Contains(staticLinkedComponent, StringComparison.OrdinalIgnoreCase))
- {
- // static link component.
- componentLibToLink = componentLibToLink.Replace("-stub-static.a", "-static.a", StringComparison.OrdinalIgnoreCase);
- break;
- }
+ // static link component.
+ componentLibToLink = componentLibToLink.Replace("-stub-static.a", "-static.a", StringComparison.OrdinalIgnoreCase);
+ break;
}
}
@@ -463,13 +438,6 @@ public ApkBuilder(TaskLoggingHelper logger)
}
// add all *.so files to lib/%abi%/
- string[] dynamicLinkedComponents = Array.Empty();
- bool dynamicLinkAllComponents = false;
- if (!StaticLinkedRuntime && !string.IsNullOrEmpty(RuntimeComponents) && RuntimeComponents.Equals("*", StringComparison.OrdinalIgnoreCase))
- dynamicLinkAllComponents = true;
- if (!string.IsNullOrEmpty(RuntimeComponents) && !StaticLinkedRuntime)
- dynamicLinkedComponents = RuntimeComponents.Split(";");
-
Directory.CreateDirectory(Path.Combine(OutputDir, "lib", abi));
foreach (var dynamicLib in dynamicLibs)
{
@@ -487,18 +455,19 @@ public ApkBuilder(TaskLoggingHelper logger)
if (dynamicLibName.Contains("libmono-component-", StringComparison.OrdinalIgnoreCase))
{
- bool includeComponent = dynamicLinkAllComponents;
- if (!StaticLinkedRuntime && !includeComponent)
+ bool includeComponent = false;
+ if (!StaticLinkedRuntime)
{
- foreach (string dynamicLinkedComponent in dynamicLinkedComponents)
+ foreach (string runtimeComponent in RuntimeComponents)
{
- if (dynamicLibName.Contains(dynamicLinkedComponent, StringComparison.OrdinalIgnoreCase))
+ if (dynamicLibName.Contains(runtimeComponent, StringComparison.OrdinalIgnoreCase))
{
includeComponent = true;
break;
}
}
}
+
if (!includeComponent)
{
// make sure dynamic component is not included in package.
diff --git a/src/tasks/AndroidAppBuilder/Templates/monodroid.c b/src/tasks/AndroidAppBuilder/Templates/monodroid.c
index 109b0bd18736e4..d139109f7b0a90 100644
--- a/src/tasks/AndroidAppBuilder/Templates/monodroid.c
+++ b/src/tasks/AndroidAppBuilder/Templates/monodroid.c
@@ -234,7 +234,7 @@ mono_droid_runtime_init (const char* executable, int managed_argc, char* managed
// build using DiagnosticPorts property in AndroidAppBuilder
// or set DOTNET_DiagnosticPorts env via adb, xharness when undefined.
- // NOTE, using DOTNET_DiagnosticPorts requires app build using AndroidAppBuilder and RuntimeComponents=diagnostics_tracing
+ // NOTE, using DOTNET_DiagnosticPorts requires app build using AndroidAppBuilder and RuntimeComponents to include 'diagnostics_tracing' component
#ifdef DIAGNOSTIC_PORTS
setenv ("DOTNET_DiagnosticPorts", DIAGNOSTIC_PORTS, true);
#endif
diff --git a/src/tasks/AppleAppBuilder/AppleAppBuilder.cs b/src/tasks/AppleAppBuilder/AppleAppBuilder.cs
index 5315533105a0a2..0e16db616d62e8 100644
--- a/src/tasks/AppleAppBuilder/AppleAppBuilder.cs
+++ b/src/tasks/AppleAppBuilder/AppleAppBuilder.cs
@@ -140,7 +140,7 @@ public string TargetOS
///
/// List of enabled runtime components
///
- public string? RuntimeComponents { get; set; } = ""!;
+ public string[] RuntimeComponents { get; set; } = Array.Empty();
///
/// Diagnostic ports configuration string
@@ -207,8 +207,8 @@ public void ValidateRuntimeSelection()
if (ForceAOT)
throw new ArgumentException($"Property \"{nameof(ForceAOT)}\" is not supported with NativeAOT runtime and will be ignored.");
- if (!string.IsNullOrEmpty(RuntimeComponents))
- throw new ArgumentException($"Property \"{nameof(RuntimeComponents)}\" is not supported with NativeAOT runtime and will be ignored.");
+ if (RuntimeComponents.Length > 0)
+ throw new ArgumentException($"Item \"{nameof(RuntimeComponents)}\" is not supported with NativeAOT runtime and will be ignored.");
if (!string.IsNullOrEmpty(DiagnosticPorts))
throw new ArgumentException($"Property \"{nameof(DiagnosticPorts)}\" is not supported with NativeAOT runtime and will be ignored.");
@@ -294,19 +294,9 @@ public override bool Execute()
}
}
- if (!string.IsNullOrEmpty(DiagnosticPorts))
+ if (!string.IsNullOrEmpty(DiagnosticPorts) && !Array.Exists(RuntimeComponents, runtimeComponent => string.Equals(runtimeComponent, "diagnostics_tracing", StringComparison.OrdinalIgnoreCase)))
{
- bool validDiagnosticsConfig = false;
-
- if (string.IsNullOrEmpty(RuntimeComponents))
- validDiagnosticsConfig = false;
- else if (RuntimeComponents.Equals("*", StringComparison.OrdinalIgnoreCase))
- validDiagnosticsConfig = true;
- else if (RuntimeComponents.Contains("diagnostics_tracing", StringComparison.OrdinalIgnoreCase))
- validDiagnosticsConfig = true;
-
- if (!validDiagnosticsConfig)
- throw new ArgumentException("Using DiagnosticPorts require diagnostics_tracing runtime component.");
+ throw new ArgumentException($"Using DiagnosticPorts requires diagnostics_tracing runtime component, which was not included in 'RuntimeComponents' item group. @RuntimeComponents: '{string.Join(", ", RuntimeComponents)}'");
}
if (EnableAppSandbox && (string.IsNullOrEmpty(DevTeamProvisioning) || DevTeamProvisioning == "-"))
diff --git a/src/tasks/AppleAppBuilder/Templates/runtime-librarymode.m b/src/tasks/AppleAppBuilder/Templates/runtime-librarymode.m
index 948cb3d0269537..274d9a5414c16d 100644
--- a/src/tasks/AppleAppBuilder/Templates/runtime-librarymode.m
+++ b/src/tasks/AppleAppBuilder/Templates/runtime-librarymode.m
@@ -66,7 +66,7 @@ int invoke_netlibrary_entrypoints (void)
// build using DiagnosticPorts property in AppleAppBuilder
// or set DOTNET_DiagnosticPorts env via mlaunch, xharness when undefined.
- // NOTE, using DOTNET_DiagnosticPorts requires app build using AppleAppBuilder and RuntimeComponents=diagnostics_tracing
+ // NOTE, using DOTNET_DiagnosticPorts requires app build using AppleAppBuilder and RuntimeComponents to include 'diagnostics_tracing' component
#ifdef DIAGNOSTIC_PORTS
setenv ("DOTNET_DiagnosticPorts", DIAGNOSTIC_PORTS, true);
#endif
diff --git a/src/tasks/AppleAppBuilder/Templates/runtime.m b/src/tasks/AppleAppBuilder/Templates/runtime.m
index 7404793c5afe98..4cef34a8d67ee0 100644
--- a/src/tasks/AppleAppBuilder/Templates/runtime.m
+++ b/src/tasks/AppleAppBuilder/Templates/runtime.m
@@ -272,7 +272,7 @@ static bool is_pinvoke_override_library (const char* libraryName)
// build using DiagnosticPorts property in AppleAppBuilder
// or set DOTNET_DiagnosticPorts env via mlaunch, xharness when undefined.
- // NOTE, using DOTNET_DiagnosticPorts requires app build using AppleAppBuilder and RuntimeComponents=diagnostics_tracing
+ // NOTE, using DOTNET_DiagnosticPorts requires app build using AppleAppBuilder and RuntimeComponents to include 'diagnostics_tracing' component
#ifdef DIAGNOSTIC_PORTS
setenv ("DOTNET_DiagnosticPorts", DIAGNOSTIC_PORTS, true);
#endif
diff --git a/src/tasks/AppleAppBuilder/Xcode.cs b/src/tasks/AppleAppBuilder/Xcode.cs
index 0e05d9168423e0..867bb2cec15c4e 100644
--- a/src/tasks/AppleAppBuilder/Xcode.cs
+++ b/src/tasks/AppleAppBuilder/Xcode.cs
@@ -188,7 +188,7 @@ public string GenerateXCode(
bool enableRuntimeLogging,
bool enableAppSandbox,
string? diagnosticPorts,
- string? runtimeComponents = null,
+ IEnumerable runtimeComponents,
string? nativeMainSource = null,
bool useNativeAOTRuntime = false,
bool isLibraryMode = false)
@@ -252,7 +252,7 @@ public string GenerateCMake(
bool enableRuntimeLogging,
bool enableAppSandbox,
string? diagnosticPorts,
- string? runtimeComponents = null,
+ IEnumerable runtimeComponents,
string? nativeMainSource = null,
bool useNativeAOTRuntime = false,
bool isLibraryMode = false)
@@ -337,34 +337,19 @@ public string GenerateCMake(
{
string[] allComponentLibs = Directory.GetFiles(workspace, "libmono-component-*-static.a");
string[] staticComponentStubLibs = Directory.GetFiles(workspace, "libmono-component-*-stub-static.a");
- bool staticLinkAllComponents = false;
- string[] staticLinkedComponents = Array.Empty();
-
- if (!string.IsNullOrEmpty(runtimeComponents) && runtimeComponents.Equals("*", StringComparison.OrdinalIgnoreCase))
- staticLinkAllComponents = true;
- else if (!string.IsNullOrEmpty(runtimeComponents))
- staticLinkedComponents = runtimeComponents.Split(";");
// by default, component stubs will be linked and depending on how mono runtime has been build,
// stubs can disable or dynamic load components.
foreach (string staticComponentStubLib in staticComponentStubLibs)
{
string componentLibToLink = staticComponentStubLib;
- if (staticLinkAllComponents)
- {
- // static link component.
- componentLibToLink = componentLibToLink.Replace("-stub-static.a", "-static.a", StringComparison.OrdinalIgnoreCase);
- }
- else
+ foreach (string runtimeComponent in runtimeComponents)
{
- foreach (string staticLinkedComponent in staticLinkedComponents)
+ if (componentLibToLink.Contains(runtimeComponent, StringComparison.OrdinalIgnoreCase))
{
- if (componentLibToLink.Contains(staticLinkedComponent, StringComparison.OrdinalIgnoreCase))
- {
- // static link component.
- componentLibToLink = componentLibToLink.Replace("-stub-static.a", "-static.a", StringComparison.OrdinalIgnoreCase);
- break;
- }
+ // static link component.
+ componentLibToLink = componentLibToLink.Replace("-stub-static.a", "-static.a", StringComparison.OrdinalIgnoreCase);
+ break;
}
}
diff --git a/src/tests/FunctionalTests/Android/Device_Emulator/AOT_PROFILED/Android.Device_Emulator.Aot_Profiled.Test.csproj b/src/tests/FunctionalTests/Android/Device_Emulator/AOT_PROFILED/Android.Device_Emulator.Aot_Profiled.Test.csproj
index aaaf9e924f4262..e1c153ea053acd 100644
--- a/src/tests/FunctionalTests/Android/Device_Emulator/AOT_PROFILED/Android.Device_Emulator.Aot_Profiled.Test.csproj
+++ b/src/tests/FunctionalTests/Android/Device_Emulator/AOT_PROFILED/Android.Device_Emulator.Aot_Profiled.Test.csproj
@@ -13,10 +13,13 @@
-
+
+
+
+
diff --git a/src/tests/build.proj b/src/tests/build.proj
index d503eecc678ceb..193e25c8bd45ec 100644
--- a/src/tests/build.proj
+++ b/src/tests/build.proj
@@ -195,7 +195,6 @@
$(BuildDir)\apk
$(XUnitTestBinBase)$(CategoryWithSlash)\$(Category).apk
False
- diagnostics_tracing;marshal-ilgen
127.0.0.1:9000,nosuspend,listen
True
$(ArtifactsBinDir)microsoft.netcore.app.runtime.android-$(TargetArchitecture)\$(Configuration)\runtimes\android-$(TargetArchitecture)\
@@ -207,6 +206,11 @@
true
+
+
+
+
+
@@ -247,7 +251,7 @@
MonoRuntimeHeaders="$(MicrosoftNetCoreAppRuntimePackDir)/native/include/mono-2.0"
OutputDir="$(AppDir)"
ProjectName="$(Category)"
- RuntimeComponents="$(RuntimeComponents)"
+ RuntimeComponents="@(RuntimeComponents)"
RuntimeIdentifier="$(RuntimeIdentifier)"
StripDebugSymbols="$(StripDebugSymbols)">