Skip to content

Commit 91498d5

Browse files
authored
[One .NET] Initial workload support (#5195)
Context: https://github.com/dotnet/designs/blob/main/accepted/2020/workloads/workloads.md Add a new Microsoft.NET.Workload.Android NuGet package which contains the `WorkloadManifest.json` and `WorkloadManifest.targets` files required for the [workload resolver][1]. The Microsoft.Android.Sdk NuGet package has been converted from an [MSBuild project SDK][2] to an SDK workload pack. The most noticeable difference in this change is that the `Sdk.props` import hook has been replaced by an `AutoImport.props` file. The `AutoImport.props` file should not set any MSBuild properties, and should only contain ItemGroup glob behavior that can be modified by the main project file. The `AutoImport.props` file included in Microsoft.Android.Sdk will be imported by all project using Microsoft.NET.Sdk once workloads are enabled by default. As a result, it is crucial that all of the content in this file be conditionally included based on some Android specific property value; in this case, when `$(EnableDefaultAndroidItems)`=True. All other `.props` files from this repo which are included in the Microsoft.Android.Sdk pack have been renamed to `.targets` files. This was done to follow the convention that `.props` files are loaded before the main project file, and `.targets` files are loaded after. The only file that is loaded before the project file is `AutoImport.props`. All One .NET tests have been updated to use the Microsoft.NET.Sdk project SDK, rather than Microsoft.Android.Sdk. In order to support this, a new `/t:ExtractWorkloadPacks` target has been added. This target can be used by `build-tools/create-packs/*.proj`, and is responsible for extracting Microsoft.NET.Workload.Android, Microsoft.Android.Sdk, and Microsoft.Android.Ref into our sandbox .NET preview installation location (cdc35b6). This target will also clean up any stale Microsoft.Android.* packs that were previously installed. The Xamarin.Android.Sdk.Lite package has been removed, as it continues to be a bit of a headache to maintain moving forward. Old versions of this package will continue to be available on the internal NuGet feed as needed, however teams should soon be able to switch over to our workload for their own dev/test efforts. Finally, I've bumped the .NET Preview version to 5.0.100-rtm.20509.5. [1]: https://github.com/dotnet/designs/blob/main/accepted/2020/workloads/workload-resolvers.md [2]: https://docs.microsoft.com/en-us/visualstudio/msbuild/how-to-use-project-sdk
1 parent d6793e3 commit 91498d5

36 files changed

+262
-295
lines changed

Configuration.props

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@
6969
<AndroidNdkDirectory Condition=" '$(AndroidNdkDirectory)' == '' ">$(AndroidToolchainDirectory)\ndk</AndroidNdkDirectory>
7070
<DotNetPreviewPath Condition=" '$(DotNetPreviewPath)' == '' ">$(AndroidToolchainDirectory)\dotnet\</DotNetPreviewPath>
7171
<DotNetPreviewTool Condition=" '$(DotNetPreviewTool)' == '' ">$(DotNetPreviewPath)dotnet</DotNetPreviewTool>
72+
<!-- Version number from: https://github.com/dotnet/installer#installers-and-binaries -->
73+
<DotNetPreviewVersionBand Condition=" '$(DotNetPreviewVersionBand)' == '' ">5.0.100</DotNetPreviewVersionBand>
74+
<DotNetPreviewVersionFull Condition=" '$(DotNetPreviewVersionFull)' == '' ">$(DotNetPreviewVersionBand)-rtm.20509.5</DotNetPreviewVersionFull>
7275
<AndroidCmakeVersion Condition=" '$(AndroidCmakeVersion)' == '' ">3.10.2</AndroidCmakeVersion>
7376
<AndroidCmakeVersionPath Condition=" '$(AndroidCmakeVersionPath)' == '' ">$(AndroidCmakeVersion).4988404</AndroidCmakeVersionPath>
7477
<AndroidSdkCmakeDirectory>$(AndroidSdkDirectory)\cmake\$(AndroidCmakeVersionPath)</AndroidSdkCmakeDirectory>

Documentation/guides/OneDotNet.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,12 @@ not be supported:
134134

135135
## Default file inclusion
136136

137-
Default Android related file globbing behavior is defined in `Microsoft.Android.Sdk.DefaultItems.targets`.
137+
Default Android related file globbing behavior is defined in [`AutoImport.props`][autoimport].
138138
This behavior can be disabled for Android items by setting `$(EnableDefaultAndroidItems)` to `false`, or
139139
all default item inclusion behavior can be disabled by setting `$(EnableDefaultItems)` to `false`.
140140

141+
[autoimport]: https://github.com/dotnet/designs/blob/4703666296f5e59964961464c25807c727282cae/accepted/2020/workloads/workload-resolvers.md#workload-props-files
142+
141143
## Linker (ILLink)
142144

143145
.NET 5 and higher has new [settings for the linker][linker]:

build-tools/Xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks/GenerateSupportedPlatforms.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ public override bool Execute ()
5656
writer.WriteStartElement ("Project");
5757

5858
writer.WriteStartElement ("PropertyGroup");
59+
writer.WriteStartElement ("TargetPlatformSupported");
60+
writer.WriteString ("true");
61+
writer.WriteEndElement (); // </TargetPlatformSupported>
5962
writer.WriteStartElement ("TargetPlatformVersion");
6063
writer.WriteAttributeString ("Condition", " '$(TargetPlatformVersion)' == '' ");
6164
writer.WriteString (versions.MaxStableVersion.ApiLevel.ToString ());
@@ -71,7 +74,6 @@ public override bool Execute ()
7174
writer.WriteEndElement (); // </AndroidSdkSupportedTargetPlatformVersion>
7275
}
7376
writer.WriteStartElement ("SdkSupportedTargetPlatformVersion");
74-
writer.WriteAttributeString ("Condition", " '$(TargetPlatformIdentifier)' == 'Android' ");
7577
writer.WriteAttributeString ("Include", "@(AndroidSdkSupportedTargetPlatformVersion)");
7678

