Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

First steps for generating nuget packages for ARM64/Android.#10286

Merged
gkhanna79 merged 20 commits into
dotnet:masterfrom
cydhaselton:android-nuget-pkg
Jun 8, 2017
Merged

First steps for generating nuget packages for ARM64/Android.#10286
gkhanna79 merged 20 commits into
dotnet:masterfrom
cydhaselton:android-nuget-pkg

Conversation

@cydhaselton
Copy link
Copy Markdown

Adds RIDS and related conditionals/variables to the appropriate files as part of Enabling Android/ARM64 for .NET Core (issue here).

Code appears to have been refactored since the original PR to which I was referred, cc-ing @janvorli and @qmfrederik for review in case of missed items

@cydhaselton
Copy link
Copy Markdown
Author

Also tagging @gkhanna79 for review because of #6056 and #6000

<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<SupportedPackageOSGroups>Linux;OSX</SupportedPackageOSGroups>
<SupportedPackageOSGroups>Linux;Android;OSX</SupportedPackageOSGroups>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is there a reason you are enabling this here?

CC @jkotas

Copy link
Copy Markdown
Author

@cydhaselton cydhaselton Mar 21, 2017

Choose a reason for hiding this comment

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

Because Linux and OSX were enabled here. If it's not applicable I can remove; I'm basically working from PRs (see dotnet/core-setup#1651 Porting to New Platform References) and extrapolating based on refactored code so some of the edits may not be needed. Feel free to let me know and I'll make changes

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think you can skip this file from the change.

Comment thread src/.nuget/dir.props
<RuntimeOS Condition="'$(RuntimeOS)' == ''">$(OSRid)</RuntimeOS>

<SupportedPackageOSGroups Condition="'$(SupportedPackageOSGroups)' == ''">Windows_NT;OSX;Linux</SupportedPackageOSGroups>
<SupportedPackageOSGroups Condition="'$(SupportedPackageOSGroups)' == ''">Windows_NT;OSX;Android;Linux</SupportedPackageOSGroups>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

What is the __DistroRid for Android build?

Copy link
Copy Markdown
Author

@cydhaselton cydhaselton Mar 21, 2017

Choose a reason for hiding this comment

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

android.21-arm64 and/or android.21-arm, unless there's a difference between RID as registered in CoreFX and __DistroRid?

Did some additional code parsing; will update this file with __DistroRid generation

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Was this updated?

Copy link
Copy Markdown
Author

@cydhaselton cydhaselton Mar 23, 2017

Choose a reason for hiding this comment

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

@gkhanna79 Not yet; still working out where __DistroRid originates and/or is generated and how to do so without uname or $ROOTFS_DIR/etc/os-release

Updated

@cydhaselton
Copy link
Copy Markdown
Author

@gkhanna79 The test hack I added to build.sh generates __DistroRid for Android build and, with following commits, allows package build for Android.

I've added a TODO for figuring out a reliable way to generate __DistroRid for Android. Since I generated the commit changes from the `runtime.OS.filename.props files and guesswork, a once-over to make sure I haven't missed anything would be appreciated

@cydhaselton
Copy link
Copy Markdown
Author

cc-ing @qmfrederik @mellinoe and @janvorli for additional visibility into package generation

@cydhaselton
Copy link
Copy Markdown
Author

Also copying @schellap for input

Comment thread build.sh Outdated
export __DistroRid=""
#Test hack to generate __DistroRid for Android
#TODO Find reliable way to generate __DistroRid for Android.
export __DistroRid="android.21-arm64"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Just to be clear - we cannot commit with this change. Have you considered specifying this at command (e.g. __DistroRid=... ./build.sh) and then adding a check in this function if __DistroRid is already defined or not?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@gkhanna79: I did not, but that is a good idea.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

IMHO, you need to save ANDROID_PLATFORM variable as a file when you build rootfs and then you can use it in building coreclr. :)

Copy link
Copy Markdown
Author

@cydhaselton cydhaselton Apr 1, 2017

Choose a reason for hiding this comment

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

@jyoungyun This may be better; so far I've tried every iteration of detecting __DistroRid in this function and all have failed except for ! [[ -n "$__DistroRid" ]], which is the same as hardcoding that value.

Would help if correct variable was specified at cmdline

Copy link
Copy Markdown
Author

@cydhaselton cydhaselton Apr 1, 2017

