-
Notifications
You must be signed in to change notification settings - Fork 569
[Xamarin.Android.Build.Tasks] @(AndroidLibrary) for all project types #5372
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
Merged
jonpryor
merged 1 commit into
dotnet:master
from
jonathanpeppers:dotnet-availableitemnames
Dec 9, 2020
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| #### Application and library build and deployment | ||
|
|
||
| * [GitHub PR 5372](https://github.com/xamarin/xamarin-android/pull/5372): | ||
| Introduces the **AndroidLibrary** Build Action for Java or Kotlin libraries. | ||
|
|
||
| **AndroidLibrary** is a new Build Action can be used as an alternative | ||
| to **AndroidAarLibrary**, **AndroidJavaLibrary**, **EmbeddedJar**, | ||
| **EmbeddedReferenceJar**, and **LibraryProjectZip**. | ||
|
|
||
| For example, in an Android application or class library project: | ||
|
|
||
| ```xml | ||
| <Project> | ||
| <ItemGroup> | ||
| <!-- If the project was using: --> | ||
| <AndroidAarLibrary Include="foo.aar" /> | ||
| <AndroidJavaLibrary Include="bar.jar" /> | ||
| <!-- It can now be replaced with: --> | ||
| <AndroidLibrary Include="foo.aar" /> | ||
| <AndroidLibrary Include="bar.jar" /> | ||
| </ItemGroup> | ||
| </Project> | ||
| ``` | ||
|
|
||
| In a Java binding project: | ||
|
|
||
| ```xml | ||
| <Project> | ||
| <ItemGroup> | ||
| <!-- If the project was using: --> | ||
| <LibraryProjectZip Include="foo.aar" /> | ||
| <EmbeddedJar Include="bar.jar" /> | ||
| <EmbeddedReferenceJar Include="dependency.jar" /> | ||
| <!-- It can now be replaced with: --> | ||
| <AndroidLibrary Include="foo.aar" /> | ||
| <AndroidLibrary Include="bar.jar" /> | ||
| <AndroidLibrary Include="dependency.jar" Bind="false" /> | ||
| </ItemGroup> | ||
| </Project> | ||
| ``` | ||
|
|
||
| Using the **AndroidLibrary** Build Action is optional, as the old item | ||
| names are still supported. | ||
|
|
||
| The **AndroidNativeLibrary** Build Action will continue to be used for | ||
| native libraries (`.so` files). However one improvement has been | ||
| introduced for Xamarin.Android class library or Java binding projects: | ||
|
|
||
| ```xml | ||
| <Project> | ||
| <ItemGroup> | ||
| <!-- If the project was using: --> | ||
| <EmbeddedNativeLibrary Include="lib/armeabi-v7a/libfoo.so" /> | ||
| <!-- It can now be replaced with: --> | ||
| <AndroidNativeLibrary Include="lib/armeabi-v7a/libfoo.so" /> | ||
| </ItemGroup> | ||
| </Project> | ||
| ``` | ||
|
|
||
| The **AndroidNativeLibrary** Build Action can now be used in all | ||
| project types. It previously was only used in application projects. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
103 changes: 103 additions & 0 deletions
103
...amarin.Android.Build.Tasks/MSBuild/Xamarin/Android/Xamarin.Android.AvailableItems.targets
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| <!-- | ||
| *********************************************************************************************** | ||
| Xamarin.Android.AvailableItems.targets | ||
|
|
||
| This file is imported by every project type to setup @(AvailableItemName). | ||
| This item group populates the Build Action drop-down in IDEs. | ||
|
|
||
| *********************************************************************************************** | ||
| --> | ||
| <Project> | ||
|
|
||
| <!-- Not legacy binding projects --> | ||
| <ItemGroup Condition=" '$(_AndroidIsBindingProject)' != 'true' "> | ||
| <AvailableItemName Include="AndroidAotProfile" /> | ||
| <AvailableItemName Include="AndroidAsset" /> | ||
| <AvailableItemName Include="AndroidEnvironment" /> | ||
| <AvailableItemName Include="AndroidExternalJavaLibrary" /> | ||
| <AvailableItemName Include="AndroidInterfaceDescription" /> | ||
| <AvailableItemName Include="AndroidJavaSource" /> | ||
| <AvailableItemName Include="AndroidLibrary" /> | ||
| <AvailableItemName Include="AndroidLintConfig" /> | ||
| <AvailableItemName Include="AndroidResourceAnalysisConfig" /> | ||
| <AvailableItemName Include="AndroidNativeLibrary" /> | ||
| <AvailableItemName Include="AndroidResource" /> | ||
| <AvailableItemName Include="AndroidBoundLayout" /> | ||
| <AvailableItemName Include="LinkDescription" /> | ||
| <AvailableItemName Include="MultiDexMainDexList" /> | ||
| <AvailableItemName Include="ProguardConfiguration" /> | ||
| <AvailableItemName Include="ProjectReference" /> | ||
| <AvailableItemName Include="AndroidManifestOverlay" /> | ||
| </ItemGroup> | ||
| <!-- Legacy, non-binding projects --> | ||
| <ItemGroup Condition=" '$(_AndroidIsBindingProject)' != 'true' and '$(UsingAndroidNETSdk)' != 'true' "> | ||
| <AvailableItemName Include="AndroidAarLibrary" /> | ||
| <AvailableItemName Include="AndroidJavaLibrary" /> | ||
| </ItemGroup> | ||
| <!-- Legacy, non-application projects --> | ||
| <ItemGroup Condition=" '$(AndroidApplication)' != 'true' and '$(UsingAndroidNETSdk)' != 'true' "> | ||
| <AvailableItemName Include="EmbeddedNativeLibrary" /> | ||
| </ItemGroup> | ||
| <!-- Legacy binding projects or .NET 6 --> | ||
| <ItemGroup Condition=" '$(_AndroidIsBindingProject)' == 'true' or '$(UsingAndroidNETSdk)' == 'true' "> | ||
| <AvailableItemName Include="TransformFile" /> | ||
| <AvailableItemName Include="LibraryProjectProperties" /> | ||
| <AvailableItemName Include="JavaDocIndex" /> | ||
| <AvailableItemName Include="JavaDocJar" /> | ||
| <AvailableItemName Include="JavaSourceJar" /> | ||
| </ItemGroup> | ||
| <!-- Legacy binding projects --> | ||
| <ItemGroup Condition=" '$(_AndroidIsBindingProject)' == 'true' and '$(UsingAndroidNETSdk)' != 'true' "> | ||
| <AvailableItemName Include="EmbeddedJar" /> | ||
| <AvailableItemName Include="EmbeddedNativeLibrary" /> | ||
| <AvailableItemName Include="EmbeddedReferenceJar" /> | ||
| <AvailableItemName Include="InputJar" /> | ||
| <AvailableItemName Include="ReferenceJar" /> | ||
| <AvailableItemName Include="LibraryProjectZip" /> | ||
| </ItemGroup> | ||
|
|
||
| <!-- Default item metadata --> | ||
| <ItemDefinitionGroup> | ||
| <AndroidResource> | ||
| <SubType>Designer</SubType> | ||
| <Generator>MSBuild:UpdateGeneratedFiles</Generator> | ||
| </AndroidResource> | ||
| <AndroidLibrary> | ||
| <Bind>true</Bind> | ||
| <Pack Condition=" '$(UsingAndroidNETSdk)' == 'true' ">true</Pack> | ||
| </AndroidLibrary> | ||
| <AndroidAarLibrary> | ||
| <!-- NOTE: .aar items should skip %(AndroidSkipResourceProcessing) by default --> | ||
| <AndroidSkipResourceProcessing>true</AndroidSkipResourceProcessing> | ||
| </AndroidAarLibrary> | ||
| </ItemDefinitionGroup> | ||
|
|
||
| <!-- Convert @(AndroidLibrary) to the legacy item group names --> | ||
| <Target Name="_CategorizeAndroidLibraries"> | ||
| <!-- Applications, or legacy class libraries --> | ||
| <ItemGroup Condition=" '$(AndroidApplication)' == 'true' or ('$(_AndroidIsBindingProject)' != 'true' and '$(UsingAndroidNETSdk)' != 'true') "> | ||
| <AndroidAarLibrary Include="@(AndroidLibrary)" Condition=" '%(AndroidLibrary.Extension)' == '.aar' " /> | ||
| <AndroidJavaLibrary Include="@(AndroidLibrary)" Condition=" '%(AndroidLibrary.Extension)' == '.jar' " /> | ||
| </ItemGroup> | ||
| <!-- Any library that is not an app --> | ||
| <ItemGroup Condition=" '$(AndroidApplication)' != 'true' "> | ||
| <EmbeddedNativeLibrary Include="@(AndroidNativeLibrary)" /> | ||
| </ItemGroup> | ||
| <!-- .NET 6 class libraries--> | ||
| <ItemGroup Condition=" '$(AndroidApplication)' != 'true' and '$(UsingAndroidNETSdk)' == 'true' "> | ||
| <AndroidAarLibrary Include="@(AndroidLibrary)" Condition=" '%(AndroidLibrary.Extension)' == '.aar' and '%(AndroidLibrary.Bind)' != 'true' " /> | ||
| <LibraryProjectZip Include="@(AndroidLibrary)" Condition=" '%(AndroidLibrary.Extension)' == '.aar' and '%(AndroidLibrary.Bind)' == 'true' " /> | ||
| <AndroidJavaLibrary Include="@(AndroidLibrary)" Condition=" '%(AndroidLibrary.Extension)' == '.jar' and '%(AndroidLibrary.Bind)' != 'true' " /> | ||
| <EmbeddedJar Include="@(AndroidLibrary)" Condition=" '%(AndroidLibrary.Extension)' == '.jar' and '%(AndroidLibrary.Bind)' == 'true' " /> | ||
| <!-- .aar files should be copied to $(OutputPath) in .NET 6--> | ||
| <None Include="@(LibraryProjectZip)" CopyToOutputDirectory="PreserveNewest" Link="%(Filename)%(Extension)" /> | ||
| </ItemGroup> | ||
| <!-- Legacy binding projects --> | ||
| <ItemGroup Condition=" '$(_AndroidIsBindingProject)' == 'true' and '$(UsingAndroidNETSdk)' != 'true' "> | ||
| <LibraryProjectZip Include="@(AndroidLibrary)" Condition=" '%(AndroidLibrary.Extension)' == '.aar' and '%(AndroidLibrary.Bind)' == 'true' " /> | ||
| <EmbeddedJar Include="@(AndroidLibrary)" Condition=" '%(AndroidLibrary.Extension)' == '.jar' and '%(AndroidLibrary.Bind)' != 'true' " /> | ||
| <EmbeddedReferenceJar Include="@(AndroidLibrary)" Condition=" '%(AndroidLibrary.Extension)' == '.jar' and '%(AndroidLibrary.Bind)' == 'true' " /> | ||
| </ItemGroup> | ||
| </Target> | ||
|
|
||
| </Project> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Ditto here, etc., etc. We can link to build properties & item group docs now! Let's use it.
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.
I did this everywhere now, except for when they refer to themselves.