7779
writer.WriteEndDocument (); // </Project>

build-tools/automation/azure-pipelines.yaml

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -320,12 +320,13 @@ stages:
320320
configuration: $(XA.Build.Configuration)
321321
msbuildArguments: /t:Prepare /p:AutoProvision=true /bl:$(System.DefaultWorkingDirectory)\bin\Build$(XA.Build.Configuration)\msbuild-prepare.binlog
322322

323+
# Build, pack .nupkgs, and extract workload packs to dotnet preview test directory
323324
- task: MSBuild@1
324325
displayName: msbuild Xamarin.Android
325326
inputs:
326327
solution: Xamarin.Android.sln
327328
configuration: $(XA.Build.Configuration)
328-
msbuildArguments: /bl:$(System.DefaultWorkingDirectory)\bin\Build$(XA.Build.Configuration)\msbuild-build.binlog
329+
msbuildArguments: /t:PackDotNet /bl:$(System.DefaultWorkingDirectory)\bin\Build$(XA.Build.Configuration)\msbuild-build.binlog
329330

330331
- task: MSBuild@1
331332
displayName: msbuild create-vsix
@@ -334,13 +335,6 @@ stages:
334335
configuration: $(XA.Build.Configuration)
335336
msbuildArguments: /p:CreateVsixContainer=True /p:ZipPackageCompressionLevel=Normal /bl:$(System.DefaultWorkingDirectory)\bin\Build$(XA.Build.Configuration)\msbuild-create-vsix.binlog
336337

337-
- task: MSBuild@1
338-
displayName: pack all nupkgs
339-
inputs:
340-
solution: $(System.DefaultWorkingDirectory)\build-tools\create-packs\Microsoft.Android.Sdk.proj
341-
configuration: $(XA.Build.Configuration)
342-
msbuildArguments: /t:CreateAllPacks /restore /bl:$(System.DefaultWorkingDirectory)\bin\Build$(XA.Build.Configuration)\create-all-packs.binlog
343-
344338
- task: CmdLine@1
345339
displayName: xabuild Xamarin.Android-Tests
346340
inputs:
@@ -695,11 +689,6 @@ stages:
695689
artifactName: $(TestAssembliesArtifactName)
696690
downloadPath: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)
697691

698-
- task: DownloadPipelineArtifact@2
699-
inputs:
700-
artifactName: $(NuGetArtifactName)
701-
downloadPath: $(System.DefaultWorkingDirectory)/bin/Build$(XA.Build.Configuration)/$(NuGetArtifactName)
702-
703692
- task: MSBuild@1
704693
displayName: start emulator
705694
inputs:
@@ -860,11 +849,6 @@ stages:
860849
artifactName: $(TestAssembliesArtifactName)
861850
downloadPath: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)
862851

863-
- task: DownloadPipelineArtifact@2
864-
inputs:
865-
artifactName: $(NuGetArtifactName)
866-
downloadPath: $(System.DefaultWorkingDirectory)/bin/Build$(XA.Build.Configuration)/$(NuGetArtifactName)
867-
868852
- task: MSBuild@1
869853
displayName: start emulator
870854
inputs:

