Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions Documentation/docs-mobile/building-apps/build-items.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ The following MSBuild metadata are required:
- `%(JavaArtifact)`: The group and artifact id of the Java library matching the specifed POM
file in the form `{GroupId}:{ArtifactId}`.
- `%(JavaVersion)`: The version of the Java library matching the specified POM file.

See the [Java Dependency Resolution documentation](../features/maven/java-dependency-verification.md)
for more details.

Expand Down Expand Up @@ -279,9 +279,9 @@ installing app bundles.

## AndroidMavenLibrary

`<AndroidMavenLibrary>` allows a Maven artifact to be specified which will
automatically be downloaded and added to a .NET for Android binding project.
This can be useful to simplify maintenance of .NET for Android bindings for artifacts
`<AndroidMavenLibrary>` allows a Maven artifact to be specified which will
automatically be downloaded and added to a .NET for Android binding project.
This can be useful to simplify maintenance of .NET for Android bindings for artifacts
hosted in Maven.

```xml
Expand Down Expand Up @@ -336,6 +336,20 @@ used to specify the ABI that the library targets. Thus, if you add
</ItemGroup>
```

## AndroidNativeLibraryNoJniPreload

Every native library included in this item group will be exempt from the
JNI library preload mechanism. By default, all such libraries will be loaded
by the runtime early during application startup in order to assure their
proper initialization. However, in some cases it might not be the desired
behavior and this item group allows exclusion of libraries from this process
on individual basis.

Some framework libraries which must be loaded at application startup will not
be affected if included in this item group.

See also [`$(AndroidIgnoreAllJniPreload)`](build-properties.md#androidignorealljnipreload)

## AndroidPackagingOptionsExclude

A set of file glob compatible items which will allow for items to be
Expand Down
14 changes: 14 additions & 0 deletions Documentation/docs-mobile/building-apps/build-properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,20 @@ The most common values for this property are:
> [`@(AndroidEnvironment)`](build-items.md#androidenvironment)
> will take precedence.

## AndroidIgnoreAllJniPreload

A boolean value which, if set to `true`, exempts all the native JNI libraries
from being preloaded at application startup. By default, all such libraries
will be loaded by the runtime early during application startup in order to
assure their proper initialization. However, in some cases it might not be the
desired behavior and this property allows to effectively disable this behavior.

Some framework libraries which must be loaded at application startup will not
be affected by this property.

See also [`@(AndroidNativeLibraryNoJniPreload)`](build-items.md#androidnativelibrarynojnipreload)
for a more fine-grained way to exempt libraries from the preload mechanism.

## AndroidIncludeWrapSh

A boolean value that indicates whether the Android wrapper script
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ static class KnownProperties
public const string PkgXamarin_LibZipSharp = "PkgXamarin_LibZipSharp";
public const string ProductVersion = "ProductVersion";
public const string RuntimeRedistDirName = "_RuntimeRedistDirName";
public const string TestOutputDirectory = "TestOutputDirectory";
public const string XABuildToolsFolder = "XABuildToolsFolder";
public const string XABuildToolsVersion = "XABuildToolsVersion";
public const string XABuildToolsPackagePrefixMacOS = "XABuildToolsPackagePrefixMacOS";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ namespace Xamarin.Android.Prepare
properties.Add (KnownProperties.PkgXamarin_LibZipSharp, StripQuotes (@"@PkgXamarin_LibZipSharp@"));
properties.Add (KnownProperties.ProductVersion, StripQuotes ("@ProductVersion@"));
properties.Add (KnownProperties.RuntimeRedistDirName, StripQuotes ("@_RuntimeRedistDirName@"));
properties.Add (KnownProperties.TestOutputDirectory, StripQuotes (@"@TestOutputDirectory@"));
properties.Add (KnownProperties.XABuildToolsFolder, StripQuotes (@"@XABuildToolsFolder@"));
properties.Add (KnownProperties.XABuildToolsVersion, StripQuotes ("@XABuildToolsVersion@"));
properties.Add (KnownProperties.XABuildToolsPackagePrefixMacOS, StripQuotes ("@XABuildToolsPackagePrefixMacOS@"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ GeneratedFile GetCmakePresetsCommon (Context context, string sourcesDir)
{ "@NDK_ARM64_V8A_NONMONO_API_NET@", BuildAndroidPlatforms.NdkMinimumNonMonoAPI },
{ "@NDK_X86_64_NONMONO_API_NET@", BuildAndroidPlatforms.NdkMinimumNonMonoAPI },
{ "@XA_BUILD_CONFIGURATION@", context.Configuration },
{ "@XA_TEST_OUTPUT_DIR@", Utilities.EscapePathSeparators (props.GetRequiredValue (KnownProperties.TestOutputDirectory)) },
};

return new GeneratedPlaceholdersFile (
Expand Down
1 change: 1 addition & 0 deletions build-tools/xaprepare/xaprepare/xaprepare.targets
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
<Replacement Include="@PkgXamarin_LibZipSharp@=$(PkgXamarin_LibZipSharp)" />
<Replacement Include="@ProductVersion@=$(ProductVersion)" />
<Replacement Include="@_RuntimeRedistDirName@=$(_RuntimeRedistDirName)" />
<Replacement Include="@TestOutputDirectory@=$(TestOutputDirectory)" />
<Replacement Include="@XABuildToolsFolder@=$(XABuildToolsFolder)" />
<Replacement Include="@XABuildToolsVersion@=$(XABuildToolsVersion)" />
<Replacement Include="@XABuildToolsPackagePrefixMacOS@=$(XABuildToolsPackagePrefixMacOS)" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ public class GenerateNativeApplicationConfigSources : AndroidTask
public ITaskItem[] ResolvedAssemblies { get; set; } = [];

public ITaskItem[]? NativeLibraries { get; set; }
public ITaskItem[]? NativeLibrariesNoJniPreload { get; set; }
public ITaskItem[]? NativeLibrariesAlwaysJniPreload { get; set; }

public ITaskItem[]? MonoComponents { get; set; }

Expand Down Expand Up @@ -253,6 +255,8 @@ public override bool RunTask ()
NumberOfAssembliesInApk = assemblyCount,
BundledAssemblyNameWidth = assemblyNameWidth,
NativeLibraries = uniqueNativeLibraries,
NativeLibrariesNoJniPreload = NativeLibrariesNoJniPreload,
NativeLibrarysAlwaysJniPreload = NativeLibrariesAlwaysJniPreload,
AndroidRuntimeJNIEnvToken = android_runtime_jnienv_class_token,
JNIEnvInitializeToken = jnienv_initialize_method_token,
JNIEnvRegisterJniNativesToken = jnienv_registerjninatives_method_token,
Expand All @@ -279,6 +283,8 @@ public override bool RunTask ()
BundledAssemblyNameWidth = assemblyNameWidth,
MonoComponents = (MonoComponent)monoComponents,
NativeLibraries = uniqueNativeLibraries,
NativeLibrariesNoJniPreload = NativeLibrariesNoJniPreload,
NativeLibrarysAlwaysJniPreload = NativeLibrariesAlwaysJniPreload,
HaveAssemblyStore = UseAssemblyStore,
AndroidRuntimeJNIEnvToken = android_runtime_jnienv_class_token,
JNIEnvInitializeToken = jnienv_initialize_method_token,
Expand Down
Loading