Skip to content

[One .NET] dotnet workload install android or android-aot #6045

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 6 additions & 14 deletions build-tools/automation/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1291,20 +1291,13 @@ stages:
workspace:
clean: all
steps:
- checkout: self
submodules: recursive
- template: yaml-templates/setup-test-environment.yaml
parameters:
xaSourcePath: $(System.DefaultWorkingDirectory)/xamarin-android

- checkout: release_scripts
clean: true

- template: yaml-templates/use-dot-net.yaml
parameters:
remove_dotnet: true

- template: yaml-templates/use-dot-net.yaml
parameters:
version: $(DotNetCoreVersion)

- task: DownloadPipelineArtifact@2
inputs:
${{ if eq(variables['MicroBuildSignType'], 'Real') }}:
Expand Down Expand Up @@ -1397,10 +1390,9 @@ stages:
- ${{ if eq(variables['MicroBuildSignType'], 'Real') }}:
- group: Publish-Build-Assets
steps:
- checkout: self
submodules: recursive

- template: yaml-templates/use-dot-net.yaml
- template: yaml-templates/setup-test-environment.yaml
parameters:
configuration: $(XA.Build.Configuration)

- task: DownloadPipelineArtifact@2
inputs:
Expand Down
44 changes: 22 additions & 22 deletions build-tools/create-packs/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,6 @@
DependsOnTargets="DeleteExtractedWorkloadPacks" >
<ItemGroup>
<_WLManifest Include="$(XamarinAndroidSourcePath)bin\Build$(Configuration)\nuget-unsigned\Microsoft.NET.Sdk.Android.Manifest-*.nupkg" />
<_WLPacks Include="$(XamarinAndroidSourcePath)bin\Build$(Configuration)\nuget-unsigned\Microsoft.Android.Sdk.$(HostOS).*.nupkg" />
<_WLPacks Include="$(XamarinAndroidSourcePath)bin\Build$(Configuration)\nuget-unsigned\Microsoft.Android.Sdk.BundleTool.*.nupkg" />
<_WLPacks Include="$(XamarinAndroidSourcePath)bin\Build$(Configuration)\nuget-unsigned\Microsoft.Android.Ref.*.nupkg" />
<_WLTemplates Include="$(XamarinAndroidSourcePath)bin\Build$(Configuration)\nuget-unsigned\Microsoft.Android.Templates.*.nupkg" />
<!-- Runtime packs are not yet supported by workloads -->
<!-- <_WLPacks Include="$(XamarinAndroidSourcePath)bin\Build$(Configuration)\nuget-unsigned\Microsoft.Android.Runtime.*.nupkg" /> -->
</ItemGroup>
<PropertyGroup>
<_WLPackVersion>@(_WLManifest->'%(Filename)'->Replace('Microsoft.NET.Sdk.Android.Manifest-$(DotNetPreviewVersionBand).', ''))</_WLPackVersion>
Expand All @@ -97,24 +91,30 @@
</ItemGroup>
<Move SourceFiles="@(_WLExtractedFiles)" DestinationFolder="$(_SdkManifestsFolder)microsoft.net.sdk.android" />
<RemoveDir Directories="$(_SdkManifestsFolder)temp\" />
<Unzip
SourceFiles="@(_WLPacks)"
DestinationFolder="$(DotNetPreviewPath)packs\$([System.String]::Copy('%(_WLPacks.Filename)').Replace('.$(_WLPackVersion)', ''))\$(_WLPackVersion)"
/>
<MakeDir Directories="$(DotNetPreviewPath)template-packs" />
<!-- TODO: Workaround Linux casing issue and copy template packs to lowercase destination -->
<Copy SourceFiles="@(_WLTemplates)" DestinationFiles="@(_WLTemplates->'%(Filename)%(Extension)'->ToLower()->'$(DotNetPreviewPath)template-packs\%(Identity)')" />
<ItemGroup>
<_UnixExecutables Include="$(DotNetPreviewPath)packs\Microsoft.Android.Sdk.*\*\tools\$(HostOS)\**\*.*" />
<_FilesToTouch Include="$(DotNetPreviewPath)sdk-manifests\$(DotNetPreviewVersionBand)\microsoft.net.sdk.android\**" />
<_FilesToTouch Include="$(DotNetPreviewPath)packs\$([System.String]::Copy('%(_WLPacks.Filename)').Replace('.$(_WLPackVersion)', ''))\$(_WLPackVersion)\**" />
</ItemGroup>