build-tools/automation/yaml-templates/run-msbuild-mac-tests.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ jobs:
2626
artifactName: $(TestAssembliesArtifactName)
2727
downloadPath: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)
2828

29-
- task: DownloadPipelineArtifact@1
30-
inputs:
31-
artifactName: $(NuGetArtifactName)
32-
downloadPath: $(System.DefaultWorkingDirectory)/bin/Build$(XA.Build.Configuration)/$(NuGetArtifactName)
33-
3429
- template: run-nunit-tests.yaml
3530
parameters:
3631
useDotNet: $(UseDotNet)

build-tools/automation/yaml-templates/run-msbuild-win-tests.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ jobs:
3434
artifactName: $(TestAssembliesArtifactName)
3535
downloadPath: $(System.DefaultWorkingDirectory)\bin\Test$(XA.Build.Configuration)
3636

37-
- task: DownloadPipelineArtifact@1
38-
inputs:
39-
artifactName: $(NuGetArtifactName)
40-
downloadPath: $(System.DefaultWorkingDirectory)\bin\Build$(XA.Build.Configuration)\$(NuGetArtifactName)
41-
4237
# Limit the amount of worker threads used to run these tests in parallel to half of what is currently available (8) on the Windows pool.
4338
# Using all available cores seems to occasionally bog down our machines and cause parallel test execution to slow down dramatically.
4439
- template: run-nunit-tests.yaml

build-tools/automation/yaml-templates/setup-test-environment.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,3 +78,16 @@ steps:
7878
solution: ${{ parameters.xaSourcePath }}/build-tools/xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks.csproj
7979
configuration: ${{ parameters.configuration }}
8080
msbuildArguments: /restore /bl:${{ parameters.xaSourcePath }}/bin/Test${{ parameters.configuration }}/BootstrapTasks.binlog
81+
82+
# Download and install .NET nupkgs
83+
- task: DownloadPipelineArtifact@2
84+
inputs:
85+
artifactName: $(NuGetArtifactName)
86+
downloadPath: ${{ parameters.xaSourcePath }}/bin/Build${{ parameters.configuration }}/$(NuGetArtifactName)
87+
88+
- task: MSBuild@1
89+
displayName: extract workload packs
90+
inputs:
91+
solution: ${{ parameters.xaSourcePath }}/build-tools/create-packs/Microsoft.Android.Sdk.proj
92+
configuration: ${{ parameters.configuration }}
93+
msbuildArguments: /t:ExtractWorkloadPacks /restore /bl:${{ parameters.xaSourcePath }}/bin/Test${{ parameters.configuration }}/extract-workloads.binlog

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

Lines changed: 55 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010
<Import Project="Sdk.props" Sdk="Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk" />
1111
<UsingTask TaskName="CreateFrameworkListFile" AssemblyFile="$(DotNetBuildTasksSharedFrameworkTaskFile)"/>
1212

13+
<PropertyGroup>
14+
<_WorkloadResolverFlagFile>$(DotNetPreviewPath)sdk\$(DotNetPreviewVersionFull)\EnableWorkloadResolver.sentinel</_WorkloadResolverFlagFile>
15+
</PropertyGroup>
16+
1317
<ItemGroup>
1418
<!-- NOTE: we don't have a reference assembly for Java.Interop.dll yet -->
1519
<_AndroidAppRefAssemblies Include="$(XamarinAndroidSourcePath)bin\$(Configuration)\lib\xamarin.android\xbuild-frameworks\Microsoft.Android\netcoreapp3.1\Java.Interop.dll" />
@@ -51,18 +55,63 @@
5155
</PropertyGroup>
5256
</Target>
5357