Choose a reason for hiding this comment

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

@gkhanna79 See recent commit

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

FYI, Walking back all changes to build.sh and going route @jyoungyun recommended. Too difficult getting logic check in initTargetDistroRid() to work without causing CI errors

<SupportedPackageOSGroups>Linux;OSX</SupportedPackageOSGroups>
</PropertyGroup>
</Project> No newline at end of file
</Project>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Undo change to this file.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@gkhanna79 Done

</PropertyGroup>
<ItemGroup>
<NativeBinary Include="$(BinDir)libcoreclr.so" />
<NativeBinary Condition="'$(_PlatformDoesNotSupportNiFiles)' != 'true'" Include="$(BinDir)libcoreclrtraceptprovider.so" />
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This check is incorrect. _PlatformDoesNotSupportNiFiles should be used for platforms where we cannot generate NI images right now. They just happen to be same as where this binary does not build.

If you are able to build this for Android, please fix this check accordingly so that it can be included for that platform.

FYI - @hqueue @hseok-oh @jyoungyun

Comment thread src/.nuget/dir.props Outdated
<OfficialBuildRID Include="android.21-arm64">
<Platform>arm64</Platform>
</OfficialBuildRID>
<OfficialBuildRID Include="android.21-arm">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Have you tested the build for Arm32 for Android? If so, your change for __DsitroRid should account for it as well.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I've only tested...and am only able to test...for arm64. I can add arm into this change but won't be able to test it.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

In that case, please undo the Android for Arm change.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Removed

Comment thread config.json Outdated
"description": "Specifies the OS to build Core_Root for",
"valueType": "property",
"values": [ "debian.8-x64", "fedora.23-x64", "opensuse.42.1-x64", "osx.10.12-x64", "rhel.7-x64", "ubuntu.14.04-x64", "ubuntu.16.04-x64", "ubuntu.16.10-x64" ],
"values": [ "debian.8-x64", "fedora.23-x64", "opensuse.42.1-x64", "osx.10.10-x64", "rhel.7-x64", "ubuntu.14.04-x64", "ubuntu.16.04-x64", "ubuntu.16.10-x64", "android.21-arm64", "android.21-arm" ],
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I think you need to undo osx version change.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

That's odd…don't remember making that change. Fixed

@cydhaselton
Copy link
Copy Markdown
Author

Tagging @qmfrederik to review/ok addition to build-android-rootfs.sh

@cydhaselton
Copy link
Copy Markdown
Author

General question: I'm still getting up to speed with CI builds. Is there anything I need to do with the previous commits in this PR that have failed build checks if a later commit or commits are successful?

@qmfrederik
Copy link
Copy Markdown

@cydhaselton The change to build-android-rootfs is fine with me.

Regarding to the CI builds, only the last commit matters. If the previous commits are no longer relevant, you can squash them, and they will disappear from the list of commits in this pull request.

Would it be easier to treat Android as a Linux distribution? That would avoid the need to add a new OS group.

@cydhaselton
Copy link
Copy Markdown
Author

cydhaselton commented Apr 1, 2017

@qmfrederik: Would it be easier to treat Android as a Linux distribution? That would avoid the need to add a new OS group.

I'm not sure; I'm still piecing together how nuget packages are generated. Since I don't know all of the places a) where it would be important to separate Android from Linux and b) where it wouldn't matter, I'm taking a "separate everything now, integrate with Linux after" approach.

I can comment my code to that effect if it would help.

@cydhaselton
Copy link
Copy Markdown
Author

Another (probably obvious) question: is there a way for me manually to re-run a CI build for a specific commit?

@qmfrederik
Copy link
Copy Markdown

@cydhaselton You can force the CI build to re-run, but only for the last commit in your PR.

@cydhaselton
Copy link
Copy Markdown
Author

@gkhanna79 @jyoungyun and others…any other changes/additions I should make to this PR before merge?

Comment thread build.sh Outdated
export __DistroRid="$ID.$VERSION_ID-$__BuildArch"
fi
fi
fi
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remove redundant space :)

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good catch! Fixed.

Comment thread build.sh
export __DistroRid=""
if [ -e $ROOTFS_DIR/android_platform ]; then
source $ROOTFS_DIR/android_platform
export __DistroRid="$RID"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I presume that $RID is being set by the source statement earlier,right? What is the value it gets?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nevermind - saw it further below.

