sdk icon indicating copy to clipboard operation
sdk copied to clipboard

Add Android workload manifests to SB .NET SDK

Open jonathanpeppers opened this issue 1 year ago • 7 comments

Context: https://github.com/dotnet/source-build/issues/3242

If using a source-built .NET SDK, the Android workload manifests are not included in the SDK. So, you won't see android workload when you run dotnet workload search.

The Android workload, in general, contains private sources, but the manifest files are completely public.

In the long run, we could consider onboarding dotnet/android to:

  • https://github.com/dotnet/source-build/blob/main/Documentation/sourcebuild-in-repos/new-repo.md

But the prerequisites would be to first have the Android workload onboard to arcade:

  • https://github.com/dotnet/arcade/blob/main/Documentation/Onboarding.md

For now, we could include the Android workload in source-build by:

  • Add a step that copies the Android workload manifests source code in-tree (to be used when updating manifests).

  • Commit the manifest sources.

  • Source-build will then include the Android workload manifests in the SDK by using the source code, in-tree.

jonathanpeppers avatar Jul 12 '24 15:07 jonathanpeppers

cc @dotnet/source-build-internal this change updates the source-built SDK - does running the build script with -sb create an artifact that @jonathanpeppers can use to test the changes? That should all work from an e.g. Ubuntu WSL, right?

baronfel avatar Jul 22 '24 18:07 baronfel

cc @dotnet/source-build-internal this change updates the source-built SDK - does running the build script with -sb create an artifact that @jonathanpeppers can use to test the changes? That should all work from an e.g. Ubuntu WSL, right?

No it won't. You need the sdk tarball that is produced from the sdk-source-build leg.

MichaelSimons avatar Jul 22 '24 19:07 MichaelSimons

Ok, it seems to be working, I tested in a GitHub codespace:

  1. Get dotnet-sdk-9.0.100-preview.7.24366.1-centos.9-x64.tar.gz from build artifacts
  2. mkdir test-sdk && cd test-sdk
  3. tar -xvzf ../dotnet-sdk-9.0.100-preview.7.24366.1-centos.9-x64.tar.gz
  4. $ ./dotnet workload search (this used to not even work)
Workload ID                 Description                                         
--------------------------------------------------------------------------------
android                     .NET SDK Workload for building Android applications.
  1. $ ./dotnet workload install android
Skipping NuGet package signature verification.
...
Installing pack Microsoft.Android.Sdk.Linux version 34.99.0-preview.6.340...
...
Successfully installed workload(s) android.
  1. Make a helloandroid folder somewhere and $ ../sdk/test-sdk/dotnet new android
The template "Android Application" was created successfully.
  1. Now we need some Android dependencies:
$ ../sdk/test-sdk/dotnet build -t:InstallAndroidDependencies -p:AndroidSdkDirectory=/home/vscode/android-sdk/ -p:JavaSdkDirectory=/home/vscode/jdk/ -p:AcceptAndroidSDKLicenses=true
  1. Build the app:
$ ../sdk/test-sdk/dotnet build -bl -p:AndroidSdkDirectory=/home/vscode/android-sdk/ -p:JavaSdkDirectory=/home/vscode/jdk/
Restore complete (0.5s)
You are using a preview version of .NET. See: https://aka.ms/dotnet-support-policy
  helloandroid succeeded (17.4s) → bin/Debug/net9.0-android/helloandroid.dll

Build succeeded in 19.5s

$ ls -la bin/Debug/net9.0-android/*.apk
-rw-rw-rw- 1 vscode vscode 10224521 Jul 22 20:43 bin/Debug/net9.0-android/com.companyname.helloandroid.apk
-rw-r--rw- 1 vscode vscode 10237801 Jul 22 20:43 bin/Debug/net9.0-android/com.companyname.helloandroid-Signed.apk

jonathanpeppers avatar Jul 22 '24 20:07 jonathanpeppers

@MichaelSimons there is an error like:

/vmr/repo-projects/Directory.Build.targets(765,5): warning : 1 new packages used not in baseline! See report at /vmr/artifacts/prebuilt-report/baseline-comparison.xml for more information. Package IDs are: [/vmr/repo-projects/dotnet.proj]
/vmr/repo-projects/Directory.Build.targets(765,5): warning : Microsoft.NET.Sdk.Android.Manifest-9.0.100-preview.6.34.99.0-preview.6.340 [/vmr/repo-projects/dotnet.proj]
/vmr/repo-projects/Directory.Build.targets(765,5): warning : Prebuilt usages are different from the baseline. If detected changes are acceptable, update baseline with: [/vmr/repo-projects/dotnet.proj]
/vmr/repo-projects/Directory.Build.targets(765,5): warning : cp '/vmr/artifacts/prebuilt-report/generated-new-baseline.xml' '/vmr/eng/tools/prebuilt-baseline.xml' [/vmr/repo-projects/dotnet.proj]
  Packaged all symbols in '/vmr/artifacts/assets/Release/dotnet-symbols-all-9.0.100-preview.7.24366.1-centos.9-x64.tar.gz'
  Packaged sdk symbols in '/vmr/artifacts/assets/Release/dotnet-symbols-sdk-9.0.100-preview.7.24366.1-centos.9-x64.tar.gz'
  Found 1 files in prebuilt packages dir.
  Tarball '/vmr/artifacts/assets/Release/Private.SourceBuilt.Prebuilts.9.0.100-preview.7.24366.1.centos.9-x64.tar.gz' was successfully created from '/vmr/artifacts/prebuilt-report/prebuilt-packages/'
/vmr/eng/finish-source-only.proj(171,5): error : 1 Prebuilts Exist

Can that be fixed in this repo?

jonathanpeppers avatar Jul 22 '24 20:07 jonathanpeppers

@jonathanpeppers, is this something that is still in scope for 9.0?

MichaelSimons avatar Aug 28 '24 16:08 MichaelSimons

@MichaelSimons yes, unfortunately I've had to focus on other things for a bit.

Linux support is just lower on the list than anything else, but we'd still like to complete this at some point.

Maybe if this doesn't make RC 2, we do it for .NET 10?

jonathanpeppers avatar Aug 28 '24 16:08 jonathanpeppers

@MichaelSimons yes, unfortunately I've had to focus on other things for a bit.

Linux support is just lower on the list than anything else, but we'd still like to complete this at some point.

Maybe if this doesn't make RC 2, we do it for .NET 10?

Thanks, if you need help diagnosing source-build related failures, let me know and I can help.

MichaelSimons avatar Aug 28 '24 16:08 MichaelSimons

Due to lack of recent activity, this PR has been labeled as 'Stale'. It will be closed if no further activity occurs within 7 more days. Any new comment will remove the label.

github-actions[bot] avatar Sep 22 '25 16:09 github-actions[bot]