54-
<Target Name="CreateAllRuntimePacks" >
58+
<Target Name="CreateAllPacks"
59+
DependsOnTargets="DeleteExtractedWorkloadPacks" >
60+
<RemoveDir Directories="$(XamarinAndroidSourcePath)bin\Build$(Configuration)\nupkgs" />
5561
<Exec Command="$(DotNetPreviewTool) pack -p:Configuration=$(Configuration) -p:AndroidRID=android.21-arm -p:AndroidABI=armeabi-v7a &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Runtime.proj&quot;" />
5662
<Exec Command="$(DotNetPreviewTool) pack -p:Configuration=$(Configuration) -p:AndroidRID=android.21-arm64 -p:AndroidABI=arm64-v8a &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Runtime.proj&quot;" />
5763
<Exec Command="$(DotNetPreviewTool) pack -p:Configuration=$(Configuration) -p:AndroidRID=android.21-x86 -p:AndroidABI=x86 &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Runtime.proj&quot;" />
5864
<Exec Command="$(DotNetPreviewTool) pack -p:Configuration=$(Configuration) -p:AndroidRID=android.21-x64 -p:AndroidABI=x86_64 &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Runtime.proj&quot;" />
59-
</Target>
60-
61-
<Target Name="CreateAllPacks"
62-
DependsOnTargets="CreateAllRuntimePacks" >
6365
<Exec Command="$(DotNetPreviewTool) pack -p:Configuration=$(Configuration) &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Ref.proj&quot;" />
6466
<Exec Command="$(DotNetPreviewTool) pack -p:Configuration=$(Configuration) &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Sdk.proj&quot;" />
65-
<Exec Command="$(DotNetPreviewTool) pack -p:Configuration=$(Configuration) &quot;$(MSBuildThisFileDirectory)Xamarin.Android.Sdk.Lite.proj&quot;" />
67+
<Exec Command="$(DotNetPreviewTool) pack -p:Configuration=$(Configuration) &quot;$(MSBuildThisFileDirectory)Microsoft.NET.Workload.Android.proj&quot;" />
68+
</Target>
69+
70+
<Target Name="ExtractWorkloadPacks"
71+
DependsOnTargets="DeleteExtractedWorkloadPacks" >
72+
<ItemGroup>
73+
<_WLManifest Include="$(XamarinAndroidSourcePath)bin\Build$(Configuration)\nupkgs\Microsoft.NET.Workload.Android.*.nupkg" />
74+
<_WLPacks Include="$(XamarinAndroidSourcePath)bin\Build$(Configuration)\nupkgs\Microsoft.Android.Sdk.*.nupkg" />
75+
<_WLPacks Include="$(XamarinAndroidSourcePath)bin\Build$(Configuration)\nupkgs\Microsoft.Android.Ref.*.nupkg" />
76+
<!-- Runtime packs are not yet supported by workloads -->
77+
<!-- <_WLPacks Include="$(XamarinAndroidSourcePath)bin\Build$(Configuration)\nupkgs\Microsoft.Android.Runtime.*.nupkg" /> -->
78+
</ItemGroup>
79+
<PropertyGroup>
80+
<_WLPackVersion>@(_WLManifest->'%(Filename)'->Replace('Microsoft.NET.Workload.Android.', ''))</_WLPackVersion>
81+
</PropertyGroup>
82+
<Unzip
83+
SourceFiles="@(_WLManifest)"
84+
DestinationFolder="$(DotNetPreviewPath)sdk-manifests\$(DotNetPreviewVersionBand)\Microsoft.NET.Workload.Android"
85+
/>
86+
<Unzip
87+
SourceFiles="@(_WLPacks)"
88+
DestinationFolder="$(DotNetPreviewPath)packs\$([System.String]::Copy('%(_WLPacks.Filename)').Replace('.$(_WLPackVersion)', ''))\$(_WLPackVersion)"
89+
/>
90+
<ItemGroup>
91+
<_UnixExecutables Include="$(DotNetPreviewPath)packs\Microsoft.Android.Sdk\*\tools\$(HostOS)\**\*.*" />
92+
<_FilesToTouch Include="$(DotNetPreviewPath)sdk-manifests\$(DotNetPreviewVersionBand)\Microsoft.NET.Workload.Android\**" />
93+
<_FilesToTouch Include="$(DotNetPreviewPath)packs\$([System.String]::Copy('%(_WLPacks.Filename)').Replace('.$(_WLPackVersion)', ''))\$(_WLPackVersion)\**" />
94+
</ItemGroup>
95+
<Exec
96+
Condition=" '$(HostOS)' == 'Darwin' or '$(HostOS)' == 'Linux' "
97+
Command="chmod +x &quot;%(_UnixExecutables.Identity)&quot;"
98+
/>
99+
<!-- Some files had timestamps in the future -->
100+
<Touch Files="@(_FilesToTouch)" />
101+
<Touch
102+
Files="$(_WorkloadResolverFlagFile)"
103+
AlwaysCreate="true"
104+
/>
105+
</Target>
106+
107+
<Target Name="DeleteExtractedWorkloadPacks" >
108+
<ItemGroup>
109+
<_PackFilesToDelete Include="$(DotNetPreviewPath)sdk-manifests\$(DotNetPreviewVersionBand)\Microsoft.Android.Workload\**\*.*" />
110+
<_PackFilesToDelete Include="$(DotNetPreviewPath)sdk-manifests\$(DotNetPreviewVersionBand)\Microsoft.NET.Workload.Android\**\*.*" />
111+
<_PackFilesToDelete Include="$(DotNetPreviewPath)packs\Microsoft.Android*\**\*.*" />
112+
</ItemGroup>
113+
<RemoveDir Directories="%(_PackFilesToDelete.RootDir)%(_PackFilesToDelete.Directory)" />
114+
<Delete Files="$(_WorkloadResolverFlagFile)" />
66115
</Target>
67116

