Add Android workload manifests to SB .NET SDK
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.
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?
cc @dotnet/source-build-internal this change updates the source-built SDK - does running the build script with
-sbcreate 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.
Ok, it seems to be working, I tested in a GitHub codespace:
- Get
dotnet-sdk-9.0.100-preview.7.24366.1-centos.9-x64.tar.gzfrom build artifacts -
mkdir test-sdk && cd test-sdk -
tar -xvzf ../dotnet-sdk-9.0.100-preview.7.24366.1-centos.9-x64.tar.gz -
$ ./dotnet workload search(this used to not even work)
Workload ID Description
--------------------------------------------------------------------------------
android .NET SDK Workload for building Android applications.
-
$ ./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.
- Make a
helloandroidfolder somewhere and$ ../sdk/test-sdk/dotnet new android
The template "Android Application" was created successfully.
- 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
- 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
@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, is this something that is still in scope for 9.0?
@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?
@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.
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.