Skip to content

Commit 6ec79a3

Browse files
[One .NET] dotnet workload install android or android-aot
Context: https://github.com/dotnet/maui/tree/ef4518bf502ffa6760625c4cb53fa0cb015bc6d1/src/Workload#net-maui-workload-ids Right now to install the Android workload you would run: dotnet workload install microsoft-android-sdk-full Let's shorten this to be: dotnet workload install android We can also create a new workload that extends `android`, and includes AOT support: dotnet workload install android-aot To test this behavior on our CI, I reworked the `ExtractWorkloadPacks` to run `dotnet workload install` commands. This should give us more confidence that our workload can be installed -- and our MSBuild tests will consume the installed workload. Other changes: * Added our `Microsoft.Android.Runtime.*` packs to the `WorkloadManifest.json`. This was mostly omitted by mistake; however, runtime packs aren't resolved either due to: dotnet/sdk#14044 * Call `setup-test-environment.yaml` in `dotnet_create_msi` job * Delete `dotnet/metadata` folder in `Step_InstallDotNetPreview`
1 parent 688e2e1 commit 6ec79a3

File tree

4 files changed

+56
-28
lines changed

4 files changed

+56
-28
lines changed

build-tools/automation/azure-pipelines.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,10 +1397,9 @@ stages:
13971397
- ${{ if eq(variables['MicroBuildSignType'], 'Real') }}:
13981398
- group: Publish-Build-Assets
13991399
steps:
1400-
- checkout: self
1401-
submodules: recursive
1402-
1403-
- template: yaml-templates/use-dot-net.yaml
1400+
- template: yaml-templates/setup-test-environment.yaml
1401+
parameters:
1402+
configuration: $(XA.Build.Configuration)
14041403

14051404
- task: DownloadPipelineArtifact@2
14061405
inputs:

build-tools/create-packs/Directory.Build.targets

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,6 @@
7575
DependsOnTargets="DeleteExtractedWorkloadPacks" >
7676
<ItemGroup>
7777
<_WLManifest Include="$(XamarinAndroidSourcePath)bin\Build$(Configuration)\nuget-unsigned\Microsoft.NET.Sdk.Android.Manifest-*.nupkg" />
78-
<_WLPacks Include="$(XamarinAndroidSourcePath)bin\Build$(Configuration)\nuget-unsigned\Microsoft.Android.Sdk.$(HostOS).*.nupkg" />
79-
<_WLPacks Include="$(XamarinAndroidSourcePath)bin\Build$(Configuration)\nuget-unsigned\Microsoft.Android.Sdk.BundleTool.*.nupkg" />
80-
<_WLPacks Include="$(XamarinAndroidSourcePath)bin\Build$(Configuration)\nuget-unsigned\Microsoft.Android.Ref.*.nupkg" />
81-
<_WLTemplates Include="$(XamarinAndroidSourcePath)bin\Build$(Configuration)\nuget-unsigned\Microsoft.Android.Templates.*.nupkg" />
82-
<!-- Runtime packs are not yet supported by workloads -->
83-
<!-- <_WLPacks Include="$(XamarinAndroidSourcePath)bin\Build$(Configuration)\nuget-unsigned\Microsoft.Android.Runtime.*.nupkg" /> -->
8478
</ItemGroup>
8579
<PropertyGroup>
8680
<_WLPackVersion>@(_WLManifest->'%(Filename)'->Replace('Microsoft.NET.Sdk.Android.Manifest-$(DotNetPreviewVersionBand).', ''))</_WLPackVersion>
@@ -97,24 +91,29 @@
9791
</ItemGroup>
9892
<Move SourceFiles="@(_WLExtractedFiles)" DestinationFolder="$(_SdkManifestsFolder)microsoft.net.sdk.android" />
9993
<RemoveDir Directories="$(_SdkManifestsFolder)temp\" />
100-
<Unzip
101-
SourceFiles="@(_WLPacks)"
102-
DestinationFolder="$(DotNetPreviewPath)packs\$([System.String]::Copy('%(_WLPacks.Filename)').Replace('.$(_WLPackVersion)', ''))\$(_WLPackVersion)"
103-
/>
104-
<MakeDir Directories="$(DotNetPreviewPath)template-packs" />
105-
<!-- TODO: Workaround Linux casing issue and copy template packs to lowercase destination -->
106-
<Copy SourceFiles="@(_WLTemplates)" DestinationFiles="@(_WLTemplates->'%(Filename)%(Extension)'->ToLower()->'$(DotNetPreviewPath)template-packs\%(Identity)')" />
107-
<ItemGroup>
108-
<_UnixExecutables Include="$(DotNetPreviewPath)packs\Microsoft.Android.Sdk.*\*\tools\$(HostOS)\**\*.*" />
109-
<_FilesToTouch Include="$(DotNetPreviewPath)sdk-manifests\$(DotNetPreviewVersionBand)\microsoft.net.sdk.android\**" />
110-
<_FilesToTouch Include="$(DotNetPreviewPath)packs\$([System.String]::Copy('%(_WLPacks.Filename)').Replace('.$(_WLPackVersion)', ''))\$(_WLPackVersion)\**" />
111-
</ItemGroup>
94+
95+
<!-- dotnet workload install android-aot -->
96+
<PropertyGroup>
97+
<_NuGetConfig>$(AndroidToolchainCacheDirectory)\NuGet.config</_NuGetConfig>
98+
<_NuGetContent>
99+
<![CDATA[
100+
<?xml version="1.0" encoding="utf-8"?>
101+
<configuration>
102+
<packageSources>
103+
<clear />
104+
<add key="local" value="$(OutputPath)" />
105+
<add key="dotnet6" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" />
106+
</packageSources>
107+
</configuration>
108+
]]>
109+
</_NuGetContent>
110+
</PropertyGroup>
111+
<WriteLinesToFile File="$(_NuGetConfig)" Lines="$(_NuGetContent)" Overwrite="true" />
112112
<Exec
113-
Condition=" '$(HostOS)' == 'Darwin' or '$(HostOS)' == 'Linux' "
114-
Command="chmod +x &quot;%(_UnixExecutables.Identity)&quot;"
113+
WorkingDirectory="$(AndroidToolchainCacheDirectory)"
114+
Command="&quot;$(DotNetPreviewTool)&quot; workload install android-aot --skip-manifest-update --verbosity diag"
115115
/>
116-
<!-- Some files had timestamps in the future -->
117-
<Touch Files="@(_FilesToTouch)" />
116+
<Delete Files="$(_NuGetConfig)" />
118117
</Target>
119118