68117
</Project>

build-tools/create-packs/Microsoft.Android.Sdk.proj

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
***********************************************************************************************
33
Microsoft.Android.Sdk.proj
44
5-
This project file is used to create the Microsoft.Android.Sdk NuGet, which will serve as
6-
the new entry point for short-form style Android projets in .NET 5.
5+
This project file is used to create the Microsoft.Android.Sdk NuGet, which is the core workload
6+
sdk pack imported by Microsoft.NET.Workload.Android.
77
***********************************************************************************************
88
-->
99
<Project Sdk="Microsoft.Build.NoTargets">
@@ -19,7 +19,7 @@ the new entry point for short-form style Android projets in .NET 5.
1919
</PropertyGroup>
2020

2121
<ItemGroup>
22-
<PackageReference Include="Mono.Posix.NETStandard" Version="5.20.1-preview" GeneratePathProperty="true" />
22+
<PackageReference Include="Mono.Posix.NETStandard" Version="5.20.1-preview" GeneratePathProperty="true" PrivateAssets="all" />
2323
</ItemGroup>
2424

2525
<Import Project="..\..\Configuration.props" />
@@ -77,9 +77,7 @@ the new entry point for short-form style Android projets in .NET 5.
7777
<_PackageFiles Include="$(XAInstallPrefix)xbuild-frameworks\Microsoft.Android\Version*" PackagePath="tools" />
7878
<_PackageFiles Include="$(XamarinAndroidSourcePath)src\Xamarin.Android.Build.Tasks\Microsoft.Android.Sdk\Sdk\**" PackagePath="Sdk" />
7979
<_PackageFiles Include="$(XamarinAndroidSourcePath)src\Microsoft.Android.Sdk.ILLink\PreserveLists\**" PackagePath="PreserveLists" />
80-
<_PackageFiles Include="$(XamarinAndroidSourcePath)src\Xamarin.Android.Build.Tasks\Microsoft.Android.Sdk\targets\**"
81-
Exclude="$(XamarinAndroidSourcePath)src\Xamarin.Android.Build.Tasks\Microsoft.Android.Sdk\**\*.Lite.*"
82-
PackagePath="targets" />
80+
<_PackageFiles Include="$(XamarinAndroidSourcePath)src\Xamarin.Android.Build.Tasks\Microsoft.Android.Sdk\targets\**" PackagePath="targets" />
8381
</ItemGroup>
8482
</Target>
8583

@@ -90,19 +88,19 @@ the new entry point for short-form style Android projets in .NET 5.
9088
DependsOnTargets="_GetDefaultPackageVersion" >
9189
<PropertyGroup>
9290
<_AndroidNETAppTargetFramework>net5.0</_AndroidNETAppTargetFramework>
93-
<BundledVersionsPropsFileName>Microsoft.Android.Sdk.BundledVersions.props</BundledVersionsPropsFileName>
91+
<BundledVersionsFileName>Microsoft.Android.Sdk.BundledVersions.targets</BundledVersionsFileName>
9492
</PropertyGroup>
9593

9694
<ItemGroup>
9795
<_AndroidNETAppRuntimePackRids Include="android.21-arm;android.21-arm64;android.21-x86;android.21-x64" />
9896
</ItemGroup>
9997

10098
<PropertyGroup>
101-
<BundledVersionsPropsContent>
99+
<BundledVersionsContent>
102100
<![CDATA[
103101
<!--
104102
***********************************************************************************************
105-
$(BundledVersionsPropsFileName)
103+
$(BundledVersionsFileName)
106104
WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
107105
created a backup copy. Incorrect changes to this file will make it
108106
impossible to load or build your projects from the command-line or the IDE.
@@ -130,11 +128,11 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
130128
</ItemGroup>
131129
</Project>
132130
]]>
133-
</BundledVersionsPropsContent>
131+
</BundledVersionsContent>
134132
</PropertyGroup>
135133