Comment thread config.json Outdated
"description": "Specifies the OS to build Core_Root for",
"valueType": "property",
"values": [ "debian.8-x64", "fedora.23-x64", "opensuse.42.1-x64", "osx.10.12-x64", "rhel.7-x64", "ubuntu.14.04-x64", "ubuntu.16.04-x64", "ubuntu.16.10-x64" ],
"values": [ "debian.8-x64", "fedora.23-x64", "opensuse.42.1-x64", "osx.10.12-x64", "rhel.7-x64", "ubuntu.14.04-x64", "ubuntu.16.04-x64", "ubuntu.16.10-x64", "android.21-arm64", "android.21-arm" ],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Were you not planning to remove the "arm" entry?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I did, but reverted when working on fixing initTargetDistroRid logic in build.sh and forgot to re-remove.
Fixed

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thinking a bit more about this, why do you need to add these android specific files? Isn't the Linux version sufficient?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I'm not sure; I'm still piecing together how nuget packages are generated. Since I don't know all of the places a) where it would be important to separate Android from Linux and b) where it wouldn't matter, I'm taking a "separate everything now, integrate with Linux after" approach.

I can remove the files and see if package build still works.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@gkhanna79: So the build is successful, including packages, once packageTargetOsGroup for Android is removed from dir.props and conditionals added to Microsoft.NETCore.Runtime.CoreCLR.pkgproj

So my questions are:

  1. What elements distinguish one package group from another? Or: What factors determine the creation of a new OS group?
  2. Is it possible that a separate package group would be needed for Android in the future?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Given that Android is sufficiently distinct, but still Linux based, I am fine if a new OS group for it is used while leveraging the existing Linux definitions of the components.

CC @chcosta

Copy link
Copy Markdown
Author

@cydhaselton cydhaselton Apr 17, 2017

Choose a reason for hiding this comment

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

Unfortunately, unless I'm missing something, packageTargetOSGroup means adding Android-specific runtime-prefixed files (runtime.Android...). Are you saying just to leave those files in or make changes so that Android has it's own OSGroup/packageTargetOSGroup but uses the Linux component defs?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think it's reasonable for Android to use the Linux _packageTargetOSGroup to import the runtime package imports

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@chcosta and @gkhanna79: Still not sure how to achieve what you are suggesting; if I create a packageTargetOSGroup for Android without adding the runtime.Android files package build fails. Is there another OS that does this that I could reference?

Comment thread src/.nuget/dir.props
</When>
<When Condition="'$(_runtimeOSFamily)' == 'android'">
<PropertyGroup>
<PackageRID>android.21-$(ArchGroup)</PackageRID>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we have a check for arm64 since that is all we are supporting for now?

@cydhaselton
Copy link
Copy Markdown
Author

@gkhanna79 @qmfrederik and others; re-posting this question in general discussion for greater visibility. Code discussion here:

So my questions are:

  1. What elements distinguish one package group from another? Or: What factors determine the creation of a new OS group?
  2. Is it possible that a separate package group would be needed for Android in the future?

@cydhaselton
Copy link
Copy Markdown
Author

cc @hseok-oh and @ericstj for insight into OS Group package info

@danmoseley
Copy link
Copy Markdown
Member

@dotnet-bot test OSX10.12 x64 Checked Build and Test (network)

@cydhaselton
Copy link
Copy Markdown
Author

Also cc-ing @jkotas as per documentation; is there a person or persons that are responsible for the packaging subsystem that I should copy on this for feedback on the OS Group question?

@jkotas
Copy link
Copy Markdown
Member

jkotas commented Apr 8, 2017

You have the right people copied on this already (@gkhanna79, @ericstj).

@cydhaselton
Copy link
Copy Markdown
Author

Thanks, @jkotas. Would it be appropriate for me to update the CODE_OWNERS.TXT with that info?

Removed extra space in initTargetDistroRid() logic
removed Android-specific runtime files for packaging
added conditional to have Android use Linux runtime files
@cydhaselton
Copy link
Copy Markdown
Author

cydhaselton commented Apr 30, 2017

@gkhanna79 The above looks messy; did you mean "merge" instead of "rebase?

EDIT: Followed git hints instead of running git push -f post-rebase. Ran hard reset to rebase point, then ran git push -f

