Граф коммитов

5161 Коммитов

Автор SHA1 Сообщение Дата
dotnet-maestro[bot] 1858b55ed7
Bump to dotnet/installer/main@1c496970b7 9.0.100-preview.2.24078.1 (#8685)
Changes: 5680e93cb2...1c496970b7
Changes: e3547f1d3a...bcc1d3d6f0
Changes: fd99e59a43...ae7c93e25a

Updates:

* Microsoft.Dotnet.Sdk.Internal: from 9.0.100-preview.2.24073.12 to 9.0.100-preview.2.24078.1
* Microsoft.NETCore.App.Ref: from 9.0.0-preview.2.24072.10 to 9.0.0-preview.2.24076.4
* Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport: from 9.0.0-alpha.1.24068.1 to 9.0.0-alpha.1.24072.1
* Microsoft.NET.ILLink.Tasks: from 9.0.0-preview.2.24072.10 to 9.0.0-preview.2.24076.4
2024-02-01 14:45:46 -06:00
Peter Collins 80ee320ed0
[GetAndroidDependencies] Add Jdk dependency info (#8651)
Context: ed102fc908

Updates `<GetAndroidDependencies/>` to output a new `@(JavaDependency)`
item group if `$(AndroidInstallJavaDependencies)` is set to `true`.
This group currently contains one item:

    JavaDependency
      jdk
        Version = 17.0.8.1

This output will be used by `<InstallAndroidDependencies/>` to install
our recommended version of the Java SDK.
2024-01-30 20:48:51 -08:00
Marek Habersack 6733ab9278
[xaprepare] Add support for newer SparkyLinux (#8684)
SparkyLinux is a Debian-based distribution that's 100% compatible
with its upstream, but it is rebranded and follows its own versioning
scheme.  Add support for SparkLinux detection so that `xaprepare`
can properly detect the required packages.

TODO: the whole Debian detection code has to be refreshed at some
point.
2024-01-29 10:10:43 +00:00
dotnet-maestro[bot] 6d33103049
Bump to dotnet/installer/main@5680e93cb2 9.0.100-preview.2.24073.12 (#8666)
Changes: f91d4ca399...5680e93cb2
Changes: dbb335c6ba...e3547f1d3a
Changes: 5cda86493a...fd99e59a43
Changes: 81facb3f60...b8c2293cd1

Updates:

* Microsoft.Dotnet.Sdk.Internal: from 9.0.100-alpha.1.24070.3 to 9.0.100-preview.2.24073.12
* Microsoft.NETCore.App.Ref: from 9.0.0-alpha.1.24066.33 to 9.0.0-preview.2.24072.10
* Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport: from 9.0.0-alpha.1.24053.1 to 9.0.0-alpha.1.24068.1
* Microsoft.NET.ILLink.Tasks: from 9.0.0-alpha.1.24066.33 to 9.0.0-preview.2.24072.10
* Microsoft.DotNet.Cecil: from 0.11.4-alpha.24052.1 to 0.11.4-alpha.24065.1
2024-01-25 20:31:20 -06:00
Jonathan Peppers a47d349569
$(AndroidPackVersionSuffix)=preview.2; net9 is 34.99.0.preview.2 (#8678)
Context: https://github.com/xamarin/xamarin-android/tree/release/9.0.1xx-preview1

We branched for .NET 9 Preview 1 from cf1418d0 into release/9.0.1xx-preview1;
the main branch is now .NET 9 Preview 2.

Update xamarin-android/main's version number to 34.99.0-preview.2.
2024-01-25 20:29:34 -06:00
Jonathan Peppers cf1418d01d
[Xamarin.Android.Build.Tasks] fix net7.0 "out of support" message (#8660)
Context: a48a9c564c

When .NET 9 ships, the .NET 7 Android workload will be out of support.
We already have this behavior setup, but unfortunately the error
message is wrong:

	Microsoft.NET.EolTargetFrameworks.targets(38,5):
	error NETSDK1202: The workload 'net6.0-android' is out of support and will not receive security updates in the future.
	Please refer to https://aka.ms/maui-support-policy for more information about the support policy.
	[MauiTest.csproj::TargetFramework=net7.0-android]

It says `net6.0-android`!

In a48a9c56, we hardcoded `net6.0` to align with the iOS team, but we
can use the `$(TargetFrameworkVersion)` property (removing `v`) so we
don't have to update this line every year.

I updated a test for this scenario.
2024-01-25 16:56:04 -05:00
Peter Collins a832dd8d2a
[ci] Use NuGetAuthenticate@1 (#8676)
The `NuGetAuthenticate@0` task is deprecated and will soon be removed:

    Task 'NuGet authenticate' version 0 (NuGetAuthenticate@0) is deprecated.
    This task will be removed. From January 31, 2024, onwards it may no longer be available.

Use the updated `NuGetAuthenticate@1` task instead.
2024-01-25 13:30:00 -08:00
dependabot[bot] c6ccc65c97
Bump external/xamarin-android-tools from `b175674` to `ed102fc` (#8667) 2024-01-25 20:32:15 +00:00
dependabot[bot] be37a605d1
Bump external/android-api-docs from `3f64bdd` to `9b7ea12` (#8672) 2024-01-25 20:31:39 +00:00
Jonathan Pobst 5c39b4fd5a
[ci] Only install Android SDK API-34 on test agents. (#8670)
Now that API-34 is our baseline, we no longer need to install the API-33 Android SDK on our test agents, saving a little bit of space and time.
2024-01-25 07:37:05 -10:00
VS MobileTools Engineering Service 2 e67afc7d7a
Localized file check-in by OneLocBuild Task (#8668)
Context: https://aka.ms/onelocbuild
Context: https://aka.ms/AllAboutLoc

Build definition ID 17928: Build ID 8968258
2024-01-24 08:16:27 -06:00
Jonathan Peppers 2cbb5c98eb
[Xamarin.Android.build.Tasks] `<CheckDuplicateJavaLibraries/>` ignores `repackaged.jar` (#8664)
Context: https://maven.google.com/androidx/emoji2/emoji2/1.4.0/emoji2-1.4.0.aar
Context: https://maven.google.com/androidx/health/connect/connect-client/1.1.0-alpha07/connect-client-1.1.0-alpha07.aar

When using the two AARs linked above, you get the build error:

    Xamarin.Android.Common.targets(845,3): error XA1014: JAR library references with identical file names but different contents were found: repackaged.jar. Please remove any conflicting libraries from EmbeddedJar, InputJar and AndroidJavaLibrary.

They both contain `libs/repackaged.jar`, which I'm not able to find any
information about. I can reproduce this problem in an MSBuild test.

Unfortunately, the only way to workaround the error message is to:

* Unzip the `.aar`

* Rename `libs/repackaged.jar` to `libs/repackaged-emoji2-1.4.0.jar`,
  for example

* Re-zip the `.aar`

a9ca3d46 had a similar problem with `r-classes.jar`. Let's expand upon
this change by introducing a private item group:

    <ItemGroup>
      <_AndroidExcludedDuplicateJavaLibraries Include="classes.jar" />
      <_AndroidExcludedDuplicateJavaLibraries Include="r-classes.jar" />
      <_AndroidExcludedDuplicateJavaLibraries Include="repackaged.jar" />
    </ItemGroup>

So if this occurs in the future, we can add future files to this list
without rebuilding the Android workload.
2024-01-23 16:04:34 -06:00
CSIGS@microsoft.com 2b2c6ebb5e
LEGO: Merge pull request 8665
LEGO: Merge pull request 8665
2024-01-23 08:07:15 -08:00
Jonathan Peppers 766ac33844
[Xamarin.Android.Build.Tasks] parse JDK `release` file directly (#8663)
Fixes: https://github.com/xamarin/xamarin-android/issues/8369

During Android project builds, the `<ValidateJavaVersion/>` MSBuild task
currently shells out to `java -version` and `javac -version` to
determine if we have a *valid* & usable JDK.

Unfortunately, some customer logs have reported build times that are
completely bananas:

    Task ValidateJavaVersion 23.469s
    ...
    Top 10 most expensive tasks
    ...
    ValidateJavaVersion = 3:46.740, 35 calls

`java -version` and/or `javac -version` must be quite slow! Reading the
source for OpenJDK, it appears that `java -version` actually starts a
JVM to call a single method:

* df370d725e/src/java.base/share/native/libjli/java.c (L1895-L1913)
* c9cacfb25d/src/java.base/share/classes/java/lang/VersionProps.java.template (L191-L233)

That could explain the slowness?

To improve this, let's just parse the file:

* C:\Program Files\Microsoft\jdk-11.0.19.7-hotspot\release

With contents:

    IMPLEMENTOR="Microsoft"
    IMPLEMENTOR_VERSION="Microsoft-7621296"
    JAVA_VERSION="11.0.19"
    JAVA_VERSION_DATE="2023-04-18"
    LIBC="default"
    MODULES="java.base java.compiler java.datatransfer java.xml java.prefs java.desktop java.instrument java.logging java.management java.security.sasl java.naming java.rmi java.management.rmi java.net.http java.scripting java.security.jgss java.transaction.xa java.sql java.sql.rowset java.xml.crypto java.se java.smartcardio jdk.accessibility jdk.internal.vm.ci jdk.management jdk.unsupported jdk.internal.vm.compiler jdk.aot jdk.internal.jvmstat jdk.attach jdk.charsets jdk.compiler jdk.crypto.ec jdk.crypto.cryptoki jdk.crypto.mscapi jdk.dynalink jdk.internal.ed jdk.editpad jdk.hotspot.agent jdk.httpserver jdk.internal.le jdk.internal.opt jdk.internal.vm.compiler.management jdk.jartool jdk.javadoc jdk.jcmd jdk.management.agent jdk.jconsole jdk.jdeps jdk.jdwp.agent jdk.jdi jdk.jfr jdk.jlink jdk.jshell jdk.jsobject jdk.jstatd jdk.localedata jdk.management.jfr jdk.naming.dns jdk.naming.ldap jdk.naming.rmi jdk.net jdk.pack jdk.rmic jdk.scripting.nashorn jdk.scripting.nashorn.shell jdk.sctp jdk.security.auth jdk.security.jgss jdk.unsupported.desktop jdk.xml.dom jdk.zipfs"
    OS_ARCH="x86_64"
    OS_NAME="Windows"
    SOURCE=".:git:6171c19d2c18"

We can just call `StreamReader.ReadLine()` until `JAVA_VERSION="` is
found.

I kept the existing logic in place, with an escape hatch if it were ever
needed. After a few .NET 9 previews, we could consider removing old
logic entirely?

This logic is considerably faster, because we no longer launch a JVM!

* Before: Task ValidateJavaVersion 377ms
* After: Task ValidateJavaVersion 2ms

Where you can test the "Before" logic by passing
`-p:_AndroidUseJavaExeVersion=true`.

I assume the customer's log from before (35 calls) would be around 70ms
give or take instead of 3 hours and 46 minutes? Even if this estimation
was 10x worse, it would still be a huge improvement! 👀
2024-01-23 09:31:06 +00:00
dotnet-maestro[bot] 7b0e102f76
Bump to dotnet/installer/main@f91d4ca399 9.0.100-alpha.1.24070.3 (#8635)
Changes: 29db8a1157...f91d4ca399
Changes: 8121f82d7d...dbb335c6ba
Changes: 13ad0749b9...5cda86493a
Changes: 02026e5c1b...81facb3f60

Updates:

* Microsoft.Dotnet.Sdk.Internal: from 9.0.100-alpha.1.23628.5 to 9.0.100-alpha.1.24070.3
* Microsoft.NETCore.App.Ref: from 9.0.0-alpha.1.23627.5 to 9.0.0-alpha.1.24066.33
* Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport: from 9.0.0-alpha.1.23617.2 to 9.0.0-alpha.1.24053.1
* Microsoft.NET.ILLink.Tasks: from 9.0.0-alpha.1.23627.5 to 9.0.0-alpha.1.24066.33
* Microsoft.DotNet.Cecil: from 0.11.4-alpha.23617.1 to 0.11.4-alpha.24052.1

Other changes:

* Update `BuildReleaseArm64SimpleDotNet.apkdesc`

* Bump to MSBuild.StructuredLogger 2.2.169

Co-authored-by: Jonathan Peppers <jonathan.peppers@microsoft.com>
2024-01-22 17:16:22 -06:00
Jonathan Pobst 9028e22286
[.github] Re-enable locking issues after 30 days of inactivity (#8655)
Context: 16e0943f5a
Context: https://github.com/dotnet/maui/pull/19145

When we migrated from FabricBot to GitOps.ResourceManagement due to
FabricBot being decommissioned (16e0943f), we lost the rule:

  * [Closed Issue Management] Lock issues closed without activity for over 30 days

This rule is useful because comments on old, closed issues rarely
will be seen or responded to, making us seem unresponsive to users.

MAUI has replaced this rule (dotnet/maui#19145) with a GitHub Action
written by the VSCode team that runs daily and performs the locking.
We should ~~steal~~ borrow this for our own repos.

[0]: https://github.com/xamarin/xamarin-android/pull/8173
2024-01-22 15:24:18 -05:00
VS MobileTools Engineering Service 2 73c31353e8
Localized file check-in by OneLocBuild Task (#8657)
Context: https://aka.ms/onelocbuild
Context: https://aka.ms/AllAboutLoc

Build definition ID 17928: Build ID 8952275
2024-01-22 08:18:02 -06:00
CSIGS@microsoft.com d688f1bbad
LEGO: Merge pull request 8656
LEGO: Merge pull request 8656
2024-01-20 03:38:11 -08:00
VS MobileTools Engineering Service 2 eda5449e4e
Localized file check-in by OneLocBuild Task (#8652)
Context: https://aka.ms/onelocbuild
Context: https://aka.ms/AllAboutLoc

Build definition ID 17928: Build ID 8944839
2024-01-19 08:03:45 -06:00
dependabot[bot] 4a1f59f5dd
Bump to xamarin/xamarin-android-tools/main@b175674 (#8644)
Changes: 4889bf02...b1756740

* [ci] Add API Scan job
* [ci] Only enable CodeQL on Windows build job
2024-01-19 08:01:32 -06:00
Jonathan Peppers c008eb5513
[Xamarin.Android.Build.Tasks] remove checks for `$(UsingAndroidNETSdk)` (#8647)
In .NET 6+, `$(UsingAndroidNETSdk)` is always `true` as the general
identifier that this project is .NET and not Xamarin.Android. We used
this flag as a way to share code between .NET Android and
Xamarin.Android.

* Remove checks for `$(UsingAndroidNETSdk)`

* No longer need to pass in this value to MSBuilds tasks or other C#
  classes

* Checks if `true` leave in place, and remove the condition

* Checks if `false` can just be completely removed now

In a future PR, we may also be able to remove
`$(_AndroidIsBindingProject)`, which is slightly related. We removed the
"binding project" as a concept in .NET 6+.

I left the `$(UsingAndroidNETSdk)` property in place, even though it is
not used in these targets. Other general MSBuild targets may continue to
use it in perpetuity.
2024-01-19 07:59:36 -06:00
Jonathan Peppers 2f192386e8
[Xamarin.Android.Build.Tasks] XA1039 error for Android.Support (#8629)
Context: c92702619f
Context: 68368189d6
Context: 929e701241
Context: https://github.com/xamarin/xamarin-android/pull/8478
Context: https://github.com/xamarin/xamarin-android/issues/8155
Context: https://github.com/xamarin/xamarin-android/issues/8168

Our build process has a bit of a "consistent sanity" problem: large
portions of the build process assume that the output of a `.csproj`
is a single assembly, and that single assembly is (eventually)
embedded into the `.apk`, to be loaded at runtime.

Unfortunately, that wasn't strictly true starting with .NET 5:
there were *multiple* `System.Private.CoreLib.dll` assemblies, which
needed to be treated specially; see also c9270261.

We discovered that this assumption was even *less* true because of
the linker, which would quite happily *replace* `IntPtr.get_Size()`
method invocations with a *constant*, specific for the target ABI;
see also 68368189, 929e7012.  This in turn could be responsible for
all sorts of weirdness if e.g. a 64-bit assembly were used in a
32-bit process, or vice versa.

Which brings us to the original assumption: there is (usually) only
one "source" assembly, which is (optionally) linked into one "linked"
assembly, which is packaged into one assembly in the `.apk`.

With the linker, though, we can have one "source" assembly, which
when linked becomes *N* assemblies, which *should be* separately
packaged as per-ABI assemblies within the `.apk`, but
*probably aren't*, which we *think* is the "root cause" of #8155.

PR #8478 is attempting fix this assumption, imbuing the build system
with knowledge that the linker may produce *multiple outputs* for a
single input assembly.

Unfortunately, in trying to fix things, various intermediate assembly
locations have *changed*, which in turn breaks
[AndroidX Migration in Xamarin.Forms][0], as it makes assumptions
about where various assemblies are located within `obj`:

	(_AndroidXCecilfy target) ->
	/Users/runner/.nuget/packages/xamarin.androidx.migration/1.0.8/buildTransitive/monoandroid90/Xamarin.AndroidX.Migration.targets(227,9): error : Source assembly does not exist: 'obj/Debug/android/assets/UnnamedProject.dll'.

as [`@(_AndroidXFileToCecilfy)`][1] uses
`$(MonoAndroidIntermediateAssetsDir)`, which does not account for the
ABI which is now in the path:

	<ItemGroup>
	  <_AndroidXFileToCecilfy Include="@(ResolvedUserAssemblies->'$(MonoAndroidIntermediateAssetsDir)%(Filename)%(Extension)')"
	    Condition="('%(ResolvedUserAssemblies.TargetFrameworkIdentifier)' == 'MonoAndroid' or '%(ResolvedUserAssemblies.HasMonoAndroidReference)' == 'true') and ('%(ResolvedUserAssemblies.AndroidXSkipAndroidXMigration)' != 'true')" />
	</ItemGroup>

Given that AndroidX Migration is mostly for Xamarin.Forms customers
(and *kinda* buggy, and unmaintained), and MAUI doesn't support the
Android Support libraries, and thus doesn't need AndroidX Migration,
we'd like to just *not worry about this*.

The problem?  The above error message is not actionable, and doesn't
tell anybody how to fix it.

Introduce a new `XA1039` *actionable* error in .NET 9:

	error XA1039: The Android Support libraries are not supported in .NET 9 and later,
	please migrate to AndroidX. See https://aka.ms/xamarin/androidx for more details.

The XA1039 error is generated if any NuGet packages are found matching:

  * `Xamarin.Android.Support.*`
  * `Xamarin.Android.Arch.*`

TODO: "port" XA1039 to .NET 8 *as a warning*, so that customers will
have some time to migrate off of the Android Support libraries before
.NET 9 is released in 2024-Nov.

	--<AndroidError Code="XA1039"
	++<AndroidWarning Code="XA1039"
	    ResourceName="XA1039"
	    Condition=" '@(_AndroidUnsupportedPackages->Count())' != '0' "
	/>

The biggest impact here is going to be many of our old tests, which
use the support libraries in various forms.

Improvements & general cleanup:

  * Removed all old/unused packages in `KnownPackages.cs`

  * Updated `KnownPackages.cs` to latest versions, including Xamarin.Forms

  * [Android Wear tests are now migrated from support to AndroidX][2]

  * `AndroidUpdateResourcesTest.CheckEmbeddedSupportLibraryResources()`
    is renamed to `.CheckEmbeddedAndroidXResources()`.

  * `BuildTest2.BuildHasNoWarnings()` was not appropriately applying
    `IsRelease`.

  * `Android.Support.v8.RenderScript` removed in favor of an inline
    `.so` file.

  * A few tests that used support libraries to create a project large
    numbers of dependencies, moved to
    `XamarinFormsAndroidApplicationProject`.

  * `IncrementalBuildTest.ResolveLibraryProjectImports()` now sorts
    items before comparing them.

  * `XamarinFormsAndroidApplicationProject` has a workaround for Guava:  
    <https://github.com/xamarin/AndroidX/issues/535>

  * Fix a bug in `AndroidFastDeploymentType=Assemblies::Dexes`;
    see "AndroidFastDeploymentType=Assemblies::Dexes" section, below.

Removed tests:

  * `AndroidXMigration`, `AndroidXMigrationBug`

  * `ResolveLibraryImportsWithReadonlyFiles`, seemed duplicate of other
    Android Wear tests, and used support libraries.

  * `ExtraAaptManifest` as it depends on `Xamarin.Android.Fabric` and
    `Xamarin.Android.Crashlytics`. These are deprecated and depend on
    support libraries.

  * `BuildProguardEnabledProjectSource` now only tests `Release` mode.
    Since updating to AndroidX, `Debug` mode was triggering multi-dex.
    Making it difficult to assert contents of `*.dex` files.


~~ AndroidFastDeploymentType=Assemblies::Dexes ~~

The runtime test in `ApplicationRunsWithDebuggerAndBreaks()` was
crashing at runtime with:

	E monodroid-assembly: typemap: failed to stat TypeMap index file '/data/user/0/com.xamarin.applicationrunswithdebuggerandbreaks/files/.__override__/typemaps/typemap.index': No such file or directory
	F monodroid-assembly: typemap: unable to load TypeMap data index from '/data/user/0/com.xamarin.applicationrunswithdebuggerandbreaks/files/.__override__/typemaps/typemap.index'

This only happens when `AndroidFastDeploymentType=Assemblies::Dexes` is
used, as it is the case when typemap files like this are fast deployed
and used at runtime.

What was even more odd, was the file seems to exist after a
`-t:Install`, but ends up missing after `-t:Run`:

	> adb shell run-as com.xamarin.applicationrunswithdebuggerandbreaks ls -la files/.__override__/typemaps/typemap.index
	ls: files/.__override__/typemaps/typemap.index: No such file or directory

It appears that `-t:Install` successfully deploys the file:

	Pushed 3969 to /data/local/tmp/.xatools/typemap.index
	DEBUG RunShellCommand emulator-5554 "run-as" "com.xamarin.applicationrunswithdebuggerandbreaks" "--user" "0" "files/.__tools__/xamarin.cp" "/data/local/tmp/.xatools/typemap.index" "files/.__override__/typemaps/typemap.index" "1705432079367" [5ms]
	files/.__tools__/xamarin.cp returned: moved [/data/local/tmp/.xatools/typemap.index] to [files/.__override__/typemaps/typemap.index] modifieddate [1705432079367]
	moved /data/local/tmp/.xatools/typemap.index to files/.__override__/typemaps/typemap.index
	Installed files/.__override__/typemaps/typemap.index. [12ms]
	NotifySync CopyFile obj\Debug\android\typemaps\typemap.index. [0ms]

But then `-t:Run` deletes the file!

	Remove redundant file files/.__override__/typemaps/typemap.index
	DEBUG RunShellCommand 0A041FDD400327 "run-as" "com.xamarin.applicationrunswithdebuggerandbreaks" "rm" "-Rf" "files/.__override__/typemaps/typemap.index" [29ms]

This happens because the `@(_AndroidTypeMapping)` item group is empty
during an incremental build:

  * The `<GenerateJavaStubs/>` MSBuild task, during the first build
    outputs `@(_AndroidTypeMapping)` items

  * During an incremental build, the `_GenerateJavaStubs` MSBuild
    *target* is skipped, and so the `@(_AndroidTypeMapping)` item
    group is empty!

  * The `<FastDeploy/>` task happily deletes files that it thinks
    should be removed.

For now, let's add logic to the `_GenerateJavaStubs` target to fill
in the `@(_AndroidTypeMapping)` item group during incremental builds:

	<ItemGroup Condition=" '$(_InstantRunEnabled)' == 'True' and '@(_AndroidTypeMapping->Count())' == '0' ">
	  <_AndroidTypeMapping Include="$(_NativeAssemblySourceDir)typemaps\*" />
	</ItemGroup>

`<ItemGroup>`s are still evaluated when a target is *skipped*,
solving the problem.

I assume this is working in `main`, because Xamarin.AndroidX.Migration
package was involved.  It likely was running the `_GenerateJavaStubs`
target on every build.

[0]: https://learn.microsoft.com/xamarin/xamarin-forms/platform/android/androidx-migration
[1]: 17e596fafe/source/migration/BuildTasks/Xamarin.AndroidX.Migration.targets (L205-L206)
[2]: https://android-developers.googleblog.com/2016/04/build-beautifully-for-android-wear.html
2024-01-18 08:18:55 -05:00
VS MobileTools Engineering Service 2 d538d7b37f
Localized file check-in by OneLocBuild Task (#8643)
Context: https://aka.ms/onelocbuild
Context: https://aka.ms/AllAboutLoc

* Build definition ID 17928: Build ID 8930705
2024-01-17 16:25:24 -06:00
dependabot[bot] 384e1a76ab
Bump com.android.tools:r8 from 8.2.33 to 8.2.42 (#8634)
Context: https://r8.googlesource.com/r8/+/refs/tags/8.2.42
Context: https://maven.google.com/web/index.html?q=r8#com.android.tools:r8:8.2.42
2024-01-17 13:08:45 -06:00
Dean Ellis 705bb47eff
[Xamarin.Android.Build.Tasks] Add check for aapt2 invalid data path error (#8640)
Fixes https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1922983

Our error matching in Aapt2.cs did not include a new error message which
has been introduced. As a result we got a APT2000 error instead of an
actual error message which we get for other errors.
2024-01-17 11:39:01 +00:00
Dean Ellis 8e65135ad4
[Xamarin.Android.Build.Tasks] fix warning when missing `proguard-android.txt` (#8641)
We are seeing numerous test failures because of this warning.

    warning XA4304: ProGuard configuration file 'C:\Android\android-sdk\tools\proguard\proguard-android.txt' was not found.

This is because the `proguard-android.txt` file no longer ships with the
Android SDK. We should check this file exists before adding it to the
list of `@(_ProguardConfiguration)` files. This way if a user still does
have it, it will be included.
2024-01-16 19:35:21 -06:00
CSIGS@microsoft.com b5920ec6cf
LEGO: Merge pull request 8642
LEGO: Merge pull request 8642
2024-01-16 17:03:32 -08:00
Šimon Rozsíval 64eae1ee54
Fix ServerCertificateCustomValidator on API 21-23 (#8637)
Follow-up to https://github.com/xamarin/xamarin-android/pull/8594 to fix https://github.com/dotnet/runtime/issues/95506 on Android API 21-23
2024-01-16 10:50:46 +00:00
Jonathan Pobst 87341ccd16
[api-compatibility] Update `Mono.Android` information for API-34 (#8596)
Context: 2cfce14b0d
Context: 76ab8b2ca2

Update our api-compat "baseline" to what we shipped in .NET 8.
This means we can delete all current "acceptable breakages".
Additionally, we can delete all the `acceptable-breakages-v*.0.txt`
files because they were only used for Classic.

Remove usage of `cil-strip.exe` from the `UpdateMonoAndroidContract`
target to create the baseline `.zip`, as we no longer provision the
Mono bundle which contained it.  By default, we produce a .NET `ref`
version of `Mono.Android.dll` that we can include instead, which
already has had CIL stripped from it.

Update our `PublicAPIAnalyzers` API-34 profile, renaming
`PublicAPI.Unshipped.txt` to `PublicAPI.Shipped.txt`, now that API-34
bindings have shipped.
2024-01-12 13:32:43 -05:00
Marek Habersack fa6d35c0b3
Update a number of l18n files (#8633)
Context: 97819d81b3

These files are modified on each build, with new content referring
to the changes in 97819d81.

Commit the files since the new content must be translated.
2024-01-12 12:38:51 -05:00
Jonathan Pobst 037d286092
[ci] Fix remaining permanent CI warnings. (#8595)
Fix various CI warnings, such as:

	Specifying an exact version is not recommended on Microsoft-Hosted agents.
	  Patch versions of Python can be replaced by new ones on Hosted agents
	  without notice, which will cause builds to fail unexpectedly.
	  It is recommended to specify only major or major and minor version (Example: `3` or `3.9`)

Fix: only specify `major.minor` as requested.

Or [MSB4011][0]:

	build-tools\scripts\RunTests.targets(3,3): Warning MSB4011:
	  "C:\a\_work\1\s\Directory.Build.props" cannot be imported again.
	  It was already imported at "C:\a\_work\1\s\build-tools\scripts\PrepareWindows.targets(3,3)".
	  This is most likely a build authoring error. This subsequent import will be ignored. 
	build-tools\scripts\RunTests.targets(7,3): Warning MSB4011:
	  "C:\a\_work\1\s\Configuration.props" cannot be imported again.
	  It was already imported at "C:\a\_work\1\s\build-tools\scripts\PrepareWindows.targets(11,3)".
	  This is most likely a build authoring error. This subsequent import will be ignored.
	tests\api-compatibility\api-compatibility.targets(3,3): Warning MSB4011:
	  "C:\a\_work\1\s\Configuration.props" cannot be imported again.
	  It was already imported at "C:\a\_work\1\s\build-tools\scripts\PrepareWindows.targets(11,3)".
	  This is most likely a build authoring error. This subsequent import will be ignored.

Fix: add a flag denoting that we have already imported a project and
a `Condition` to prevent duplicate imports.

Or [CS8604][1]:

	build-tools\xaprepare\xaprepare\Application\Context.cs(608,42): Warning CS8604:
	Possible null reference argument for parameter 'path1' in 'string Path.Combine(string path1, string path2)'.

Fix: add null check.

Or:

	EXEC(0,0): Warning : dotnet archive URL https://dotnetcli.azureedge.net/dotnet/Sdk/9.0.100-alpha.1.23610.1/dotnet-sdk-9.0.100-alpha.1.23610.1-win-x64.zip not found

Fix: checking multiple URLs is part of the expected flow;
downgrade the message to "info".

Or:

	EXEC(0,0): Warning : Duplicate Third Party Notice 'IronyProject/Irony'
	  (old class: Xamarin.Android.Prepare.XamarinAndroidBuildTasks_IronyProject_Irony_TPN;
	   new class: Xamarin.Android.Prepare.XamarinAndroidToolsAidl_IronyProject_Irony_TPN)

Fix: multiple projects may use the same dependencies;
downgrade the message to "info".

The remaining CI warnings are temporary because our MAUI integration
tests are currently failing:

![image](https://github.com/xamarin/xamarin-android/assets/179295/1455637d-3f8d-4582-b5c8-50a23b1b8b25)

[0]: https://learn.microsoft.com/visualstudio/msbuild/errors/msb4011
[1]: https://learn.microsoft.com/dotnet/csharp/language-reference/compiler-messages/nullable-warnings#possible-null-assigned-to-a-nonnullable-reference
2024-01-11 19:28:02 -05:00
Jonathan Peppers eac0c3af01
[Xamarin.Android.Build.Tasks] remove `MonoRuntimeProvider.Bundled.20.java` (#8628)
In .NET 6+, the minimum API level is 21.

We can remove `MonoRuntimeProvider.Bundled.20.java`, as it was mean for devices API 20 and lower.
2024-01-11 16:44:58 -06:00
Jonathan Peppers a34988cf56
[Xamarin.Android.Build.Tasks] remove `%(TrimMode)=link` metadata (#8624)
To keep app sizes down in the .NET 6 timeframe, we special-cased
existing AndroidX and GPS packages so they were always trimmed.

Modern packages mark themselves trimmable with `$(IsTrimmable)` or the
assembly-level attribute.

For nearly 2 years, we've applied the appropriate trimming setting in
these packages:

* https://github.com/xamarin/AndroidX/pull/520
* https://github.com/xamarin/GooglePlayServicesComponents/pull/597

We should be able to remove this now in .NET 9.

With this change in place, an existing app size regression test failed that was
using an old version of Xamarin.Forms (and AndroidX):

    Saving apk description to 'BuildReleaseArm64XFormsDotNet.apkdesc'
    Size difference in bytes ([*1] apk1 only, [*2] apk2 only):
    253,683 assemblies/Xamarin.AndroidX.Core.dll
    179,063 assemblies/Xamarin.Google.Android.Material.dll
    157,233 assemblies/Xamarin.AndroidX.AppCompat.dll
    104,239 assemblies/Xamarin.AndroidX.Media.dll *2
     52,862 assemblies/Xamarin.AndroidX.Annotation.dll *2
     48,743 assemblies/Xamarin.AndroidX.RecyclerView.dll
     39,419 assemblies/Xamarin.AndroidX.Transition.dll *2
     38,993 assemblies/Xamarin.AndroidX.Browser.dll *2

To avoid this increase: update the app size test from Xamarin.Forms 4.7.0.1142
to 5.0.0.2515.

This allowed us to no longer need the `%(TrimMode)=link` changes, however
updating Xamarin.Forms increased app size in other ways.

* New AndroidX libraries contain considerable more `AndroidResource`
and Java code.

* New AndroidX `.dll` files appeared for new packages.

* Luckily, it appears that no AndroidX `.dll` files grew in size, which is what
would be the result of the `%(TrimMode)=link` change if it were still needed.

Overall app size change in this test:

    --"PackageSize": 7941134
    ++"PackageSize": 9593384
2024-01-11 08:23:27 -06:00
Peter Collins de9d6c87b6
[ci] Add exe files to API Scan (#8617)
The API Scan job added in commit a10aa383cb accidentally excluded some
of our xamarin-android-binutils artifacts.  The job has been fixed to
scan the EXE files (and corresponding symbols) that were previously
skipped.  The latest scan results appear to be consistent with what was
being reported through VS scans, and we can continue working through
these issues: 

    1. ApiScan Error missingsymbols - File: aapt2.exe.
    Tool: ApiScan: Rule: missingsymbols (Missing Symbols)

    2. ApiScan Error documentationnotfound - File: aapt2.exe.
    Tool: ApiScan: Rule: documentationnotfound (Documentation Not Found).

    3. ApiScan Error improperfileformat - File: as.exe.
    Tool: ApiScan: Rule: improperfileformat (Improper File Format).

    4. ApiScan Error missingsymbols - File: ld.exe.
    Tool: ApiScan: Rule: missingsymbols (Missing Symbols).

    5. ApiScan Error improperfileformat - File: libzipsharpnative-3-0.dll.
    Tool: ApiScan: Rule: improperfileformat (Improper File Format).

    6. ApiScan Error improperfileformat - File: llc.exe.
    Tool: ApiScan: Rule: improperfileformat (Improper File Format).

    7. ApiScan Error improperfileformat - File: llvm-mc.exe.
    Tool: ApiScan: Rule: improperfileformat (Improper File Format).

    8. ApiScan Error missingsymbols - File: llvm-strip.exe.
    Tool: ApiScan: Rule: missingsymbols (Missing Symbols).
2024-01-10 15:28:49 -08:00
Jonathan Pryor 97819d81b3
[Microsoft.Android.Templates] New files should open editor (#8623)
Fixes: https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1918037

Context: https://github.com/dotnet/templating/wiki/Reference-for-template.json
Context: https://github.com/dotnet/templating/wiki/Post-Action-Registry#open-a-file-in-the-editor

Within Visual Studio, if you:

 1. Create a new .NET MAUI or .NET Android app, then
 2. Go to the Solution Explorer, then
 3. Right-click a folder, then click Add > New Item > Android, then
 4. Double-click the **Android Activity** template.

The expected result is that a new Android Activity based on the
Android Activity template will be added to your solution
*and opened in the editor*.

Instead, a new Android Activity is added, but it is *not* opened.

Update the `.template.config/template.json` files to contain a
`postActions` section with a `openInEditor` id.  This *should* cause
Visual Studio to open the new files within the editor.
2024-01-10 14:19:45 -05:00
Jonathan Peppers a52fbcb1f7
[Xamarin.Android.Build.Tasks] remove `@(_AndroidAssemblySkipCases)` (#8622)
In an effort to remove old, unused code, we should be able to remove the
following related to the old `Android.Support.*` libraries:

* `Xamarin.Android.SkipCases.projitems` and the
  `@(_AndroidAssemblySkipCases)` item group.

This was a build performance optimization added in 02c07ed6 that would
*skip* a build step that normalized casing for `.dll` files with an
embedded `__AndroidLibraryProjects__.zip`. This optimization is not
needed at all for `.aar` files.

In .NET 9 projects, we don't create or embed
`__AndroidLibraryProjects__.zip`, so modern projects don't need this
optimization. Instead we bundle a `MyLibrary.aar` alongside
`MyLibrary.dll` inside of a `MyLibrary` NuGet package.

* Automatic trimming of the `Xamarin.Android.Support.*` assemblies

Modern packages mark themselves trimmable with `$(IsTrimmable)` or the
assembly-level attribute. Let's just remove the case for
`Android.Support` here.
2024-01-10 10:46:19 -06:00
Peter Collins af7c12c7cd
Bump to xamarin/monodroid@66a65e3b3e (#8604)
Changes: 44b5ccb0ae...66a65e3b3e
2024-01-09 13:56:11 -08:00
Peter Collins 15ebf497fa
[Mono.Android] Remove Mono_UnhandledException lookup (#8618)
We can simplify `JNIEnv.PropagateUncaughtException` by removing the
fallback case that would attempt to look for
`System.Diagnostics.Debugger.Mono_UnhandledException`.  In .NET the
`MonodroidRuntime::monodroid_debugger_unhandled_exception` function will
always be defined, and `Mono_UnhandledException` appears to no longer
exist in .NET.  This simplification should also appease our latest set
of API scan results that were complaining about missing documentation
for `Mono_UnhandledException`.
2024-01-09 13:50:49 -08:00
Jonathan Peppers e7d97ee8a5
[Xamarin.Android.Build.Tasks] `<LinkAssembliesNoShrink/>` skips symbols (#8571)
Context: https://github.com/xamarin/xamarin-android/issues/8421

Reviewing the build log from:

    dotnet new maui
    dotnet build -f net8.0-android -bl

I noticed:

    LinkAssembliesNoShrink 3.410s
    ...
    Failed to read 'C:\Program Files\dotnet\packs\Microsoft.Android.Runtime.34.android-arm64\34.0.52\runtimes\android-arm64\lib\net8.0\Mono.Android.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'C:\Program Files\dotnet\packs\Microsoft.Android.Runtime.34.android-arm64\34.0.52\runtimes\android-arm64\lib\net8.0\Java.Interop.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\microsoft.maui.controls.compatibility\8.0.3\lib\net8.0-android34.0\Microsoft.Maui.Controls.Compatibility.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\microsoft.maui.controls.core\8.0.3\lib\net8.0-android34.0\Microsoft.Maui.Controls.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\microsoft.maui.core\8.0.3\lib\net8.0-android34.0\Microsoft.Maui.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.appcompat\1.6.1.3\lib\net6.0-android31.0\Xamarin.AndroidX.AppCompat.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.fragment\1.6.0.1\lib\net6.0-android31.0\Xamarin.AndroidX.Fragment.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.drawerlayout\1.2.0.3\lib\net6.0-android31.0\Xamarin.AndroidX.DrawerLayout.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.activity\1.7.2.1\lib\net6.0-android31.0\Xamarin.AndroidX.Activity.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.core\1.10.1.2\lib\net6.0-android31.0\Xamarin.AndroidX.Core.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.recyclerview\1.3.0.3\lib\net6.0-android31.0\Xamarin.AndroidX.RecyclerView.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.viewpager\1.0.0.19\lib\net6.0-android31.0\Xamarin.AndroidX.ViewPager.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.swiperefreshlayout\1.1.0.14\lib\net6.0-android31.0\Xamarin.AndroidX.SwipeRefreshLayout.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.cardview\1.0.0.21\lib\net6.0-android31.0\Xamarin.AndroidX.CardView.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.google.android.material\1.9.0.2\lib\net6.0-android31.0\Xamarin.Google.Android.Material.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.viewpager2\1.0.0.21\lib\net6.0-android31.0\Xamarin.AndroidX.ViewPager2.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.coordinatorlayout\1.2.0.7\lib\net6.0-android31.0\Xamarin.AndroidX.CoordinatorLayout.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\microsoft.maui.graphics\8.0.3\lib\net8.0-android34.0\Microsoft.Maui.Graphics.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.navigation.fragment\2.6.0.1\lib\net6.0-android31.0\Xamarin.AndroidX.Navigation.Fragment.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\microsoft.maui.essentials\8.0.3\lib\net8.0-android34.0\Microsoft.Maui.Essentials.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.collection\1.2.0.9\lib\net6.0-android31.0\Xamarin.AndroidX.Collection.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.vectordrawable.animated\1.1.0.19\lib\net6.0-android31.0\Xamarin.AndroidX.VectorDrawable.Animated.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.lifecycle.common\2.6.1.3\lib\net6.0-android31.0\Xamarin.AndroidX.Lifecycle.Common.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.lifecycle.viewmodel\2.6.1.3\lib\net6.0-android31.0\Xamarin.AndroidX.Lifecycle.ViewModel.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.savedstate\1.2.1.3\lib\net6.0-android31.0\Xamarin.AndroidX.SavedState.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.activity.ktx\1.7.2.1\lib\net6.0-android31.0\Xamarin.AndroidX.Activity.Ktx.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.annotation.experimental\1.3.1.1\lib\net6.0-android31.0\Xamarin.AndroidX.Annotation.Experimental.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.annotation.jvm\1.6.0.2\lib\net6.0-android31.0\Xamarin.AndroidX.Annotation.Jvm.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.appcompat.appcompatresources\1.6.1.3\lib\net6.0-android31.0\Xamarin.AndroidX.AppCompat.AppCompatResources.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.arch.core.common\2.2.0.3\lib\net6.0-android31.0\Xamarin.AndroidX.Arch.Core.Common.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.arch.core.runtime\2.2.0.3\lib\net6.0-android31.0\Xamarin.AndroidX.Arch.Core.Runtime.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.browser\1.5.0.3\lib\net6.0-android31.0\Xamarin.AndroidX.Browser.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.collection.ktx\1.2.0.9\lib\net6.0-android31.0\Xamarin.AndroidX.Collection.Ktx.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.concurrent.futures\1.1.0.14\lib\net6.0-android31.0\Xamarin.AndroidX.Concurrent.Futures.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.constraintlayout\2.1.4.6\lib\net6.0-android31.0\Xamarin.AndroidX.ConstraintLayout.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.constraintlayout.core\1.0.4.6\lib\net6.0-android31.0\Xamarin.AndroidX.ConstraintLayout.Core.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.versionedparcelable\1.1.1.19\lib\net6.0-android31.0\Xamarin.AndroidX.VersionedParcelable.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.core.core.ktx\1.10.1.2\lib\net6.0-android31.0\Xamarin.AndroidX.Core.Core.Ktx.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.cursoradapter\1.0.0.19\lib\net6.0-android31.0\Xamarin.AndroidX.CursorAdapter.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.customview\1.1.0.18\lib\net6.0-android31.0\Xamarin.AndroidX.CustomView.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.customview.poolingcontainer\1.0.0.5\lib\net6.0-android31.0\Xamarin.AndroidX.CustomView.PoolingContainer.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.documentfile\1.0.1.19\lib\net6.0-android31.0\Xamarin.AndroidX.DocumentFile.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.dynamicanimation\1.0.0.19\lib\net6.0-android31.0\Xamarin.AndroidX.DynamicAnimation.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.emoji2\1.3.0.3\lib\net6.0-android31.0\Xamarin.AndroidX.Emoji2.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.startup.startupruntime\1.1.1.7\lib\net6.0-android31.0\Xamarin.AndroidX.Startup.StartupRuntime.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.emoji2.viewshelper\1.3.0.3\lib\net6.0-android31.0\Xamarin.AndroidX.Emoji2.ViewsHelper.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.exifinterface\1.3.6.2\lib\net6.0-android31.0\Xamarin.AndroidX.ExifInterface.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.fragment.ktx\1.6.0.1\lib\net6.0-android31.0\Xamarin.AndroidX.Fragment.Ktx.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.interpolator\1.0.0.19\lib\net6.0-android31.0\Xamarin.AndroidX.Interpolator.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.legacy.support.core.utils\1.0.0.19\lib\net6.0-android31.0\Xamarin.AndroidX.Legacy.Support.Core.Utils.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.lifecycle.livedata\2.6.1.3\lib\net6.0-android31.0\Xamarin.AndroidX.Lifecycle.LiveData.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.lifecycle.livedata.core\2.6.1.3\lib\net6.0-android31.0\Xamarin.AndroidX.Lifecycle.LiveData.Core.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.lifecycle.livedata.core.ktx\2.6.1.3\lib\net6.0-android31.0\Xamarin.AndroidX.Lifecycle.LiveData.Core.Ktx.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.lifecycle.process\2.6.1.3\lib\net6.0-android31.0\Xamarin.AndroidX.Lifecycle.Process.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.lifecycle.runtime\2.6.1.3\lib\net6.0-android31.0\Xamarin.AndroidX.Lifecycle.Runtime.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.lifecycle.runtime.ktx\2.6.1.3\lib\net6.0-android31.0\Xamarin.AndroidX.Lifecycle.Runtime.Ktx.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.lifecycle.viewmodel.ktx\2.6.1.3\lib\net6.0-android31.0\Xamarin.AndroidX.Lifecycle.ViewModel.Ktx.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.lifecycle.viewmodelsavedstate\2.6.1.3\lib\net6.0-android31.0\Xamarin.AndroidX.Lifecycle.ViewModelSavedState.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.loader\1.1.0.19\lib\net6.0-android31.0\Xamarin.AndroidX.Loader.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.localbroadcastmanager\1.1.0.7\lib\net6.0-android31.0\Xamarin.AndroidX.LocalBroadcastManager.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.navigation.common\2.6.0.1\lib\net6.0-android31.0\Xamarin.AndroidX.Navigation.Common.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.navigation.runtime\2.6.0.1\lib\net6.0-android31.0\Xamarin.AndroidX.Navigation.Runtime.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.navigation.ui\2.6.0.1\lib\net6.0-android31.0\Xamarin.AndroidX.Navigation.UI.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.print\1.0.0.19\lib\net6.0-android31.0\Xamarin.AndroidX.Print.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.profileinstaller.profileinstaller\1.3.1.2\lib\net6.0-android31.0\Xamarin.AndroidX.ProfileInstaller.ProfileInstaller.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.resourceinspection.annotation\1.0.1.7\lib\net6.0-android31.0\Xamarin.AndroidX.ResourceInspection.Annotation.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.savedstate.savedstate.ktx\1.2.1.3\lib\net6.0-android31.0\Xamarin.AndroidX.SavedState.SavedState.Ktx.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.security.securitycrypto\1.1.0.1-alpha06\lib\net6.0-android31.0\Xamarin.AndroidX.Security.SecurityCrypto.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.slidingpanelayout\1.2.0.7\lib\net6.0-android31.0\Xamarin.AndroidX.SlidingPaneLayout.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.tracing.tracing\1.1.0.6\lib\net6.0-android31.0\Xamarin.AndroidX.Tracing.Tracing.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.transition\1.4.1.12\lib\net6.0-android31.0\Xamarin.AndroidX.Transition.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.vectordrawable\1.1.0.19\lib\net6.0-android31.0\Xamarin.AndroidX.VectorDrawable.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.window\1.1.0.1\lib\net6.0-android31.0\Xamarin.AndroidX.Window.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.
    Failed to read 'D:\.nuget\packages\xamarin.androidx.window.extensions.core.core\1.0.0.1\lib\net6.0-android31.0\Xamarin.AndroidX.Window.Extensions.Core.Core.dll' with debugging symbols. Retrying to load it without it. Error details are logged below.

In general, it doesn't feel like we need `Mono.Cecil` to load symbols at
all for this task. That feels like it would be useful for `Release` mode
that is doing *real* trimming, but not in debug mode. Generally, we don't
think anyone will be debugging the assemblies changed in this
`<LinkAssembliesNoShrink/>` task. They would likely be old, precompiled
assemblies from NuGet if they need to be fixed up.

Some other issues were discovered here, addressing in:

https://github.com/xamarin/java.interop/pull/1176

I disabled symbol loading in this task, but left a private
`$(_AndroidLinkAssembliesReadSymbols)` as an escape hatch if this is
ever needed.

This should avoid 74 exceptions that were try-catch'd in the build log.
2024-01-09 09:45:00 -06:00
Jonathan Peppers a2472a1b03
[tests] fix `MAUI Integration` lane (#8614)
* [build] use `dotnet/maui/net9.0` branch

The `MAUI Integration` test lane is currently failing with:

    Unhandled exception: Microsoft.NET.Sdk.WorkloadManifestReader.WorkloadManifestCompositionException: Could not find workload 'microsoft-net-runtime-android-net8' extended by workload 'android' in manifest 'microsoft.net.sdk.android' [C:\a\_work\1\s\maui\bin\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.android\WorkloadManifest.json]
        at Microsoft.NET.Sdk.WorkloadManifestReader.WorkloadResolver.<>c__DisplayClass26_0.<<EnumerateWorkloadWithExtends>g__EnumerateWorkloadWithExtendsRec|0>d.MoveNext()
        at System.Linq.Enumerable.AppendPrependIterator`1.LoadFromEnumerator()
        at System.Linq.Enumerable.AppendPrepend1Iterator`1.MoveNext()
        at System.Linq.Enumerable.All[TSource](IEnumerable`1 source, Func`2 predicate)
        at Microsoft.NET.Sdk.WorkloadManifestReader.WorkloadResolver.GetAvailableWorkloadDefinitions()+MoveNext()
        at System.Linq.Enumerable.SelectEnumerableIterator`2.MoveNext()
        at System.Linq.Enumerable.Contains[TSource](IEnumerable`1 source, TSource value, IEqualityComparer`1 comparer)
        at Microsoft.DotNet.Workloads.Workload.Install.WorkloadInstallCommand.ValidateWorkloadIdsInput()
        at Microsoft.DotNet.Workloads.Workload.Install.WorkloadInstallCommand..ctor(ParseResult parseResult, IReporter reporter, IWorkloadResolverFactory workloadResolverFactory, IInstaller workloadInstaller, INuGetPackageDownloader nugetPackageDownloader, IWorkloadManifestUpdater workloadManifestUpdater, String tempDirPath, IReadOnlyCollection`1 workloadIds)
        at Microsoft.DotNet.Cli.WorkloadInstallCommandParser.<>c.<ConstructCommand>b__6_0(ParseResult parseResult)
        at System.CommandLine.Invocation.InvocationPipeline.Invoke(ParseResult parseResult)
        at Microsoft.DotNet.Cli.Program.ProcessArgs(String[] args, TimeSpan startupTime, ITelemetry telemetryClient)
    C:\a\_work\1\s\maui\src\DotNet\DotNet.csproj(198,5): error MSB3073: The command ""C:\a\_work\1\s\maui\bin/dotnet/dotnet" workload install android --skip-sign-check --skip-manifest-update --verbosity diag --temp-dir "C:\a\_work\1\s\maui\bin/temp/" --configfile "C:\a\_work\1\s\maui\NuGet.config"" exited with code 1.

This is likely just due to the fact that it's using the
`dotnet/maui/net8.0` branch. Switching to the proper
branch fixes things.

* [build] patch `$(TargetFrameworks)` in MAUI project template

To avoid failure during `restore`:

    error NETSDK1139: The target platform identifier ios was not recognized.

We update `<TargetFrameworks>` to only contain the Android target.

We think that updating the baseline manifests for the .NET 9 SDK might 
have also fixed the iOS restore failure:

https://github.com/dotnet/installer/pull/18109

But for now, it should be simpler and more reliable to build Android-only.
2024-01-04 16:47:29 -06:00
Jonathan Peppers 9a43ea0f9e
[xaprepare] use `$(XAPackagesDir)` for NuGet folder (#8613)
After returning from the holidays, xamarin-android failed to build
(`-t:Prepare`) with:

    Step Xamarin.Android.Prepare.Step_InstallDotNetPreview failed: 7zip executable 'D:\7-zip.commandline\18.1.0\tools\x64\7za.exe' not found
    System.InvalidOperationException: Step Xamarin.Android.Prepare.Step_InstallDotNetPreview failed: 7zip executable 'D:\7-zip.commandline\18.1.0\tools\x64\7za.exe' not found
    ---> System.InvalidOperationException: 7zip executable 'D:\7-zip.commandline\18.1.0\tools\x64\7za.exe' not found
        at Xamarin.Android.Prepare.ToolRunner..ctor(Context context, Log log, String toolPath) in D:\src\xamarin-android\build-tools\xaprepare\xaprepare\ToolRunners\ToolRunner.cs:line 57
        at Xamarin.Android.Prepare.SevenZipRunner..ctor(Context context, Log log, String toolPath) in D:\src\xamarin-android\build-tools\xaprepare\xaprepare\ToolRunners\SevenZipRunner.cs:line 19
        at Xamarin.Android.Prepare.Utilities.Unpack(String fullArchivePath, String destinationDirectory, Boolean cleanDestinatioBeforeUnpacking) in D:\src\xamarin-android\build-tools\xaprepare\xaprepare\Application\Utilities.cs:line 142
        at Xamarin.Android.Prepare.Step_InstallDotNetPreview.InstallDotNetAsync(Context context, String dotnetPath, String version, Boolean runtimeOnly) in D:\src\xamarin-android\build-tools\xaprepare\xaprepare\Steps\Step_InstallDotNetPreview.cs:line 250
        at Xamarin.Android.Prepare.Step_InstallDotNetPreview.Execute(Context context) in D:\src\xamarin-android\build-tools\xaprepare\xaprepare\Steps\Step_InstallDotNetPreview.cs:line 24
        at Xamarin.Android.Prepare.Step.Run(Context context) in D:\src\xamarin-android\build-tools\xaprepare\xaprepare\Application\Step.cs:line 42
        at Xamarin.Android.Prepare.Scenario.Run(Context context, Log log) in D:\src\xamarin-android\build-tools\xaprepare\xaprepare\Application\Scenario.cs:line 37
        --- End of inner exception stack trace ---
        at Xamarin.Android.Prepare.Scenario.Run(Context context, Log log) in D:\src\xamarin-android\build-tools\xaprepare\xaprepare\Application\Scenario.cs:line 48
        at Xamarin.Android.Prepare.Context.Execute() in D:\src\xamarin-android\build-tools\xaprepare\xaprepare\Application\Context.cs:line 511
        at Xamarin.Android.Prepare.App.Run(String[] args) in D:\src\xamarin-android\build-tools\xaprepare\xaprepare\Main.cs:line 162

I am using `%NUGET_PACKAGES%` on my local machine to point to a DevDrive
at `D:\.nuget\packages\`, for some reason this is breaking the build?

Previously we were using logic such as:

    return Path.GetFullPath (
        Path.Combine (
            ctx.Properties.GetRequiredValue (KnownProperties.PkgXamarin_LibZipSharp),
            "..",
            ".."
        )
    );

Instead of using `$(PkgXamarin_LibZipSharp)`, let's use
`$(XAPackagesDir)` as logic in `Configuration.props` was added in
66a0389e to consider `%NUGET_PACKAGES%`.
2024-01-04 08:16:23 -06:00
Peter Collins a10aa383cb
Add ApiScan to nightly build (#8605)
Context: https://devdiv.visualstudio.com/DevDiv/_wiki/wikis/DevDiv.wiki/25351/APIScan-step-by-step-guide-to-setting-up-a-Pipeline

The ApiScan task has been added to the nightly build and test run.  This
task should help us identify related issues earlier, rather than having
to wait for a full scan of VS.  The task can take a long time to execute
so it has been added to the nightly job rather than the PR or CI jobs.
2024-01-03 12:00:02 -08:00
dotnet-maestro[bot] 0356ba6f08
Bump to dotnet/installer/main@29db8a1157 9.0.100-alpha.1.23628.5 (#8611)
Changes: e08874da58...29db8a1157
Changes: 0cf461b302...8121f82d7d

Updates:

* Microsoft.Dotnet.Sdk.Internal: from 9.0.100-alpha.1.23625.1 to 9.0.100-alpha.1.23628.5
* Microsoft.NETCore.App.Ref: from 9.0.0-alpha.1.23621.6 to 9.0.0-alpha.1.23627.5
* Microsoft.NET.ILLink.Tasks: from 9.0.0-alpha.1.23621.6 to 9.0.0-alpha.1.23627.5
2024-01-03 08:30:23 -06:00
Šimon Rozsíval dc9c9786bc
[Mono.Android] Fix ServerCertificateCustomValidator (#8594)
Fixes: https://github.com/dotnet/runtime/issues/95506

In Release configuration the `X509ExtendedTrustManagerInvoker` class is trimmed and so 
the `trustManager is IX509TrustManager tm` pattern matching doesn't work. 

This PR addresses the problem in two ways:

    * an internal X509 trust manager is now required - it can't silently work with a null 
       internal trust manager anymore
    * `[DynamicDependency]` attribute to prevent trimming of the invoker classes for 
       the `IX509TrustManager` interface and for the `X509ExtendedTrustManager` 
       abstract class
2024-01-03 10:42:57 +00:00
dotnet-maestro[bot] 45e7cb9e39
Bump to dotnet/installer@e08874da58 9.0.100-alpha.1.23625.1
Changes: fae23c6571...e08874da58
Changes: 09536ba2fd...0cf461b302
Changes: 487a0a43db...13ad0749b9
Changes: 758bd2af13...02026e5c1b

Updates:

 * Microsoft.Dotnet.Sdk.Internal: from 9.0.100-alpha.1.23618.2 to 9.0.100-alpha.1.23625.1
 * Microsoft.NETCore.App.Ref: from 9.0.0-alpha.1.23615.12 to 9.0.0-alpha.1.23621.6
 * Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport: from 9.0.0-alpha.1.23613.1 to 9.0.0-alpha.1.23617.2
 * Microsoft.NET.ILLink.Tasks: from 9.0.0-alpha.1.23615.12 to 9.0.0-alpha.1.23621.6
 * Microsoft.DotNet.Cecil: from 0.11.4-alpha.23612.4 to 0.11.4-alpha.23617.1

Co-authored-by: dotnet-maestro[bot] <dotnet-maestro[bot]@users.noreply.github.com>
2023-12-27 10:00:00 -08:00
dotnet-maestro[bot] be8314b0b7
Bump to dotnet/installer@fae23c6571 9.0.100-alpha.1.23618.2
Changes: 26001f1c39...fae23c6571
Changes: a26802aa57...09536ba2fd
Changes: 74e4868be8...487a0a43db
Changes: 45dd3a73dd...758bd2af13

Updates:

  * Microsoft.Dotnet.Sdk.Internal: from 9.0.100-alpha.1.23610.1 to 9.0.100-alpha.1.23618.2
  * Microsoft.NETCore.App.Ref: from 9.0.0-alpha.1.23577.7 to 9.0.0-alpha.1.23615.12
  * Microsoft.NET.Workload.Emscripten.Current.Manifest-9.0.100.Transport: from 9.0.0-alpha.1.23572.3 to 9.0.0-alpha.1.23613.1
  * Microsoft.NET.ILLink.Tasks: from 9.0.0-alpha.1.23577.7 to 9.0.0-alpha.1.23615.12
  * Microsoft.DotNet.Cecil: from 0.11.4-alpha.23509.2 to 0.11.4-alpha.23612.4
2023-12-18 15:54:50 -07:00
VS MobileTools Engineering Service 2 54add047c2
Localized file check-in by OneLocBuild Task (#8589)
Context: https://aka.ms/onelocbuild
Context: https://aka.ms/AllAboutLoc

Build definition ID 17928: Build ID 8805099
2023-12-13 14:58:29 -06:00
Jonathan Peppers 27ab3f8509
[tests] enable Xamarin.Android.LibraryProjectZip-LibBinding test (#8588)
Fixes: https://github.com/xamarin/xamarin-android/issues/7794

* Port `Xamarin.Android.LibraryProjectZip-LibBinding.csproj` to .NET 9.

* Update to a more recent gradle version, I chose the one MAUI is using:

3c7b65264d/src/Core/AndroidNative/build.gradle (L8)

* Use `mavenCentral()` instead of `jcenter()` as the latter is deprecated.

* Fix `Outputs` by running `<Touch Files="$(OutputPath)JavaLib.aar" />`

This enables the last few tests in #7794.
2023-12-13 08:44:36 -06:00
Jonathan Peppers d51ffcac7b
[tests] enable FixJavaAbstractMethod tests (#8582)
Context: https://github.com/xamarin/xamarin-android/issues/7794

This ports the following projects to .NET 9 (for main):

* `Xamarin.Android.FixJavaAbstractMethod-APIv1Binding.csproj`
* `Xamarin.Android.FixJavaAbstractMethod-APIv2Binding.csproj`
* `Xamarin.Android.FixJavaAbstractMethod-Library.csproj`

Which allows us to enable `JavaAbstractMethodTest` in
`Xamarin.Android.JcwGen-Tests/BindingTests.cs`

One difference in the test appears to be System.Reflection, I am unable
to retrieve an explicit interface method via:

    var mi = ic.GetType ().GetMethod ("MethodWithCursor");

Instead, I had to do:

    var mi = ic.GetType ().GetMethod ("global::Test.Bindings.ICursor.MethodWithCursor", BindingFlags.Instance | BindingFlags.NonPublic);

This seems be a difference between Mono/Xamarin.Android and .NET 6+.

I also added a new assertion to make it easier to understand if this method
was not found.

Note this doesn't fully finish #7794 as there is still a test + more
test projects to port.
2023-12-12 12:47:32 -06:00
CSIGS@microsoft.com 8483d07202
LEGO: Merge pull request 8587
LEGO: Merge pull request 8587
2023-12-12 03:35:59 -08:00