120119
<Target Name="DeleteExtractedWorkloadPacks" >

build-tools/xaprepare/xaprepare/Steps/Step_InstallDotNetPreview.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ protected override async Task<bool> Execute (Context context)
6868
}
6969
}
7070

71+
// Delete the metadata folder, which contains old workload data
72+
var metadataPath = Path.Combine (dotnetPath, "metadata");
73+
if (Directory.Exists (metadataPath)) {
74+
Utilities.DeleteDirectory (metadataPath);
75+
}
76+
7177
if (File.Exists (dotnetTool)) {
7278
if (!TestDotNetSdk (dotnetTool)) {
7379
Log.WarningLine ($"Attempt to run `dotnet --version` failed, reinstalling the SDK.");

src/Xamarin.Android.Build.Tasks/Microsoft.NET.Sdk.Android/WorkloadManifest.in.json

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,23 @@
11
{
22
"version": "@WORKLOAD_VERSION@",
33
"workloads": {
4-
"microsoft-android-sdk-full": {
5-
"description": "Android SDK",
4+
"android": {
5+
"description": "Microsoft Android SDK for .NET",
66
"packs": [
77
"Microsoft.Android.Sdk",
88
"Microsoft.Android.Sdk.BundleTool",
99
"Microsoft.Android.Ref",
10+
"Microsoft.Android.Runtime.android-arm",
11+
"Microsoft.Android.Runtime.android-arm64",
12+
"Microsoft.Android.Runtime.android-x86",
13+
"Microsoft.Android.Runtime.android-x64",
1014
"Microsoft.Android.Templates"
1115
],
1216
"extends" : [ "microsoft-net-runtime-android" ]
17+
},
18+
"android-aot": {
19+
"description": "Microsoft Android SDK for .NET with AOT support",
20+
"extends" : [ "android", "microsoft-net-runtime-android-aot" ]
1321
}
1422
},
1523
"packs": {
@@ -32,6 +40,22 @@
3240
"kind": "framework",
3341
"version": "@WORKLOAD_VERSION@"
3442
},
43+
"Microsoft.Android.Runtime.android-arm": {
44+
"kind": "framework",
45+
"version": "@WORKLOAD_VERSION@"
46+
},
47+
"Microsoft.Android.Runtime.android-arm64": {
48+
"kind": "framework",
49+
"version": "@WORKLOAD_VERSION@"
50+
},
51+
"Microsoft.Android.Runtime.android-x86": {
52+
"kind": "framework",
53+
"version": "@WORKLOAD_VERSION@"
54+
},
55+
"Microsoft.Android.Runtime.android-x64": {
56+
"kind": "framework",
57+
"version": "@WORKLOAD_VERSION@"
58+
},
3559
"Microsoft.Android.Templates": {
3660
"kind": "template",
3761
"version": "@WORKLOAD_VERSION@"

0 commit comments

Comments
 (0)