@gkhanna79
Copy link
Copy Markdown
Member

What is looking messy?

@cydhaselton
Copy link
Copy Markdown
Author

What is looking messy?
@gkhanna79 Ignore…see edited message. Basically didn't do git push -f after rebase.

@cydhaselton
Copy link
Copy Markdown
Author

@dotnet-bot test Windows_NT x64 Debug Build and Test

@cydhaselton
Copy link
Copy Markdown
Author

@gkhanna79, @ericstj and others…is there anything else that needs to be done for this PR?

Comment thread config.json Outdated
"description": "Specifies the OS to build Core_Root for",
"valueType": "property",
"values": [ "debian.8-x64", "fedora.24-x64", "fedora.25-x64", "opensuse.42.1-x64", "osx.10.12-x64", "rhel.7-x64", "ubuntu.14.04-x64", "ubuntu.16.04-x64", "ubuntu.16.10-x64" ],
"values": [ "debian.8-x64", "fedora.23-x64", "fedora.25-x64", "opensuse.42.1-x64", "osx.10.12-x64", "rhel.7-x64", "ubuntu.14.04-x64", "ubuntu.16.04-x64", "ubuntu.16.10-x64", "android.21-arm64" ],
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This change to fedora appears to be a bad merge.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Crap. Fixed

Comment thread src/.nuget/dir.props Outdated
<When Condition="'$(_runtimeOSFamily)' == 'android'">
<PropertyGroup>
<LibraryFileExtension>.so</LibraryFileExtension>
<!--symbols included in .so, like Linux, but can be generated externally and if so, uses .debug ext-->
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: indentation

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Fixed

Fixed accidental fedora version change
Fixed indenting
@ericstj
Copy link
Copy Markdown
Member

ericstj commented May 2, 2017

I've reviewed and commented on stuff that stuck out to me. I don't see anything else concerning. Most of these changes are around how coreclr decides to factor its package source which I don't have an opinion on so long as it produces the correct results. I'd like for @gkhanna79 or @chcosta to give explicit sign off on that.

@cydhaselton
Copy link
Copy Markdown
Author

Thanks Eric.
@gkhanna79 and/or @chcosta let me know if there's anything you see that needs to be fixed.

@cydhaselton
Copy link
Copy Markdown
Author

Polite re-ping to @gkhanna79 and @chcosta … is there anything I need to change in this PR before merge?

# TODO: replace with logic that generates RID based on $__ApiLevel and $__BuildArch
echo "Generating platform file..."

echo "RID=android.21-arm64" > $__ToolchainDir/sysroot/android_platform
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Any reason not to address this TODO and use the ApiLevel / BuildArch here?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@chcosta The TODO was addressed in previous commit by adding logic to build-android-rootfs.sh; I accidentally left the comment. Will remove comment and echo commands.

Comment thread src/.nuget/dir.props Outdated
</OfficialBuildRID>
</ItemGroup>
<ItemGroup Condition="$(SupportedPackageOSGroups.Contains(';Android;'))">
<OfficialBuildRID Include="android.21-arm64">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you want to include the Portable rid?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@chcosta At this line? I don't think so…a quick check of master shows that the other supported OSs don;t include it at this point. Should it be?

@gkhanna79 Anything you see that needs changing?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

OfficialBuildRID is only used for platform targets that the official .NET Core build is going to support and we should add it only when we enable building for it. Otherwise, this is not required.

@cydhaselton Can you please undo this change for now?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Out of town but will push change when I return.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

@gkhanna79 Removed

@chcosta
Copy link
Copy Markdown
Member

chcosta commented May 15, 2017

Two additional comments, and then LGTM

@cydhaselton
Copy link
Copy Markdown
Author

cydhaselton commented Jun 6, 2017

@dotnet-bot test Tizen armel Cross Debug Build

@cydhaselton
Copy link
Copy Markdown
Author

@dotnet-bot test Windows_NT x64 Debug Build and Test

@cydhaselton
Copy link
Copy Markdown
Author

@gkhanna79 and @chcosta are there any other changes needed for this PR?

@gkhanna79 gkhanna79 merged commit b4cbd9d into dotnet:master Jun 8, 2017
@cydhaselton
Copy link
Copy Markdown
Author

cydhaselton commented Jun 9, 2017

Thanks all. Ok to keep this branch around until I have time to write up documentation?

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.

10 participants