Skip to content

[Xamarin.Android.Build.Tasks] @(AndroidLibrary) for all project types#5372

Merged
jonpryor merged 1 commit intodotnet:masterfrom
jonathanpeppers:dotnet-availableitemnames
Dec 9, 2020
Merged

[Xamarin.Android.Build.Tasks] @(AndroidLibrary) for all project types#5372
jonpryor merged 1 commit intodotnet:masterfrom
jonathanpeppers:dotnet-availableitemnames

Conversation

@jonathanpeppers
Copy link
Copy Markdown
Member

@jonathanpeppers jonathanpeppers commented Dec 4, 2020

Fixes: #5357

The new @(AndroidLibrary) item group can now be used in "legacy"
Xamarin.Android:

<AndroidLibrary Include="foo.jar" />
<AndroidLibrary Include="bar.aar" />
  • Application and class library projects:
    • foo.jar maps to AndroidJavaLibrary
    • bar.aar maps to AndroidAarLibrary
  • Java binding projects:
    • foo.jar maps to EmbeddedJar
    • foo.jar maps to EmbeddedReferenceJar if Bind="false" metadata is added
    • bar.aar maps to LibraryProjectZip
  • Additionally:
    • @(AndroidNativeLibrary) now will be used for native libraries.
      You can use @(AndroidNativeLibrary) instead of
      @(EmbeddedNativeLibrary).

All @(AvailableItemNames) are now defined in a single
Xamarin.Android.AndroidItems.targets that is imported by all project
types: both legacy apps, libraries, and bindings and .NET 6.

I documented the changes to the item groups, some of which didn't have
documentation at all.

I updated a few binding tests to use @(AndroidLibrary). There are
still several more tests using the old item names.

@jonathanpeppers jonathanpeppers force-pushed the dotnet-availableitemnames branch 2 times, most recently from 8868293 to 1aa70d8 Compare December 4, 2020 22:30
@jonathanpeppers jonathanpeppers marked this pull request as ready for review December 7, 2020 17:29
@jonathanpeppers
Copy link
Copy Markdown
Member Author

The one test failure is:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(589,5): Could not find file "/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/lib/xamarin.find"
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0019e] in <fa1c70bff5424f0bbf617c0b03a3a060>:0 
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in <fa1c70bff5424f0bbf617c0b03a3a060>:0 
  at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
  at System.IO.File.OpenRead (System.String path) [0x00000] in <fa1c70bff5424f0bbf617c0b03a3a060>:0 
  at Xamarin.Android.Tasks.FastDeploy.PushFileToDevice (Mono.AndroidTools.AndroidDevice device, System.String packageName, System.String toolPath, System.String file, System.String target, System.Threading.CancellationToken token) [0x00011] in <265d9e36981e458189cb25bd3e16fa0f>:0 
  at Xamarin.Android.Tasks.FastDeploy.InstallFastDevTools (System.String toolPath) [0x00367] in <265d9e36981e458189cb25bd3e16fa0f>:0 
  at Xamarin.Android.Tasks.FastDeploy.RunTaskAsync () [0x004aa] in <265d9e36981e458189cb25bd3e16fa0f>:0  [/Users/runner/work/1/s/bin/TestRelease/temp/BuildXAMLChangeTrueTrue/MyApp/MyApp.csproj]

@dellis1972 if you want to see the .binlog: msbuild.zip

Maybe a random failure?

@dellis1972
Copy link
Copy Markdown
Contributor

