-
Notifications
You must be signed in to change notification settings - Fork 531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Xamarin.Android,Build.Tasks] Library .aar includes $(AndroidManifest) (#8273) #8273
Conversation
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildWithLibraryTests.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall looks good, just had the one thought/comment. 👍
...id.Build.Tasks/Microsoft.Android.Sdk/targets/Microsoft.Android.Sdk.DefaultProperties.targets
Outdated
Show resolved
Hide resolved
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
482bcf4
to
9aeab85
Compare
@@ -83,8 +83,6 @@ | |||
<!-- Prefer $(RuntimeIdentifiers) plural --> | |||
<RuntimeIdentifiers Condition=" '$(RuntimeIdentifier)' == '' And '$(RuntimeIdentifiers)' == '' ">android-arm;android-arm64;android-x86;android-x64</RuntimeIdentifiers> | |||
<RuntimeIdentifier Condition=" '$(RuntimeIdentifiers)' != '' And '$(RuntimeIdentifier)' != '' " /> | |||
<AndroidManifest Condition=" '$(AndroidManifest)' == '' and Exists ('Properties\AndroidManifest.xml') and !Exists ('AndroidManifest.xml') ">Properties\AndroidManifest.xml</AndroidManifest> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the rationale for moving these properties?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There were in an Application Only Property Block, but we need them to be calculated in both apps and library projects. Which is why there were moved.
Draft commit message: [Xamarin.Android,Build.Tasks] Library .aar includes $(AndroidManifest) (#8273)
Fixes: https://github.com/xamarin/xamarin-android/issues/8262
Context: https://developer.android.com/studio/projects/android-library#aar-contents
Context: fcd7cf8f4200ccae92e333c920613bfec260973b
In fcd7cf8f, we stopped using `@(EmbeddedResource)` within assemblies
to contain Android Resource, Assets, Libraries, etc., and instead
began a `.aar` file.
One of the things never supported in the Classic system was to allow
Library projects to contain `AndroidManifest.xml` files, and package
`AndroidManifest.xml` files into the library `.aar` file for inclusion
in NuGet packages.
Add `$(AndroidManifest)` to `@(_CreateAarInputs)`, so that Library
projects can now specify an `AndroidManifest.xml` file for inclusion
in the library `.aar` file (which in turn should be included in NuGet
packages).
This allows NuGet authors to e.g. set default permissions if need be
by simply adding `AndroidManifest.xml` to the library project dir.
Also, fix an issue in `<GenerateLibraryResources/>` when a manifest
file does NOT have a package name. Such files should be ignored. |
@dellis1972: do we have any idea what, if anything, this will do when done broadly? On the one hand,
On the other hand, this is still A Change, and I find it hard to know if this could possibly break anything. For example, if someone starts with an App project ( Said "app now library" project will contain an What happens if an app starts getting multiple copies of our default I'm wary of including a change this close to release when I can't foresee how it will impact the ecosystem. |
ccb1ebe
to
27ed00a
Compare
|
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
@@ -87,6 +95,7 @@ public void DotNetBuildLibrary (bool isRelease, bool duplicateAar, bool useDesig | |||
using (var aar = ZipHelper.OpenZip (aarPath)) { | |||
aar.AssertContainsEntry (aarPath, "assets/bar/bar.txt"); | |||
aar.AssertEntryEquals (aarPath, "proguard.txt", "# LibraryC"); | |||
aar.AssertContainsEntry (aarPath, "AndroidManifest.xml"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also assert that the final app contains the <queries/>
element from libC
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is checked later on in the test when the appliction is built.
0642581
to
9603f69
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, I just had some minor comments. 👍
…from class library Fixes dotnet#8262 So if a user wants to distribute an AndroidManifest.xml file along with a NuGet the file is currently NOT included in the library .aar file. So lets include it if one is present. This will allow NuGet authors to set default permissions if need be by simply adding the file to the project directory. This also fixes an issue in GenerateLibraryResources where if a manifest file does NOT have a package name.
eb3319c
to
1b84eb0
Compare
) Fixes: #8262 Context: https://developer.android.com/studio/projects/android-library#aar-contents Context: fcd7cf8 In fcd7cf8, we stopped using `@(EmbeddedResource)` within assemblies to contain Android Resource, Assets, Libraries, etc., and instead began using a `.aar` file. One of the things never supported in the Classic system was to allow Library projects to contain `AndroidManifest.xml` files, and package `AndroidManifest.xml` files into the library `.aar` file for inclusion in NuGet packages. Add `$(AndroidManifest)` to `@(_CreateAarInputs)`, so that Library projects can now include an `AndroidManifest.xml` file for inclusion in the library `.aar` file (which in turn should be included in NuGet packages). This allows NuGet authors to e.g. set default permissions if need be by simply adding `AndroidManifest.xml` to the library project dir. Also, fix an issue in `<GenerateLibraryResources/>` when a manifest file does NOT have a package name. Such files should be ignored.
Fixes: #8262
Context: https://developer.android.com/studio/projects/android-library#aar-contents
Context: fcd7cf8
In fcd7cf8, we stopped using
@(EmbeddedResource)
within assembliesto contain Android Resource, Assets, Libraries, etc., and instead
began a
.aar
file.One of the things never supported in the Classic system was to allow
Library projects to contain
AndroidManifest.xml
files, and packageAndroidManifest.xml
files into the library.aar
file for inclusionin NuGet packages.
Add
$(AndroidManifest)
to@(_CreateAarInputs)
, so that Libraryprojects can now specify an
AndroidManifest.xml
file for inclusionin the library
.aar
file (which in turn should be included in NuGetpackages).
This allows NuGet authors to e.g. set default permissions if need be
by simply adding
AndroidManifest.xml
to the library project dir.Also, fix an issue in
<GenerateLibraryResources/>
when a manifestfile does NOT have a package name. Such files should be ignored.