Skip to content

Commit

Permalink
Merge branch 'master' into tune-cancellation
Browse files Browse the repository at this point in the history
  • Loading branch information
jonpryor committed Apr 24, 2020
2 parents 31461fd + d471b4a commit 8d8197d
Show file tree
Hide file tree
Showing 225 changed files with 1,921 additions and 1,287 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ apk-sizes-*.txt
*.rawproto
*.binlog
src/Xamarin.Android.Build.Tasks/Xamarin.Android.Common.props
src/Xamarin.Android.Sdk/targets/Xamarin.Android.Sdk.BundledVersions.props
src/Xamarin.Android.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.BundledVersions.props
*~
external/monodroid/
external/mono/
Expand Down
44 changes: 44 additions & 0 deletions Documentation/guides/DotNet5.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ In .NET 5 the behavior of the following MSBuild tasks will change, but

`$(AndroidUseIntermediateDesignerFile)` will be `True` by default.

## Default file inclusion

Default Android related file globbing behavior is defined in `Microsoft.Android.Sdk.DefaultItems.props`.

## dotnet cli

There are currently two "verbs" we are aiming to get working in
Expand Down Expand Up @@ -65,3 +69,43 @@ Almost everything else happens during `donet publish`:
* Compile java code via `javac`
* Convert java code to `.dex` via d8/r8
* Create an `.apk` or `.aab` and sign it


### Preview testing

The following instructions can be used for early preview testing.

1) Install the [latest .NET 5 preview][0]. Preview 4 or later is required.

2) Create a `nuget.config` file that has a package source pointing to
local packages or `xamarin-impl` feed, as well as the .NET 5 feed:

```xml
<configuration>
<packageSources>
<add key="xamarin-impl" value="https://pkgs.dev.azure.com/azure-public/vside/_packaging/xamarin-impl/nuget/v3/index.json" />
<add key="dotnet5" value="https://dnceng.pkgs.visualstudio.com/public/_packaging/dotnet5/nuget/v3/index.json" />
</packageSources>
</configuration>
```

3) Open an existing Android project (ideally something minimal) and
tweak it as shown below. The version should match the version of the
packages you want to use:

```xml
<Project Sdk="Microsoft.Android.Sdk/10.4.99.24">
<PropertyGroup>
<TargetFramework>netcoreapp5.0</TargetFramework>
<RuntimeIdentifier>android.21-arm64</RuntimeIdentifier>
</PropertyGroup>
</Project>
```

4) Publish (and optionally install) the project:

```
dotnet publish -t:Install *.csproj
```

