Skip to content

Commit 4266c2b

Browse files
authored
[docs] Sync docs with dotnet/docs-mobile@9ccd7291 (#9474)
The `docs-mobile` content has been synced with dotnet/docs-mobile@9ccd729. A `build-tools/scripts/sync-mobile-docs.ps1` script has been added to improve this workflow in the future. The default sync direction is from dotnet/android to dotnet/docs-mobile as content is typically authored in this repo first. To sync, run the following: pwsh build-tools/scripts/sync-mobile-docs.ps1 -DocsMobilePath ~/source/docs-mobile To sync content back from docs-mobile to android, run the following: pwsh build-tools/scripts/sync-mobile-docs.ps1 -DocsMobilePath ~/source/docs-mobile -SyncToAndroid
1 parent 90821d1 commit 4266c2b

File tree

9 files changed

+54
-34
lines changed

9 files changed

+54
-34
lines changed

Documentation/docs-mobile/TOC.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
href: binding-libs/advanced-concepts/resolving-java-dependencies.md
6161
- name: Distribute bindings libraries
6262
href: binding-libs/advanced-concepts/distributing.md
63-
- name: Native Library Interop
63+
- name: Native library interop
6464
href: binding-libs/advanced-concepts/native-library-interop.md
6565
- name: Troubleshoot bindings
6666
href: binding-libs/customizing-bindings/troubleshooting-bindings.md
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
---
2-
title: AndroidMavenLibrary Build Action .NET for Android
3-
description: AndroidMavenLibrary Build Action .NET for Android
2+
title: Native Library Interop
3+
description: Learn how to perform native library interop to access native SDKs in .NET for Android and .NET MAUI projects,
44
ms.date: 10/21/2024
55
---
6-
# NativeLibraryInterop
6+
# Native library interop
77

8-
## Overview
9-
Native Library Interop (formerly referred to as the "Slim Binding" approach), refers to a
8+
Native library interop (formerly referred to as the "Slim Binding" approach), refers to a
109
pattern for accessing native SDKs in .NET for Android and .NET MAUI projects.
1110

1211
Starting in .NET 9, the .NET for Android SDK supports building Gradle projects
@@ -23,10 +22,11 @@ When an `@(AndroidGradleProject)` item is added to a .NET for Android project, t
2322
will attempt to create an AAR or APK file from the specified Gradle project. Any AAR output files
2423
will be added to the .NET project as an `@(AndroidLibrary)` to be bound.
2524

26-
Please see the [build-items](../../building-apps/build-items.md) docs for more information about
27-
the `@(AndroidGradleProject)` build action.
28-
29-
Additional documentation and references can be found below:
25+
## See also
3026

31-
* https://learn.microsoft.com/en-us/dotnet/communitytoolkit/maui/native-library-interop
32-
* https://github.com/CommunityToolkit/Maui.NativeLibraryInterop
27+
* The [.NET MAUI Community Toolkit - Native Library Interop](/dotnet/communitytoolkit/maui/native-library-interop)
28+
guide for more detailed docs.
29+
* The [build-items](../../building-apps/build-items.md) docs for more information about
30+
the `@(AndroidGradleProject)` build action.
31+
* The [Maui.NativeLibraryInterop](https://github.com/CommunityToolkit/Maui.NativeLibraryInterop)
32+
git repository for code samples.

Documentation/docs-mobile/building-apps/build-items.md

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: .NET for Android Build Items
44
ms.date: 09/09/2024
55
---
66

7-
# Build Items
7+
# Build items
88

99
Build items control how a .NET for Android application
1010
or library project is built.
@@ -18,9 +18,8 @@ an [MSBuild ItemGroup](/visualstudio/msbuild/itemgroup-element-msbuild).
1818
## AndroidAdditionalJavaManifest
1919

2020
`<AndroidAdditionalJavaManifest>` is used in conjunction with
21-
[Java Dependency Resolution](../features/maven/java-dependency-verification.md).
22-
23-
It is used to specify additional POM files that will be needed to verify dependencies.
21+
[Java Dependency Resolution](../features/maven/java-dependency-verification.md)
22+
to specify additional POM files that will be needed to verify dependencies.
2423
These are often parent or imported POM files referenced by a Java library's POM file.
2524

2625
```xml
@@ -237,7 +236,7 @@ This simplification means you can use **AndroidLibrary** everywhere.
237236
## AndroidLintConfig
238237

239238
The Build action 'AndroidLintConfig' should be used in conjunction with the
240-
[`$(AndroidLintEnabled)`](/xamarin/android/deploy-test/building-apps/build-properties.md#androidlintenabled)
239+
[`$(AndroidLintEnabled)`](/xamarin/android/deploy-test/building-apps/build-properties#androidlintenabled)
241240
property. Files with this build action will be merged together and passed to the
242241
android `lint` tooling. They should be XML files containing information on
243242
tests to enable and disable.
@@ -325,7 +324,7 @@ used to specify the ABI that the library targets. Thus, if you add
325324
`lib/armeabi-v7a/libfoo.so` to the build, then the ABI will be "sniffed" as
326325
`armeabi-v7a`.
327326

328-
### Item Attribute Name
327+
### Item attribute name
329328

330329
**Abi** &ndash; Specifies the ABI of the native library.
331330

@@ -354,7 +353,7 @@ However these Items MUST be URL encoded or use
354353
[`$([MSBuild]::Escape(''))`](/visualstudio/msbuild/how-to-escape-special-characters-in-msbuild).
355354
This is so MSBuild does not try to interpret them as actual file wildcards.
356355

357-
For example
356+
For example
358357

359358
```xml
360359
<ItemGroup>
@@ -366,7 +365,7 @@ For example
366365
NOTE: `*`, `?` and `.` will be replaced in the `BuildApk` task with the
367366
appropriate file globs.
368367

369-
If the default file glob is too restrictive you can remove it by adding the
368+
If the default file glob is too restrictive you can remove it by adding the
370369
following to your csproj
371370

372371
```xml
@@ -391,7 +390,7 @@ included from the final package. The default values are as follows
391390
Items can use file blob characters for wildcards such as `*` and `?`.
392391
However these Items MUST use URL encoding or '$([MSBuild]::Escape(''))'.
393392
This is so MSBuild does not try to interpret them as actual file wildcards.
394-
For example
393+
For example
395394

396395
```xml
397396
<ItemGroup>
@@ -566,5 +565,5 @@ this build action, see
566565
[ProGuard](/xamarin/android/deploy-test/release-prep/proguard).
567566

568567
These files are ignored unless the
569-
[`$(EnableProguard)`](/xamarin/android/deploy-test/building-apps/build-properties.md#enableproguard)
568+
[`$(EnableProguard)`](/xamarin/android/deploy-test/building-apps/build-properties#enableproguard)
570569
MSBuild property is `True`.

Documentation/docs-mobile/building-apps/build-process.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: .NET for Android Build Process
44
ms.date: 04/11/2024
55
---
66

7-
# Build Process
7+
# Build process
88

99
The .NET for Android build process is responsible for gluing everything
1010
together:
@@ -17,7 +17,7 @@ generating
1717
[Android-callable wrappers](/xamarin/android/platform/java-integration/android-callable-wrappers),
1818
and generating a `.apk` for execution on Android devices.
1919

20-
## Application Packages
20+
## Application packages
2121

2222
In broad terms, there are two types of Android application packages
2323
(`.apk` files) which the .NET for Android build system can generate:
@@ -33,7 +33,7 @@ produces the package.
3333

3434
<a name="Fast_Deployment"></a>
3535

36-
## Fast Deployment
36+
## Fast deployment
3737

3838
*Fast deployment* works by further shrinking Android application
3939
package size. This is done by excluding the app's assemblies from the
@@ -59,7 +59,7 @@ This will deploy both assemblies, native libraries, typemaps and dexes to the `f
5959
directory. But you should only really need to enable this if you are changing
6060
native libraries, bindings or Java code.
6161

62-
## MSBuild Projects
62+
## MSBuild projects
6363

6464
The .NET for Android build process is based on MSBuild, which is also
6565
the project file format used by Visual Studio for Mac and Visual Studio.
@@ -75,7 +75,7 @@ MSBuild items, properties and targets.
7575

7676
<a name="Build_Targets"></a>
7777

78-
## Binding Projects
78+
## Binding projects
7979

8080
The following MSBuild properties are used with
8181
[Binding projects](/xamarin/android/platform/binding-java-library):
@@ -97,7 +97,7 @@ The Following MSBuild properties are used to control generation of the
9797
- [`$(AndroidUseAapt2)`](build-properties.md#androiduseaapt2)
9898
- [`$(MonoAndroidResourcePrefix)`](build-properties.md#monoandroidresourceprefix)
9999

100-
## Signing Properties
100+
## Signing properties
101101

102102
Signing properties control how the Application package is signed so
103103
that it may be installed onto an Android device. To allow
@@ -154,7 +154,7 @@ To use the keystore generated above, use the property group:
154154
</PropertyGroup>
155155
```
156156
157-
## Build Extension Points
157+
## Build extension points
158158
159159
The .NET for Android build system exposes a few public extension points
160160
for users wanting to hook into our build process. To use one of these
@@ -173,6 +173,7 @@ appropriate MSBuild property in a `PropertyGroup`. For example:
173173
Extension points include:
174174
175175
- [`$(AfterGenerateAndroidManifest)](build-properties.md#aftergenerateandroidmanifest)
176+
- [`$(AndroidPrepareForBuildDependsOn)](build-properties.md#androidprepareforbuilddependson)
176177
- [`$(BeforeGenerateAndroidManifest)](build-properties.md#beforegenerateandroidmanifest)
177178
- [`$(BeforeBuildAndroidAssetPacks)`](build-properties.md#beforebuildandroidassetpacks)
178179
@@ -182,7 +183,7 @@ performance, especially if they run on every build. It is
182183
highly recommended that you read the MSBuild [documentation](/visualstudio/msbuild/msbuild)
183184
before implementing such extensions.
184185
185-
## Target Definitions
186+
## Target definitions
186187
187188
The .NET for Android-specific parts of the build process are defined in
188189
`$(MSBuildExtensionsPath)\Xamarin\Android\Xamarin.Android.CSharp.targets`,

Documentation/docs-mobile/building-apps/build-properties.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: .NET for Android Build Properties
44
ms.date: 09/09/2024
55
---
66

7-
# Build Properties
7+
# Build properties
88

99
MSBuild properties control the behavior of the
1010
[targets](build-targets.md).

Documentation/docs-mobile/building-apps/build-targets.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: "This document will list all supported targets in the .NET for Andr
44
ms.date: 04/11/2024
55
---
66

7-
# Build Targets
7+
# Build targets
88

99
The following build targets are defined in .NET for Android projects.
1010

Documentation/docs-mobile/messages/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
--
1+
---
22
title: .NET for Android errors and warnings reference
33
description: Build and deployment error and warning codes in .NET for Android, their meanings, and guidance on how to address them.
44
ms.date: 04/11/2024

Documentation/docs-mobile/messages/xa0141.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: .NET for Android warning XA0141
33
description: XA0141 warning code
4-
ms.date: 22/07/2024
4+
ms.date: 07/22/2024
55
---
66
# .NET for Android warning XA0141
77

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
param (
2+
[string]$DocsMobilePath,
3+
[switch]$SyncToAndroid
4+
)
5+
6+
$androidDocsPath = Join-Path -Path $PSScriptRoot -ChildPath "../../Documentation/docs-mobile"
7+
$docsMobilePath = Join-Path -Path $DocsMobilePath -ChildPath "docs/android"
8+
$sourcePath = $androidDocsPath
9+
$destinationPath = $docsMobilePath
10+
if ($SyncToAndroid) {
11+
$sourcePath = $docsMobilePath
12+
$destinationPath = $androidDocsPath
13+
}
14+
Write-Host "Syncing content from '$sourcePath' to Folder '$destinationPath'..."
15+
try {
16+
Copy-Item -Path $sourcePath\* -Destination $destinationPath -Recurse -Force
17+
Write-Output "Files copied from '$sourcePath' to '$destinationPath' successfully."
18+
} catch {
19+
Write-Error "Error copying files: $_"
20+
}

0 commit comments

Comments
 (0)