<!-- dotnet workload install android-aot -->
<PropertyGroup>
<_TempDirectory>$(DotNetPreviewPath)..\.xa-workload-temp-$([System.IO.Path]::GetRandomFileName())</_TempDirectory>
<_NuGetConfig>$(_TempDirectory)\NuGet.config</_NuGetConfig>
<_NuGetContent>
<![CDATA[
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<add key="local" value="$(OutputPath)" />
<add key="dotnet6" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json" />
</packageSources>
</configuration>
]]>
</_NuGetContent>
</PropertyGroup>
<WriteLinesToFile File="$(_NuGetConfig)" Lines="$(_NuGetContent)" Overwrite="true" />
<Exec
Condition=" '$(HostOS)' == 'Darwin' or '$(HostOS)' == 'Linux' "
Command="chmod +x &quot;%(_UnixExecutables.Identity)&quot;"
WorkingDirectory="$(_TempDirectory)"
Command="&quot;$(DotNetPreviewTool)&quot; workload install android-aot --skip-manifest-update --verbosity diag --temp-dir &quot;$(_TempDirectory)&quot;"
/>
<!-- Some files had timestamps in the future -->
<Touch Files="@(_FilesToTouch)" />
<RemoveDir Directories="$(_TempDirectory)" />
</Target>

<Target Name="DeleteExtractedWorkloadPacks" >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,12 @@ protected override async Task<bool> Execute (Context context)
}
}

// Delete the metadata folder, which contains old workload data
var metadataPath = Path.Combine (dotnetPath, "metadata");
if (Directory.Exists (metadataPath)) {
Utilities.DeleteDirectory (metadataPath);
}

if (File.Exists (dotnetTool)) {
if (!TestDotNetSdk (dotnetTool)) {
Log.WarningLine ($"Attempt to run `dotnet --version` failed, reinstalling the SDK.");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
{
"version": "@WORKLOAD_VERSION@",
"workloads": {
"microsoft-android-sdk-full": {
"description": "Android SDK",
"android": {
"description": "Microsoft Android SDK for .NET",
"packs": [
"Microsoft.Android.Sdk",
"Microsoft.Android.Sdk.BundleTool",
"Microsoft.Android.Ref",
"Microsoft.Android.Runtime.android-arm",
"Microsoft.Android.Runtime.android-arm64",
"Microsoft.Android.Runtime.android-x86",
"Microsoft.Android.Runtime.android-x64",
"Microsoft.Android.Templates"
],
"extends" : [ "microsoft-net-runtime-android" ]
},
"android-aot": {
"description": "Microsoft Android SDK for .NET with AOT support",
"extends" : [ "android", "microsoft-net-runtime-android-aot" ]
}
},
"packs": {
Expand All @@ -32,6 +40,22 @@
"kind": "framework",
"version": "@WORKLOAD_VERSION@"
},
"Microsoft.Android.Runtime.android-arm": {
"kind": "framework",
"version": "@WORKLOAD_VERSION@"
},
"Microsoft.Android.Runtime.android-arm64": {
"kind": "framework",
"version": "@WORKLOAD_VERSION@"
},
"Microsoft.Android.Runtime.android-x86": {
"kind": "framework",
"version": "@WORKLOAD_VERSION@"
},
"Microsoft.Android.Runtime.android-x64": {
"kind": "framework",
"version": "@WORKLOAD_VERSION@"
},
"Microsoft.Android.Templates": {
"kind": "template",
"version": "@WORKLOAD_VERSION@"
Expand Down