Skip to content

Commit

Permalink
Merge branch 'main' into no-ndk-lib-stubs
Browse files Browse the repository at this point in the history
* main: (112 commits)
  [ci] Remove classic Mono.Android-Tests runs (dotnet#7778)
  $(AndroidPackVersionSuffix)=preview.2; net8 is 34.0.0-preview.2 (dotnet#7761)
  Localized file check-in by OneLocBuild Task (dotnet#7758)
  Bump to dotnet/installer@dec1209 8.0.100-alpha.1.23080.11 (dotnet#7755)
  LEGO: Merge pull request 7756
  Localized file check-in by OneLocBuild (dotnet#7752)
  [Xamarin.Android.Build.Tasks] Fix issue where app will not install (dotnet#7719)
  Bump to dotnet/installer@779a644 8.0.100-alpha.1.23070.23 (dotnet#7728)
  LEGO: Merge pull request 7751
  [Mono.Android] Wrap connection exceptions in HttpRequestException (dotnet#7661)
  [Mono.Android] Fix View.SystemUiVisibility enumification (dotnet#7730)
  Bump r8 from 3.3.75 to 4.0.48 (dotnet#7700)
  [monodroid] Prevent overlapped decompression of embedded assemblies (dotnet#7732)
  [xaprepare] Support arm64 emulator components (dotnet#7743)
  Bump SQLite to 3.40.1 (dotnet#7733)
  Bump to xamarin/xamarin-android-binutils/L_15.0.7-5.0.3@6721af4b (dotnet#7742)
  [monodroid] Replace `exit()` with `abort()` in native code (dotnet#7734)
  Bump to xamarin/Java.Interop/main@8a1ae57 (dotnet#7738)
  [build] bump `$(AndroidNet7Version)` (dotnet#7737)
  Bump to xamarin/Java.Interop/main@1366d99 (dotnet#7718)
  ...
  • Loading branch information
grendello committed Feb 9, 2023
2 parents e8b9e61 + a9313d5 commit 8d4672d
Show file tree
Hide file tree
Showing 264 changed files with 7,238 additions and 1,876 deletions.
4 changes: 2 additions & 2 deletions .external
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
xamarin/monodroid:main@8f925e3346c8aea63f3481a26c811374915b8d18
mono/mono:2020-02@a96bde9730e4c2244536ce5f4250e5e4f4e6780a
xamarin/monodroid:main@50faac94c6a0c27864564829ac83f3988c82f8ef
mono/mono:2020-02@6dd9def57ce969ca04a0ecd9ef72c0a8f069112d
20 changes: 19 additions & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
/build-tools/api-merge @jonpryor
/build-tools/api-xml-adjuster @jonpryor
/build-tools/automation @pjcollins @jonpryor
/build-tools/cmake @grendello
/build-tools/wrap-sh @grendello
/build-tools/debian-metadata @directhex
/build-tools/enumification-helpers @jonpryor
/build-tools/manifest-attribute-codegen @jonpryor
Expand All @@ -30,9 +32,22 @@
/src/r8 @jonathanpeppers @jonpryor
/src/Xamarin.Android.Build.Tasks @dellis1972 @jonathanpeppers
/src/Xamarin.Android.Build.Tasks/Linker @jonpryor
/src/Xamarin.Android.Build.Tasks/Utilities/LlvmIrGenerator @grendello
/src/Xamarin.Android.Build.Tasks/Utilities/TypeMap* @grendello
/src/Xamarin.Android.Build.Tasks/Utilities/MarshalMethods* @grendello
/src/Xamarin.Android.Build.Tasks/Utilities/ApplicationConfig* @grendello
/src/Xamarin.Android.Build.Tasks/Utilities/*AssemblyStore* @grendello
/src/Xamarin.Android.Build.Tasks/Utilities/AssemblyCompression* @grendello
/src/Xamarin.Android.Build.Tasks/Utilities/CompressedAssembl* @grendello
/src/Xamarin.Android.Build.Tasks/Utilities/ELFHelper* @grendello
/src/Xamarin.Android.Build.Tasks/Utilities/EnvironmentFilesParser* @grendello
/src/Xamarin.Android.Build.Tasks/Utilities/JniRemappingAssemblyGenerator* @grendello
/src/Xamarin.Android.Build.Tasks/Utilities/NativeTypeMappingData* @grendello
/src/Xamarin.Android.Build.Tasks/Utilities/NdkTools @grendello
/src/Xamarin.Android.NamingCustomAttributes @jonpryor
/src/Xamarin.Android.Tools.Aidl @jonpryor
/src/monodroid/ @jonpryor @grendello
/src/sqlite-xamarin @grendello
/tests/TestRunner.* @grendello
/tests/BCL-Tests @grendello
/tests/CodeBehind @grendello
Expand All @@ -44,6 +59,9 @@
/src/Mono.Android/java/mono/android/ @mcumming @jonpryor
/src/Xamarin.Android.Build.Tasks/MSBuild/Xamarin/Android/Xamarin.Android.Designer.targets @mcumming @jonpryor

/tools/assembly-store-reader @grendello
/tools/decompress-assemblies @grendello
/tools/jit-times @jonpryor
/tools/xabuild @jonathanpeppers @jonpryor
/tools/setup-windows @jonathanpeppers @jonpryor
/tools/tmt @grendello
/tools/xabuild @jonathanpeppers @jonpryor
35 changes: 35 additions & 0 deletions .github/workflows/sdk-insertion-bump.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Notify release branch change

on:
# trigger for main and release branches.
push:
branches:
- main
- 'release/**'

jobs:
pingRemote:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Parse commit
shell: pwsh
id: commit_title
run: |
Write-Host "Commit message is $Env:COMMIT_MESSAGE"
$title = ($Env:COMMIT_MESSAGE -split '\n')[0]
"COMMIT_TITLE=$title" >> $env:GITHUB_OUTPUT
env:
COMMIT_MESSAGE: "${{ github.event.head_commit.message }}"

- name: 'Update remote repository'
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.SERVICEACCOUNT_PAT }}
event-type: 'sdk_insertion'
repository: 'xamarin/sdk-insertions'
client-payload: '{"repository": "xamarin/xamarin-android", "branch": "${{ github.ref_name }}", "commit": "${{ github.sha }}", "commit_message": "${{ steps.commit_title.outputs.COMMIT_TITLE }}"}'


13 changes: 7 additions & 6 deletions Configuration.props
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,14 @@
<DebugType Condition=" '$(DebugType)' == '' ">portable</DebugType>
<Deterministic Condition=" '$(Deterministic)' == '' ">True</Deterministic>
<LangVersion Condition=" '$(LangVersion)' == '' ">latest</LangVersion>
<AndroidNet7Version Condition=" '$(AndroidNet7Version)' == '' ">33.0.1</AndroidNet7Version>
<AndroidNet6Version Condition=" '$(AndroidNet6Version)' == '' ">32.0.476</AndroidNet6Version>
<AndroidNet7Version Condition=" '$(AndroidNet7Version)' == '' ">33.0.26</AndroidNet7Version>
<AndroidNet6Version Condition=" '$(AndroidNet6Version)' == '' ">32.0.485</AndroidNet6Version>
</PropertyGroup>
<PropertyGroup Condition=" '$(HostOS)' == '' ">
<HostOS Condition="$([MSBuild]::IsOSPlatform('windows'))">Windows</HostOS>
<HostOS Condition="$([MSBuild]::IsOSPlatform('linux'))">Linux</HostOS>
<HostOS Condition="$([MSBuild]::IsOSPlatform('osx'))">Darwin</HostOS>
<HostOSArchitecture>$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture.ToString())</HostOSArchitecture>
</PropertyGroup>
<PropertyGroup>
<MicrosoftAndroidSdkPackName Condition="$([MSBuild]::IsOSPlatform('windows'))">Microsoft.Android.Sdk.Windows</MicrosoftAndroidSdkPackName>
Expand Down Expand Up @@ -194,9 +195,9 @@
<CommandLineToolsFolder Condition=" '$(CommandLineToolsFolder)' == '' ">7.0</CommandLineToolsFolder>
<CommandLineToolsVersion Condition=" '$(CommandLineToolsVersion)' == '' ">8512546_latest</CommandLineToolsVersion>
<CommandLineToolsBinPath Condition=" '$(CommandLineToolsBinPath)' == '' ">$(AndroidSdkFullPath)\cmdline-tools\$(CommandLineToolsFolder)\bin</CommandLineToolsBinPath>
<!-- Version numbers and PkgVersion are found in https://dl-ssl.google.com/android/repository/repository2-1.xml -->
<EmulatorVersion Condition=" '$(EmulatorVersion)' == '' ">8129060</EmulatorVersion>
<EmulatorPkgRevision Condition=" '$(EmulatorPkgRevision)' == '' ">31.3.1</EmulatorPkgRevision>
<!-- Version numbers and PkgVersion are found in https://dl-ssl.google.com/android/repository/repository2-3.xml -->
<EmulatorVersion Condition=" '$(EmulatorVersion)' == '' ">9364964</EmulatorVersion>
<EmulatorPkgRevision Condition=" '$(EmulatorPkgRevision)' == '' ">32.1.9</EmulatorPkgRevision>
<EmulatorToolPath Condition=" '$(EmulatorToolPath)' == '' ">$(AndroidSdkFullPath)\emulator</EmulatorToolPath>
<EmulatorToolExe Condition=" '$(EmulatorToolExe)' == '' ">emulator</EmulatorToolExe>
<NdkBuildPath Condition=" '$(NdkBuildPath)' == '' And '$(HostOS)' != 'Windows' ">$(AndroidNdkDirectory)\ndk-build</NdkBuildPath>
Expand Down Expand Up @@ -244,7 +245,7 @@
<!-- Unit Test Properties -->
<PropertyGroup>
<!-- When changing the version below, please also update the 'build-tools/scripts/nunit3-console*' scripts -->
<NUnitConsoleVersion Condition=" '$(NUnitConsoleVersion)' == '' ">3.11.1</NUnitConsoleVersion>
<NUnitConsoleVersion Condition=" '$(NUnitConsoleVersion)' == '' ">3.12.0</NUnitConsoleVersion>
<_Runtime Condition=" '$(HostOS)' != 'Windows' ">$(ManagedRuntime) $(ManagedRuntimeArgs)</_Runtime>
<_NUnit>$(_Runtime) $(XAPackagesDir)\nunit.consolerunner\$(NUnitConsoleVersion)\tools\nunit3-console.exe</_NUnit>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@
</PropertyGroup>

<PropertyGroup>
<ProductVersion>13.1.99</ProductVersion>
<ProductVersion>13.2.99</ProductVersion>
<!-- NuGet package version numbers. See Documentation/guides/OneDotNet.md.
Rules:
* Major/Minor match Android stable API level, such as 30.0 for API 30.
* Bump first digit of the patch version for feature releases (and reset the first two digits to 0)
-->
<AndroidPackVersion>34.0.0</AndroidPackVersion>
<AndroidPackVersionSuffix>preview.1</AndroidPackVersionSuffix>
<AndroidPackVersionSuffix>preview.2</AndroidPackVersionSuffix>
</PropertyGroup>

<!-- Common <PackageReference/> versions -->
Expand Down
10 changes: 10 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project>

<!-- NuGet Package Versions -->
<ItemGroup>
<PackageReference Update="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageReference Update="System.CodeDom" Version="6.0.0" />
<PackageReference Update="Irony" Version="1.1.0" />
</ItemGroup>

</Project>
21 changes: 21 additions & 0 deletions Documentation/guides/OneDotNetBindingProjects.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,27 @@ Default Android related file globbing behavior is defined in [AutoImport.props][
This behavior can be disabled for Android items by setting `$(EnableDefaultAndroidItems)` to `false`, or
all default item inclusion behavior can be disabled by setting `$(EnableDefaultItems)` to `false`.

Undesired `.jar` or `.aar` files could be included with the default
wildcards. In one case a `AndroidStudio\gradle\wrapper\gradle-wrapper.jar`
file was unintentionally being bound, yielding C# compiler errors:

Org.Gradle.Cli.AbstractCommandLineConverter.cs(11,89): error CS0535: 'Download' does not implement interface member 'IDownload.Download(URI, File)'
Org.Gradle.Wrapper.Download.cs(10,60): error CS0535: 'AbstractCommandLineConverter' does not implement interface member 'ICommandLineConverter.Convert(ParsedCommandLine, Object)'

To solve this issue, you can either remove the specific file in your `.csproj`:

```xml
<ItemGroup>
<AndroidLibrary Remove="AndroidStudio\gradle\wrapper\gradle-wrapper.jar" />
</ItemGroup>
```

Or exclude *all* files within that folder:

```xml
<AndroidLibrary Remove="AndroidStudio\**\*" />
```

[default-items]: https://github.com/xamarin/xamarin-android/blob/main/src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/Sdk/AutoImport.props

## Migration Considerations
Expand Down
42 changes: 42 additions & 0 deletions Documentation/guides/building-apps/build-properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -1110,6 +1110,14 @@ or use `-p:AndroidCreateProguardMappingFile=False` on the command line.

This property was added in Xamarin.Android 11.2.

## AndroidD8IgnoreWarnings

Specifies `--map-diagnostics warning info` to be passed to `d8`. The
default value is `True`, but can be set to `False` to enforce more
strict behavior. See the [D8 and R8 source code][r8-source] for details.

Added in .NET 8.

## AndroidR8IgnoreWarnings

Specifies
Expand All @@ -1118,8 +1126,13 @@ to continue with dex compilation even if certain warnings are
encountered. The default value is `True`, but can be set to `False` to
enforce more strict behavior. See the [ProGuard manual](https://www.guardsquare.com/manual/configuration/usage) for details.

Starting in .NET 8, specifies `--map-diagnostics warning info`. See
the [D8 and R8 source code][r8-source] for details.

Added in Xamarin.Android 10.3.

[r8-source]: https://r8.googlesource.com/r8/+/refs/tags/3.3.75/src/main/java/com/android/tools/r8/BaseCompilerCommandParser.java#246

## AndroidR8JarPath

The path to `r8.jar` for use with the
Expand Down Expand Up @@ -1351,6 +1364,35 @@ To suppress the default AOT profiles, set the property to `false`.

Added in Xamarin.Android 10.1.

## AndroidUseDesignerAssembly

A bool property which controls if the build system will generate an
`_Microsoft.Android.Resource.Designer.dll` as apposed to a `Resource.Designer.cs` file. The benefits of this are smaller applications and
faster startup time.

The default value is `true` in .NET 8.

This setting is not backward compatible with Classic Xamarin.Android.
As a Nuget Author it is recommended that you ship three versions of
the assembly if you want to maintain backward compatibility.
One for MonoAndroid, one for net6.0-android and
one for net8.0-android. You can do this by using [Xamarin.Legacy.Sdk](https://www.nuget.org/packages/Xamarin.Legacy.Sdk). This is only required if your Nuget Library
project makes use of `AndroidResource` items in the project or via a dependency.

```
<TargetFrameworks>monoandroid90;net6.0-android;net8.0-android</TargetFrameworks>
```

Alternatively turn this setting off until such time as both Classic and
net7.0-android have been deprecated.

.NET 8 Projects which choose to turn this setting off will not be able to
consume references which do use it. If you try to use an assembly
which does have this feature enabled in a project that does not, you will
get a `XA1034` build error.

Added in .NET 8. Unsupported in Classic Xamarin.Android.

## AndroidUseInterpreter

A boolean property that causes the `.apk` to contain the mono
Expand Down
3 changes: 3 additions & 0 deletions Documentation/guides/messages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@ or 'Help->Report a Problem' in Visual Studio for Mac.
+ [XA1027](xa1027.md): The 'EnableProguard' MSBuild property is set to 'true' and the 'AndroidLinkTool' MSBuild property is empty, so 'AndroidLinkTool' will default to 'proguard'.
+ [XA1028](xa1028.md): The 'AndroidEnableProguard' MSBuild property is set to 'true' and the 'AndroidLinkTool' MSBuild property is empty, so 'AndroidLinkTool' will default to 'proguard'.
+ [XA1029](xa1029.md): The 'AotAssemblies' MSBuild property is deprecated. Edit the project file in a text editor to remove this property, and use the 'RunAOTCompilation' MSBuild property instead.
+ [XA1031](xa1031.md): The 'AndroidHttpClientHandlerType' has an invalid value.
+ [XA1032](xa1032.md):Failed to resolve '{0}' from '{1}'. Please check your `AndroidHttpClientHandlerType` setting.
+ [XA1033](xa1033.md): Could not resolve '{0}'. Please check your `AndroidHttpClientHandlerType` setting.

## XA2xxx: Linker

Expand Down
2 changes: 1 addition & 1 deletion Documentation/guides/messages/xa0134.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ the Xamarin.Android build system for Debug builds.

## Solution

Please check that you to not have the 'android:debuggable' attribute set on the 'application' element in your 'AndroidManifest.xml'.
Please check that you do not have the 'android:debuggable' attribute set on the 'application' element in your 'AndroidManifest.xml'.
If you have a class that derives from 'Android.App.Application' and are using the '[Application]' make sure the
'Debuggable' property is not set at all as it will override the value for debug builds.
If neither of these solutions work please raise an issue at [https://github.com/xamarin/xamarin-android/issues/new/choose](https://github.com/xamarin/xamarin-android/issues/new/choose).
20 changes: 20 additions & 0 deletions Documentation/guides/messages/xa1031.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: Xamarin.Android error XA1031
description: XA1031 error code
ms.date: 10/10/2022
---
# Xamarin.Android error XA1031

## Example messages

```
The 'AndroidHttpClientHandlerType' property value 'Foo.Bar.HttpHander, MyApp' must derive from 'System.Net.Http.HttpMessageHandler'.
Please change the value to an assembly-qualifed type name which inherits from '{1}' or remove the property completely.
```

## Solution

Edit your csproj directly and change the 'AndroidHttpClientHandlerType' to
a valid value.

Valid values can be found at `~/android/deploy-test/building-apps/build-properties.md#AndroidHttpClientHandlerType`.
19 changes: 19 additions & 0 deletions Documentation/guides/messages/xa1032.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: Xamarin.Android error XA1032
description: XA1032 error code
ms.date: 10/10/2022
---
# Xamarin.Android error XA1032

## Example messages

```
Failed to resolve '{0}' from '{1}'. Please check your `AndroidHttpClientHandlerType` setting.
```

## Solution

Edit your csproj directly and change the 'AndroidHttpClientHandlerType' to
a valid value.

Valid values can be found at `~/android/deploy-test/building-apps/build-properties.md#AndroidHttpClientHandlerType`.
19 changes: 19 additions & 0 deletions Documentation/guides/messages/xa1033.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: Xamarin.Android error XA1033
description: XA1033 error code
ms.date: 10/10/2022
---
# Xamarin.Android error XA1033

## Example messages

```
Could not resolve '{0}'. Please check your `AndroidHttpClientHandlerType` setting.
```

## Solution

Edit your csproj directly and change the 'AndroidHttpClientHandlerType' to
a valid value.

Valid values can be found at `~/android/deploy-test/building-apps/build-properties.md#AndroidHttpClientHandlerType`.
16 changes: 16 additions & 0 deletions Documentation/guides/messages/xa1034.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
title: Xamarin.Android error XA1034
description: XA1034 error code
ms.date: 13/12/2022
---
# Xamarin.Android error XA1034

## Example messages

```
Your project references 'Foo.dll' which uses the `_Microsoft.Android.Resource.Designer` assembly, but you do not have this feature enabled. Please set the `AndroidUseDesignerAssembly` MSBuild property to `true` in your project file.
```

## Solution

Edit your csproj directly and change the 'AndroidUseDesignerAssembly' to `True`.
38 changes: 38 additions & 0 deletions Documentation/guides/tracing.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,41 @@ Writing: hellomaui-app-trace.speedscope.json
And the output files should be found in the current directory. You can
use the `-o` switch if you would prefer to output them to a specific
directory.

## How to `dotnet trace` our build?

Setting this up is easy, the main issue is there end up being
potentially *a lot* of threads (30-40) depending on the build.

Before getting started, I would recommend doing these things to make
the trace smaller and easier to understand:

* Set `$DOTNET_CLI_TELEMETRY_OPTOUT` to `1`, to avoid any dotnet CLI
telemetry in the trace.
* Profile a single `.csproj` build, not a `.sln`. This keeps
the build in-process.
* Always `restore` in a separate step and use `--no-restore` when you
trace. This avoids NuGet logic in the trace.
* Save a `.binlog`, so you can review that the build actually did what
you expected. `dotnet trace` tends to hide all the console output.

So, for example, to profile a build:

```dotnetcli
dotnet restore foo.csproj
dotnet trace collect --format speedscope -- dotnet build -bl --no-restore foo.csproj
```

This should result in `.speedscope` and `.nettrace` files in the
current directory.

If you wanted to profile deploy & app launch, do a build first:

```dotnetcli
dotnet build foo.csproj
dotnet trace collect --format speedscope -- dotnet build "-t:Run" -bl --no-restore foo.csproj
```

I found that `"` is necessary when `:` characters are present in the
command. This appears to be some kind of argument parsing issue with
`dotnet trace`.
Loading

0 comments on commit 8d4672d

Please sign in to comment.