Skip to content

[Xamarin.Android.Build.Tasks] properly support abi delimiters - #3190

Merged
jonpryor merged 1 commit into
dotnet:masterfrom
jonathanpeppers:bizarro-delimiters
Jun 12, 2019
Merged

jonpryor merged 1 commit into
dotnet:masterfrom
jonathanpeppers:bizarro-delimiters

Conversation

@jonathanpeppers

@jonathanpeppers jonathanpeppers commented Jun 10, 2019 •

Copy link
Copy Markdown
Member

Fixes: #3175

In 6ce33aa, we broke support for , and %3b as delimiters for
$(AndroidSupportedAbis). We did not have a test checking for these
cases.

Reviewing the code, we had repetition like this throughout our
codebase:

var abis = SupportedAbis.Split (new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries);

Instead what we should do, is provide a single task that converts the
abis to an MSBuild item group to be used throughout:

<SplitProperty Value="$(AndroidSupportedAbis)">
  <Output TaskParameter="Output" ItemName="_BuildTargetAbis"/>
</SplitProperty>

Then we can consume the @(_BuildTargetAbis) item group in a simpler
way from inside MSBuild tasks:

[Required]
public string [] SupportedAbis { get; set; }

MSBuild can handle translating an item group to a string[]. We
should use that!

Other changes:

  • Removed some extra log messages in <Aot/> and
    <MakeBundleNativeCodeExternal/>
  • Moved the error checking for XA0115 in _CheckSupportedAbis to
    happen right after @(_BuildTargetAbis) is created.
  • Added tests for , and %3b

Future work:

I'll do similar cleanup for $(AndroidStoreUncompressedFileExtensions)
in another PR.

@jonpryor

Copy link
Copy Markdown
Contributor

Please review the EmbeddedDSOBuildTests failures and verify whether or not this PR is responsible.

@jonathanpeppers

Copy link
Copy Markdown
Member Author

Due to EmbeddedDSOBuildTests being MSBuild-related, I probably broke something here.

Looking into it.

Comment thread Configuration.props Outdated
<AntToolPath Condition=" '$(AntToolPath)' == '' ">$(AntDirectory)\bin</AntToolPath>
<AndroidSupportedHostJitAbis Condition=" '$(AndroidSupportedHostJitAbis)' == '' ">$(HostOS)</AndroidSupportedHostJitAbis>
<AndroidSupportedTargetJitAbis Condition=" '$(AndroidSupportedTargetJitAbis)' == '' ">armeabi-v7a:arm64-v8a:x86</AndroidSupportedTargetJitAbis>
<AndroidSupportedTargetJitAbis Condition=" '$(AndroidSupportedTargetJitAbis)' == '' ">armeabi-v7a:arm64-v8a:x86:x86_64</AndroidSupportedTargetJitAbis>

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 was getting build errors in the EmbeddedDSOTests about x86_64 stuff missing.

I am a little confused, but it seems bin\BuildDebug\XABuildConfig.cs seems to be the cause:

using System;
using System.Collections.Generic;

namespace Xamarin.Android.Tools
{
        static class XABuildConfig
        {
                public const string SupportedABIs = "armeabi-v7a;arm64-v8a;x86;x86_64";
...

There might be something else we should do instead here. Let's see if it fixes the tests on CI?

Fixes: dotnet#3175

In 6ce33aa, we broke support for `,` and `%3b` as delimiters for
`$(AndroidSupportedAbis)`. We did not have a test checking for these
cases.

Reviewing the code, we had repetition like this throughout our
codebase:

    var abis = SupportedAbis.Split (new char[] { ',', ';' }, StringSplitOptions.RemoveEmptyEntries);

Instead what we should do, is provide a single task that converts the
abis to an MSBuild item group to be used throughout:

    <SplitProperty Value="$(AndroidSupportedAbis)">
      <Output TaskParameter="Output" ItemName="_BuildTargetAbis"/>
    </SplitProperty>

Then we can consume the `@(_BuildTargetAbis)` item group in a simpler
way from inside MSBuild tasks:

    [Required]
    public string [] SupportedAbis { get; set; }

MSBuild can handle translating an item group to a `string[]`. We
should use that!

Other changes:

* Removed some extra log messages in `<Aot/>` and
  `<MakeBundleNativeCodeExternal/>`
* Moved the error checking for `XA0115` in `_CheckSupportedAbis` to
  happen right after `@(_BuildTargetAbis)` is created.
* Added tests for `,` and `%3b`

Future work:

I'll do similar clean for `$(AndroidStoreUncompressedFileExtensions)`
in another PR.
@jonpryor
jonpryor merged commit 901dba8 into dotnet:master Jun 12, 2019
@jonathanpeppers
jonathanpeppers deleted the bizarro-delimiters branch June 12, 2019 15:31
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 30, 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.

LinkApplicationSharedLibraries task fails when project defines support for multiple ABIs

3 participants