The one test failure is:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.Debugging.targets(589,5): Could not find file "/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/lib/xamarin.find"
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share, System.Int32 bufferSize, System.Boolean anonymous, System.IO.FileOptions options) [0x0019e] in <fa1c70bff5424f0bbf617c0b03a3a060>:0 
  at System.IO.FileStream..ctor (System.String path, System.IO.FileMode mode, System.IO.FileAccess access, System.IO.FileShare share) [0x00000] in <fa1c70bff5424f0bbf617c0b03a3a060>:0 
  at (wrapper remoting-invoke-with-check) System.IO.FileStream..ctor(string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
  at System.IO.File.OpenRead (System.String path) [0x00000] in <fa1c70bff5424f0bbf617c0b03a3a060>:0 
  at Xamarin.Android.Tasks.FastDeploy.PushFileToDevice (Mono.AndroidTools.AndroidDevice device, System.String packageName, System.String toolPath, System.String file, System.String target, System.Threading.CancellationToken token) [0x00011] in <265d9e36981e458189cb25bd3e16fa0f>:0 
  at Xamarin.Android.Tasks.FastDeploy.InstallFastDevTools (System.String toolPath) [0x00367] in <265d9e36981e458189cb25bd3e16fa0f>:0 
  at Xamarin.Android.Tasks.FastDeploy.RunTaskAsync () [0x004aa] in <265d9e36981e458189cb25bd3e16fa0f>:0  [/Users/runner/work/1/s/bin/TestRelease/temp/BuildXAMLChangeTrueTrue/MyApp/MyApp.csproj]

@dellis1972 if you want to see the .binlog: msbuild.zip

Maybe a random failure?

Related to https://github.com/xamarin/monodroid/pull/1139/files#diff-7852ba3521b112c065b28e7d98b1b05843c2215fc0e28300264bcdb7bf311780R136 . The _PrimaryCpuAbi was empty (for some reason).

@dellis1972
Copy link
Copy Markdown
Contributor

The problem is in GetPrimaryCpuAbi see https://gist.github.com/dellis1972/057ba1109ce89ee94b5f6f031a99b8fe. Looks like the format of the "dump" command changed.

@dellis1972
Copy link
Copy Markdown
Contributor

ok looks like the main issue here is

DUMP OF SERVICE batterystats:
  Unknown package: UnnamedProject.UnnamedProject

we probably need to use a different package like com.android.inputdevices which seems to return the primaryCpu data we need.

Comment thread Documentation/guides/building-apps/build-items.md Outdated

## EmbeddedReferenceJar

In a Xamarin.Android binding project, the **EmbeddedReferenceJar**
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto here, etc., etc. We can link to build properties & item group docs now! Let's use it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did this everywhere now, except for when they refer to themselves.

Comment thread Documentation/guides/building-apps/build-items.md Outdated
@jonathanpeppers jonathanpeppers force-pushed the dotnet-availableitemnames branch from 1aa70d8 to f12dbce Compare December 8, 2020 17:14
Fixes: dotnet#5357

The new `@(AndroidLibrary)` item group can now be used in "legacy"
Xamarin.Android:

    <AndroidLibrary Include="foo.jar" />
    <AndroidLibrary Include="bar.aar" />

* Application and class library projects:
  * `foo.jar` maps to `AndroidJavaLibrary`
  * `bar.aar` maps to `AndroidAarLibrary`
* Java binding projects:
  * `foo.jar` maps to `EmbeddedJar`
  * `foo.jar` maps to `EmbeddedReferenceJar` if `Bind="false"` metadata is added
  * `bar.aar` maps to `LibraryProjectZip`
* Additionally:
  * `@(AndroidNativeLibrary)` now will be used for native libraries.
    You can use `@(AndroidNativeLibrary)` instead of
    `@(EmbeddedNativeLibrary)`.

All `@(AvailableItemNames)` are now defined in a single
`Xamarin.Android.AndroidItems.targets` that is imported by all project
types: both legacy apps, libraries, and bindings and .NET 6.

I documented the changes to the item groups, some of which didn't have
documentation at all.

I updated a few binding tests to use `@(AndroidLibrary)`. There are
still several more tests using the old item names.
@jonathanpeppers jonathanpeppers force-pushed the dotnet-availableitemnames branch from f12dbce to 8cca282 Compare December 9, 2020 14:24
@jonpryor jonpryor merged commit 97190b6 into dotnet:master Dec 9, 2020
@jonathanpeppers jonathanpeppers deleted the dotnet-availableitemnames branch December 9, 2020 17:18
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 26, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consolidate @(AndroidLibrary) item groups for .NET 6

3 participants