136-
<WriteLinesToFile File="$(XamarinAndroidSourcePath)src\Xamarin.Android.Build.Tasks\Microsoft.Android.Sdk\targets\$(BundledVersionsPropsFileName)"
137-
Lines="$(BundledVersionsPropsContent)"
134+
<WriteLinesToFile File="$(XamarinAndroidSourcePath)src\Xamarin.Android.Build.Tasks\Microsoft.Android.Sdk\targets\$(BundledVersionsFileName)"
135+
Lines="$(BundledVersionsContent)"
138136
Overwrite="true" />
139137
</Target>
140138

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<!--
2+
***********************************************************************************************
3+
Microsoft.NET.Workload.Android.proj
4+
5+
This project file is used to create the Microsoft.NET.Workload.Android NuGet, which is the
6+
workload manifest pack containing information about the various Microsoft.Android workloads.
7+
***********************************************************************************************
8+
-->
9+
<Project Sdk="Microsoft.Build.NoTargets">
10+
11+
<PropertyGroup>
12+
<TargetFramework>netcoreapp3.1</TargetFramework>
13+
<PackageId>Microsoft.NET.Workload.Android</PackageId>
14+
<Authors>Microsoft</Authors>
15+
<Description>Microsoft.Android workload manifest. Please do not reference directly.</Description>
16+
<OutputPath>..\..\bin\Build$(Configuration)\nupkgs\</OutputPath>
17+
</PropertyGroup>
18+
19+
<Import Project="..\..\Configuration.props" />
20+
<Import Project="..\..\build-tools\installers\create-installers.targets" />
21+
22+
<PropertyGroup>
23+
<BeforePack>
24+
_GenerateXAWorkloadContent;
25+
$(BeforePack);
26+
</BeforePack>
27+
</PropertyGroup>
28+
29+
<!-- FIXME: Temporarily Generate WorkloadManifest.targets and WorkloadManifest.json files inline while content is trivial. -->
30+
<Target Name="_GenerateXAWorkloadContent"
31+
DependsOnTargets="_GetDefaultPackageVersion" >
32+
<PropertyGroup>
33+
<WorkloadManifestTargetsPath>$(OutputPath)\workload-manifest\WorkloadManifest.targets</WorkloadManifestTargetsPath>
34+
<WorkloadManifestJsonPath>$(OutputPath)\workload-manifest\WorkloadManifest.json</WorkloadManifestJsonPath>
35+
<WorkloadManifestTargetsContent>
36+
<![CDATA[
37+
<Project>
38+
<Import Project="Sdk.targets"
39+
Sdk="Microsoft.Android.Sdk"
40+
Condition=" '%24(TargetPlatformIdentifier)' == 'Android' " />
41+
</Project>
42+
]]>
43+
</WorkloadManifestTargetsContent>
44+
<WorkloadManifestJsonContent>
45+
<![CDATA[
46+
{
47+
"version": 5,
48+
"workloads": {
49+
"microsoft-android-sdk-full": {
50+
"description": "Android SDK",
51+
"packs": [
52+
"Microsoft.Android.Sdk",
53+
"Microsoft.Android.Ref",
54+
]
55+
}
56+
},
57+
"packs": {
58+
"Microsoft.Android.Sdk": {
59+
"kind": "sdk",
60+
"version": "$(AndroidPackVersionLong)"
61+
},
62+
"Microsoft.Android.Ref": {
63+
"kind": "framework",
64+
"version": "$(AndroidPackVersionLong)"
65+
}
66+
}
67+
}
68+
]]>
69+
</WorkloadManifestJsonContent>
70+
</PropertyGroup>
71+
72+
<WriteLinesToFile File="$(WorkloadManifestTargetsPath)"
73+
Lines="$(WorkloadManifestTargetsContent)"
74+
Overwrite="true" />
75+
76+
<WriteLinesToFile File="$(WorkloadManifestJsonPath)"
77+
Lines="$(WorkloadManifestJsonContent)"
78+
Overwrite="true" />
79+
80+
<ItemGroup>
81+
<_PackageFiles Include="$(WorkloadManifestTargetsPath)" PackagePath="\" />
82+
<_PackageFiles Include="$(WorkloadManifestJsonPath)" PackagePath="\" />
83+
</ItemGroup>
84+
</Target>
85+
86+
</Project>

0 commit comments

Comments
 (0)