[0]: https://github.com/dotnet/installer#installers-and-binaries
2 changes: 2 additions & 0 deletions Documentation/guides/messages/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ ms.date: 01/24/2020
+ XA4228: Unable to find specified //activity-alias/@android:targetActivity: '{targetActivity}'
+ XA4229: Unrecognized \`TransformFile\` root element: {element}.
+ XA4230: Error parsing XML: {exception}
+ [XA4231](xa4231.md): The Android class parser value 'jar2xml' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'class-parse'.
+ [XA4232](xa4232.md): The Android code generation target 'XamarinAndroid' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'XAJavaInterop1'.
+ XA4300: Native library '{library}' will not be bundled because it has an unsupported ABI.
+ [XA4301](xa4301.md): Apk already contains the item `xxx`.
+ [XA4302](xa4302.md): Unhandled exception merging \`AndroidManifest.xml\`: {ex}
Expand Down
29 changes: 29 additions & 0 deletions Documentation/guides/messages/xa4231.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: Xamarin.Android warning XA4231
description: XA4231 warning code
ms.date: 04/23/2020
---
# Xamarin.Android warning XA4231

## Example messages

```
warning XA4231: The Android class parser value 'jar2xml' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'class-parse'.
```

## Issue

The Android class parser `jar2xml` has been deprecated.

## Solution

To resolve this warning, update the **Android Class Parser** setting in the Visual
Studio project property pages or the **.jar file parser** setting in Visual
Studio for Mac to **class-parse**. This corresponds to the `class-parse` value
for the `AndroidClassParser` MSBuild property in the _.csproj_ file:

```xml
<PropertyGroup>
<AndroidClassParser>class-parse</AndroidClassParser>
</PropertyGroup>
```
30 changes: 30 additions & 0 deletions Documentation/guides/messages/xa4232.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
title: Xamarin.Android warning XA4232
description: XA4232 warning code
ms.date: 04/23/2020
---
# Xamarin.Android warning XA4232

## Example messages

```
warning XA4232: The Android code generation target 'XamarinAndroid' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'XAJavaInterop1'.
```

## Issue

The Android code generation target `XamarinAndroid` has been deprecated.

## Solution

To resolve this warning, update the **Android Codegen target** setting in the
Visual Studio project property pages or the **Code generation target** setting
in Visual Studio for Mac to **XAJavaInterop1**. This corresponds to the
`XAJavaInterop1` value for the `AndroidCodegenTarget` MSBuild property in the
_.csproj_ file:

```xml
<PropertyGroup>
<AndroidCodegenTarget>XAJavaInterop1</AndroidCodegenTarget>
</PropertyGroup>
```
18 changes: 18 additions & 0 deletions Documentation/release-notes/4227.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#### Mono.Android.dll Nullable Reference Type Annotations

`Mono.Android.dll` assemblies of all platform levels are now annotated with
C#8's nullable reference types (NRT). Users who opt their applications into
this feature with `<Nullable>enable</Nullable>` will receive warnings if their
code does not properly account for possible `null` values.

General documentation for the NRT feature is available here:
https://docs.microsoft.com/en-us/dotnet/csharp/nullable-references.

Note:
The majority of `Mono.Android.dll` is automatically generated from the Android
Java source, including these new annotations. As such, we will not be manually
fixing places where the Android source code is not annotated correctly.

If there is an error regarding nullability for any of the Mono.Android APIs
that Xamarin adds to the Android source (such as `JavaList` or `InputStreamAdapter`),
please file a bug so we can properly annotate our additions.
42 changes: 42 additions & 0 deletions Documentation/release-notes/4577.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
### Bindings projects XA4231 warning for deprecated jar2xml parser

Any bindings project that has the `AndroidClassParser` MSBuild property set to
the old `jar2xml` parser or any other unrecognized value will now get a XA4231
build warning:

```
warning XA4231: The Android class parser 'jar2xml' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'class-parse' instead.
```

To resolve this warning, update the **Android Class Parser** setting in the Visual
Studio project property pages or the **.jar file parser** setting in Visual
Studio for Mac to **class-parse**. This corresponds to the `class-parse` value
for the `AndroidClassParser` MSBuild property in the _.csproj_ file:

```xml
<PropertyGroup>
<AndroidClassParser>class-parse</AndroidClassParser>
</PropertyGroup>
```

### Bindings projects XA4232 warning for deprecated XamarinAndroid code generation target

Any bindings project that has the `AndroidCodegenTarget` MSBuild property set to
the old `XamarinAndroid` code generation target or any other unrecognized value
will now get a XA4232 build warning:

```
warning XA4232: The Android code generation target value 'XamarinAndroid' is deprecated and will be removed in a future version of Xamarin.Android. Update the project properties to use 'XAJavaInterop1'.
```

To resolve this warning, update the **Android Codegen target** setting in the
Visual Studio project property pages or the **Code generation target** setting
in Visual Studio for Mac to **XAJavaInterop1**. This corresponds to the
`XAJavaInterop1` value for the `AndroidCodegenTarget` MSBuild property in the
_.csproj_ file:

```xml
<PropertyGroup>
<AndroidCodegenTarget>XAJavaInterop1</AndroidCodegenTarget>
</PropertyGroup>
```
17 changes: 17 additions & 0 deletions Documentation/release-notes/4583.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
### Tidier IntelliSense suggestions for Java.Lang.Object subclasses

`Java.Lang.Object` contains several properties and methods that are
required to be `public` to support bindings, but are not intended
to be called by users. Use `[EditorBrowser]` to hide them from
IntelliSense, making it easier to find useful members.

[IntelliSense cleanup)[images/4583.png]

### Issues fixed

#### IDE compatibility

* [GitHub 4582](https://github.com/xamarin/xamarin-android/issues/4582):
Some `Java.Lang.Object` properties and methods like `Handle` and
`PeerReference` appeared in IntelliSense suggestions even though they were
primarily intended for use only in generated code.
Binary file added Documentation/release-notes/images/4583.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
47 changes: 8 additions & 39 deletions build-tools/automation/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -186,22 +186,11 @@ stages:
targetPath: xamarin-android/bin/Build$(XA.Build.Configuration)/$(InstallerArtifactName)

- task: MSBuild@1
displayName: pack runtime nupkgs
displayName: pack all nupkgs
inputs:
solution: $(System.DefaultWorkingDirectory)/xamarin-android/build-tools/Xamarin.Android.App/Xamarin.Android.App.Runtime.proj
solution: $(System.DefaultWorkingDirectory)/xamarin-android/build-tools/create-packs/Microsoft.Android.Sdk.proj
configuration: $(XA.Build.Configuration)
msbuildArguments: /t:_PackAllRuntimePacks /restore /bl:$(System.DefaultWorkingDirectory)/bin/Build$(XA.Build.Configuration)/create-runtime-packs.binlog

- task: DotNetCoreCLI@2
displayName: pack sdk and ref nupkgs
inputs:
command: pack
packagesToPack: "\
$(System.DefaultWorkingDirectory)/xamarin-android/build-tools/Xamarin.Android.App/Xamarin.Android.App.Ref.proj;
$(System.DefaultWorkingDirectory)/xamarin-android/src/Xamarin.Android.Sdk/Xamarin.Android.Sdk.proj;
$(System.DefaultWorkingDirectory)/xamarin-android/src/Xamarin.Android.Sdk/Xamarin.Android.Sdk.Lite.proj"
configuration: $(XA.Build.Configuration)
packDirectory: $(System.DefaultWorkingDirectory)/xamarin-android/bin/Build$(XA.Build.Configuration)/$(NuGetArtifactName)
msbuildArguments: /t:CreateAllPacks /restore /bl:$(System.DefaultWorkingDirectory)/bin/Build$(XA.Build.Configuration)/create-all-packs.binlog

- task: NuGetCommand@2
displayName: push nupkgs
Expand Down Expand Up @@ -302,22 +291,11 @@ stages:
msbuildArguments: /p:CreateVsixContainer=True /p:ZipPackageCompressionLevel=Normal /bl:$(System.DefaultWorkingDirectory)\bin\Build$(XA.Build.Configuration)\msbuild-create-vsix.binlog

- task: MSBuild@1
displayName: pack runtime nupkgs
displayName: pack all nupkgs
inputs:
solution: $(System.DefaultWorkingDirectory)\build-tools\Xamarin.Android.App\Xamarin.Android.App.Runtime.proj
solution: $(System.DefaultWorkingDirectory)\build-tools\create-packs\Microsoft.Android.Sdk.proj
configuration: $(XA.Build.Configuration)
msbuildArguments: /t:_PackAllRuntimePacks /restore /bl:$(System.DefaultWorkingDirectory)\bin\Build$(XA.Build.Configuration)\create-runtime-packs.binlog

- task: DotNetCoreCLI@2
displayName: pack sdk and ref nupkgs
inputs:
command: pack
packagesToPack: "\
$(System.DefaultWorkingDirectory)\\build-tools\\Xamarin.Android.App\\Xamarin.Android.App.Ref.proj;
$(System.DefaultWorkingDirectory)\\src\\Xamarin.Android.Sdk\\Xamarin.Android.Sdk.proj;
$(System.DefaultWorkingDirectory)\\src\\Xamarin.Android.Sdk\\Xamarin.Android.Sdk.Lite.proj"
configuration: $(XA.Build.Configuration)
packDirectory: $(System.DefaultWorkingDirectory)\bin\Build$(XA.Build.Configuration)\$(NuGetArtifactName)
msbuildArguments: /t:CreateAllPacks /restore /bl:$(System.DefaultWorkingDirectory)\bin\Build$(XA.Build.Configuration)\create-all-packs.binlog

- task: CmdLine@1
displayName: xabuild Xamarin.Android-Tests
Expand Down Expand Up @@ -708,7 +686,6 @@ stages:
# UNDONE: Need plot definitions for the following files:
# TestResult-Mono.Android_TestsAppBundle-times.csv
# TestResult-Mono.Android_TestsMultiDex-times.csv
# TestResult-Mono.Android_TestsMultiDex-values-$(ApkTestConfiguration).csv
# TestResult-Xamarin.Android.EmbeddedDSO_Test-times.csv

- template: yaml-templates/plots-to-appinsights.yaml
Expand All @@ -719,14 +696,6 @@ stages:
plotTitle: Runtime merged
plotPathAndFilename: $(System.DefaultWorkingDirectory)/TestResult-Mono.Android_Tests-times.csv

- template: yaml-templates/plots-to-appinsights.yaml
parameters:
condition: and(succeeded(), or(eq(variables['Build.Reason'], 'IndividualCI'), eq(variables['Build.Reason'], 'Manual')))
configuration: $(ApkTestConfiguration)
plotGroup: Test size
plotTitle: Runtime test sizes
plotPathAndFilename: $(System.DefaultWorkingDirectory)/TestResult-Mono.Android_Tests-values-$(ApkTestConfiguration).csv

- template: yaml-templates/plots-to-appinsights.yaml
parameters:
condition: and(succeeded(), or(eq(variables['Build.Reason'], 'IndividualCI'), eq(variables['Build.Reason'], 'Manual')))
Expand Down Expand Up @@ -756,8 +725,8 @@ stages:
condition: and(succeeded(), or(eq(variables['Build.Reason'], 'IndividualCI'), eq(variables['Build.Reason'], 'Manual')))
configuration: $(ApkTestConfiguration)
plotGroup: Test times
plotTitle: Xamarin.Forms app
plotPathAndFilename: $(System.DefaultWorkingDirectory)/TestResult-Xamarin.Forms_Tests-values-$(ApkTestConfiguration).csv
plotTitle: Locale
plotPathAndFilename: $(System.DefaultWorkingDirectory)/TestResult-Xamarin.Android.Locale_Tests-times.csv

- template: yaml-templates/fail-on-issue.yaml

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@

<!-- Include initial pack content in ref and runtime. We aren't yet generating separate reference and runtime assemblies. -->
<ItemGroup>
<_AndroidAppPackAssemblies Include="$(XamarinAndroidSourcePath)bin\$(Configuration)\lib\xamarin.android\xbuild-frameworks\Xamarin.Android.App\netcoreapp3.1\Java.Interop.dll" />
<_AndroidAppPackAssemblies Include="$(XamarinAndroidSourcePath)bin\$(Configuration)\lib\xamarin.android\xbuild-frameworks\Xamarin.Android.App\netcoreapp3.1\Mono.Android.dll" />
<_AndroidAppPackAssemblies Include="$(XamarinAndroidSourcePath)bin\$(Configuration)\lib\xamarin.android\xbuild-frameworks\Xamarin.Android.App\netcoreapp3.1\Mono.Android.Export.dll" />
<_AndroidAppPackAssemblies Include="$(XamarinAndroidSourcePath)bin\$(Configuration)\lib\xamarin.android\xbuild-frameworks\Microsoft.Android\netcoreapp3.1\Java.Interop.dll" />
<_AndroidAppPackAssemblies Include="$(XamarinAndroidSourcePath)bin\$(Configuration)\lib\xamarin.android\xbuild-frameworks\Microsoft.Android\netcoreapp3.1\Mono.Android.dll" />
<_AndroidAppPackAssemblies Include="$(XamarinAndroidSourcePath)bin\$(Configuration)\lib\xamarin.android\xbuild-frameworks\Microsoft.Android\netcoreapp3.1\Mono.Android.Export.dll" />
<FrameworkListFileClass Include="@(_AndroidAppPackAssemblies->'%(Filename)%(Extension)')" Profile="Android" />
</ItemGroup>

<!-- https://github.com/dotnet/runtime/blob/0647ec314948904319da5eb15e9931f7c85ed1e2/src/installer/pkg/projects/Directory.Build.targets#L281 -->
<Target Name="_GenerateFrameworkListFile" >
<!-- Hardcode framework attributes -->
<ItemGroup>
<FrameworkListRootAttributes Include="Name" Value="Xamarin Android - NET 5.0" />
<FrameworkListRootAttributes Include="Name" Value=".NET 5.0 - Android" />
<FrameworkListRootAttributes Include="TargetFrameworkIdentifier" Value=".NETCoreApp" />
<FrameworkListRootAttributes Include="TargetFrameworkVersion" Value="5.0" />
<FrameworkListRootAttributes Include="FrameworkName" Value="Xamarin.Android.App" />
<FrameworkListRootAttributes Include="FrameworkName" Value="Microsoft.Android" />
</ItemGroup>

<!-- https://github.com/dotnet/arcade/blob/1924d7ea148c9f26ca3d82b60f0a775a5389ed22/src/Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk/src/CreateFrameworkListFile.cs -->
Expand All @@ -48,11 +48,18 @@
</PropertyGroup>
</Target>

<Target Name="_PackAllRuntimePacks" >
<Exec Command="dotnet pack -p:Configuration=$(Configuration) -p:AndroidRID=android.21-arm -p:AndroidABI=armeabi-v7a &quot;$(MSBuildThisFileDirectory)Xamarin.Android.App.Runtime.proj&quot;" />
<Exec Command="dotnet pack -p:Configuration=$(Configuration) -p:AndroidRID=android.21-arm64 -p:AndroidABI=arm64-v8a &quot;$(MSBuildThisFileDirectory)Xamarin.Android.App.Runtime.proj&quot;" />
<Exec Command="dotnet pack -p:Configuration=$(Configuration) -p:AndroidRID=android.21-x86 -p:AndroidABI=x86 &quot;$(MSBuildThisFileDirectory)Xamarin.Android.App.Runtime.proj&quot;" />
<Exec Command="dotnet pack -p:Configuration=$(Configuration) -p:AndroidRID=android.21-x64 -p:AndroidABI=x86_64 &quot;$(MSBuildThisFileDirectory)Xamarin.Android.App.Runtime.proj&quot;" />
<Target Name="CreateAllRuntimePacks" >
<Exec Command="dotnet pack -p:Configuration=$(Configuration) -p:AndroidRID=android.21-arm -p:AndroidABI=armeabi-v7a &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Runtime.proj&quot;" />
<Exec Command="dotnet pack -p:Configuration=$(Configuration) -p:AndroidRID=android.21-arm64 -p:AndroidABI=arm64-v8a &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Runtime.proj&quot;" />
<Exec Command="dotnet pack -p:Configuration=$(Configuration) -p:AndroidRID=android.21-x86 -p:AndroidABI=x86 &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Runtime.proj&quot;" />
<Exec Command="dotnet pack -p:Configuration=$(Configuration) -p:AndroidRID=android.21-x64 -p:AndroidABI=x86_64 &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Runtime.proj&quot;" />
</Target>

<Target Name="CreateAllPacks"
DependsOnTargets="CreateAllRuntimePacks" >
<Exec Command="dotnet pack -p:Configuration=$(Configuration) &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Ref.proj&quot;" />
<Exec Command="dotnet pack -p:Configuration=$(Configuration) &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Sdk.proj&quot;" />
<Exec Command="dotnet pack -p:Configuration=$(Configuration) &quot;$(MSBuildThisFileDirectory)Xamarin.Android.Sdk.Lite.proj&quot;" />
</Target>

</Project>
Loading

0 comments on commit 8d8197d

Please sign in to comment.