Skip to content
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

[One .NET] Initial workload support #5195

Merged
merged 23 commits into from
Oct 21, 2020
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9effc6e
Initial workload drop
pjcollins Oct 7, 2020
3399ea5
Update test project SDK import
pjcollins Oct 9, 2020
523f64b
Remove Xamarin.Android.Sdk.Lite
pjcollins Oct 9, 2020
d2abf96
Install workloads in CI
pjcollins Oct 9, 2020
746b4cd
Update common properties and tests for new import ordering
pjcollins Oct 12, 2020
67656d5
Apply feedback and fix macOS executable extraction
pjcollins Oct 12, 2020
42f6946
Fix casing typo
pjcollins Oct 13, 2020
936d853
Move capabilities, remove $(TargetPlatformIdentifier) checks
pjcollins Oct 14, 2020
8324592
Rename .props files imported by Microsoft.Android.Sdk.targets
pjcollins Oct 14, 2020
c7fbffe
Separate out workload cleanup target
pjcollins Oct 14, 2020
6f1a0e4
Move $(TargetPlatformSupported) to Microsoft.Android.Sdk.SupportedPla…
pjcollins Oct 14, 2020
8ec2c0c
Ensure relevant darwin _and_ linux workload files are executable
pjcollins Oct 14, 2020
9e4e07e
Remove Microsoft.Android.Sdk.DefaultItems.props
jonathanpeppers Oct 16, 2020
decc96a
Move @(ProjectCapability) items to their own file
jonathanpeppers Oct 16, 2020
480006d
ExtractWorkloadPacks should <Touch/> all files
jonathanpeppers Oct 16, 2020
420928f
Merge remote-tracking branch 'upstream/master' into workload-playground
jonathanpeppers Oct 16, 2020
d26730b
Remove TODO in DotNetPack test
jonathanpeppers Oct 19, 2020
45e811b
Fix for using net5.0-android30.0 in NuGet packages
jonathanpeppers Oct 19, 2020
a504378
Temporary fix for _AndroidXShouldRunMigration=false
jonathanpeppers Oct 19, 2020
809ebf5
Rename workload to Microsoft.NET.Workload.Android
pjcollins Oct 20, 2020
052862a
Clean up old workload pack name
pjcollins Oct 20, 2020
545e524
Merge remote-tracking branch 'upstream/master' into workload-playground
pjcollins Oct 20, 2020
b2076e0
Fix version miscalculation that can occur in PR builds
pjcollins Oct 20, 2020
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
3 changes: 3 additions & 0 deletions Configuration.props
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@
<AndroidNdkDirectory Condition=" '$(AndroidNdkDirectory)' == '' ">$(AndroidToolchainDirectory)\ndk</AndroidNdkDirectory>
<DotNetPreviewPath Condition=" '$(DotNetPreviewPath)' == '' ">$(AndroidToolchainDirectory)\dotnet\</DotNetPreviewPath>
<DotNetPreviewTool Condition=" '$(DotNetPreviewTool)' == '' ">$(DotNetPreviewPath)dotnet</DotNetPreviewTool>
<!-- Version number from: https://github.com/dotnet/installer#installers-and-binaries -->
<DotNetPreviewVersionBand Condition=" '$(DotNetPreviewVersionBand)' == '' ">5.0.100</DotNetPreviewVersionBand>
<DotNetPreviewVersionFull Condition=" '$(DotNetPreviewVersionFull)' == '' ">$(DotNetPreviewVersionBand)-rtm.20509.5</DotNetPreviewVersionFull>
<AndroidCmakeVersion Condition=" '$(AndroidCmakeVersion)' == '' ">3.10.2</AndroidCmakeVersion>
<AndroidCmakeVersionPath Condition=" '$(AndroidCmakeVersionPath)' == '' ">$(AndroidCmakeVersion).4988404</AndroidCmakeVersionPath>
<AndroidSdkCmakeDirectory>$(AndroidSdkDirectory)\cmake\$(AndroidCmakeVersionPath)</AndroidSdkCmakeDirectory>
Expand Down
2 changes: 1 addition & 1 deletion Documentation/guides/OneDotNet.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ not be supported:

## Default file inclusion

Default Android related file globbing behavior is defined in `Microsoft.Android.Sdk.DefaultItems.targets`.
Default Android related file globbing behavior is defined in `Microsoft.Android.Sdk.DefaultItems.props`.
This behavior can be disabled for Android items by setting `$(EnableDefaultAndroidItems)` to `false`, or
all default item inclusion behavior can be disabled by setting `$(EnableDefaultItems)` to `false`.

Expand Down
20 changes: 2 additions & 18 deletions build-tools/automation/azure-pipelines.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -320,12 +320,13 @@ stages:
configuration: $(XA.Build.Configuration)
msbuildArguments: /t:Prepare /p:AutoProvision=true /bl:$(System.DefaultWorkingDirectory)\bin\Build$(XA.Build.Configuration)\msbuild-prepare.binlog

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

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

- task: MSBuild@1
displayName: pack all nupkgs
inputs:
solution: $(System.DefaultWorkingDirectory)\build-tools\create-packs\Microsoft.Android.Sdk.proj
configuration: $(XA.Build.Configuration)
msbuildArguments: /t:CreateAllPacks /restore /bl:$(System.DefaultWorkingDirectory)\bin\Build$(XA.Build.Configuration)\create-all-packs.binlog

- task: CmdLine@1
displayName: xabuild Xamarin.Android-Tests
inputs:
Expand Down Expand Up @@ -692,11 +686,6 @@ stages:
artifactName: $(TestAssembliesArtifactName)
downloadPath: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)

- task: DownloadPipelineArtifact@2
inputs:
artifactName: $(NuGetArtifactName)
downloadPath: $(System.DefaultWorkingDirectory)/bin/Build$(XA.Build.Configuration)/$(NuGetArtifactName)

- task: MSBuild@1
displayName: start emulator
inputs:
Expand Down Expand Up @@ -857,11 +846,6 @@ stages:
artifactName: $(TestAssembliesArtifactName)
downloadPath: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)

- task: DownloadPipelineArtifact@2
inputs:
artifactName: $(NuGetArtifactName)
downloadPath: $(System.DefaultWorkingDirectory)/bin/Build$(XA.Build.Configuration)/$(NuGetArtifactName)

- task: MSBuild@1
displayName: start emulator
inputs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,6 @@ jobs:
artifactName: $(TestAssembliesArtifactName)
downloadPath: $(System.DefaultWorkingDirectory)/bin/Test$(XA.Build.Configuration)

- task: DownloadPipelineArtifact@1
inputs:
artifactName: $(NuGetArtifactName)
downloadPath: $(System.DefaultWorkingDirectory)/bin/Build$(XA.Build.Configuration)/$(NuGetArtifactName)

- template: run-nunit-tests.yaml
parameters:
useDotNet: $(UseDotNet)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ jobs:
artifactName: $(TestAssembliesArtifactName)
downloadPath: $(System.DefaultWorkingDirectory)\bin\Test$(XA.Build.Configuration)

- task: DownloadPipelineArtifact@1
inputs:
artifactName: $(NuGetArtifactName)
downloadPath: $(System.DefaultWorkingDirectory)\bin\Build$(XA.Build.Configuration)\$(NuGetArtifactName)

# 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.
# Using all available cores seems to occasionally bog down our machines and cause parallel test execution to slow down dramatically.
- template: run-nunit-tests.yaml
Expand Down
13 changes: 13 additions & 0 deletions build-tools/automation/yaml-templates/setup-test-environment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,16 @@ steps:
solution: ${{ parameters.xaSourcePath }}/build-tools/xamarin.Android.Tools.BootstrapTasks/Xamarin.Android.Tools.BootstrapTasks.csproj
configuration: ${{ parameters.configuration }}
msbuildArguments: /restore /bl:${{ parameters.xaSourcePath }}/bin/Test${{ parameters.configuration }}/BootstrapTasks.binlog

# Download and install .NET nupkgs
- task: DownloadPipelineArtifact@2
inputs:
artifactName: $(NuGetArtifactName)
downloadPath: ${{ parameters.xaSourcePath }}/bin/Build${{ parameters.configuration }}/$(NuGetArtifactName)

- task: MSBuild@1
displayName: extract workload packs
inputs:
solution: ${{ parameters.xaSourcePath }}/build-tools/create-packs/Microsoft.Android.Sdk.proj
configuration: ${{ parameters.configuration }}
msbuildArguments: /t:ExtractWorkloadPacks /restore /bl:${{ parameters.xaSourcePath }}/bin/Test${{ parameters.configuration }}/extract-workloads.binlog
36 changes: 35 additions & 1 deletion build-tools/create-packs/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,41 @@
DependsOnTargets="CreateAllRuntimePacks" >
<Exec Command="$(DotNetPreviewTool) pack -p:Configuration=$(Configuration) &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Ref.proj&quot;" />
<Exec Command="$(DotNetPreviewTool) pack -p:Configuration=$(Configuration) &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Sdk.proj&quot;" />
<Exec Command="$(DotNetPreviewTool) pack -p:Configuration=$(Configuration) &quot;$(MSBuildThisFileDirectory)Xamarin.Android.Sdk.Lite.proj&quot;" />
<Exec Command="$(DotNetPreviewTool) pack -p:Configuration=$(Configuration) &quot;$(MSBuildThisFileDirectory)Microsoft.Android.Workload.proj&quot;" />
</Target>

<Target Name="ExtractWorkloadPacks"
DependsOnTargets="GetXAVersionInfo" >
<ItemGroup>
<_PackFilesToDelete Include="$(DotNetPreviewPath)packs\Microsoft.Android*\**\*.*" />
<_WLManifest Include="$(XamarinAndroidSourcePath)bin\Build$(Configuration)\nupkgs\Microsoft.Android.Workload.$(AndroidPackVersionLong).nupkg" />
<_WLPacks Include="$(XamarinAndroidSourcePath)bin\Build$(Configuration)\nupkgs\Microsoft.Android.Sdk.$(AndroidPackVersionLong).nupkg" />
<_WLPacks Include="$(XamarinAndroidSourcePath)bin\Build$(Configuration)\nupkgs\Microsoft.Android.Ref.$(AndroidPackVersionLong).nupkg" />
<!-- Runtime packs are not yet supported by workloads -->
<!-- <_WLPacks Include="$(XamarinAndroidSourcePath)bin\Build$(Configuration)\nupkgs\Microsoft.Android.Runtime.$(AndroidPackVersionLong).nupkg" /> -->
</ItemGroup>
<RemoveDir
Directories="%(_PackFilesToDelete.RootDir)%(_PackFilesToDelete.Directory)"
/>
<Unzip
SourceFiles="@(_WLManifest)"
DestinationFolder="$(DotNetPreviewPath)sdk-manifests\$(DotNetPreviewVersionBand)\Microsoft.Android.Workload"
/>
<Unzip
SourceFiles="@(_WLPacks)"
DestinationFolder="$(DotNetPreviewPath)packs\$([System.String]::Copy('%(_WLPacks.Filename)').Replace('.$(AndroidPackVersionLong)', ''))\$(AndroidPackVersionLong)"
/>
<ItemGroup>
<_UnixExecutables Include="$(DotNetPreviewPath)packs\Microsoft.Android.Sdk\*\tools\$(HostOS)\**\*.*" />
</ItemGroup>
<Exec
Condition="$([MSBuild]::IsOSPlatform('osx'))"
Command="chmod +x &quot;%(_UnixExecutables.Identity)&quot;"
/>
<Touch
Files="$(DotNetPreviewPath)sdk\$(DotNetPreviewVersionFull)\EnableWorkloadResolver.sentinel"
AlwaysCreate="true"
/>
</Target>

</Project>
10 changes: 4 additions & 6 deletions build-tools/create-packs/Microsoft.Android.Sdk.proj
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
***********************************************************************************************
Microsoft.Android.Sdk.proj

This project file is used to create the Microsoft.Android.Sdk NuGet, which will serve as
the new entry point for short-form style Android projets in .NET 5.
This project file is used to create the Microsoft.Android.Sdk NuGet, which is the core workload
sdk pack imported by Microsoft.Android.Workload.
***********************************************************************************************
-->
<Project Sdk="Microsoft.Build.NoTargets">
Expand All @@ -19,7 +19,7 @@ the new entry point for short-form style Android projets in .NET 5.
</PropertyGroup>

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

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

Expand Down
86 changes: 86 additions & 0 deletions build-tools/create-packs/Microsoft.Android.Workload.proj
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
<!--
***********************************************************************************************
Microsoft.Android.Workload.proj

This project file is used to create the Microsoft.Android.Workload NuGet, which is the
workload manifest pack containing information about the various Microsoft.Android workloads.
***********************************************************************************************
-->
<Project Sdk="Microsoft.Build.NoTargets">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<PackageId>Microsoft.Android.Workload</PackageId>
<Authors>Microsoft</Authors>
<Description>Microsoft.Android workload manifest. Please do not reference directly.</Description>
<OutputPath>..\..\bin\Build$(Configuration)\nupkgs\</OutputPath>
</PropertyGroup>

<Import Project="..\..\Configuration.props" />
<Import Project="..\..\build-tools\installers\create-installers.targets" />

<PropertyGroup>
<BeforePack>
_GenerateXAWorkloadContent;
$(BeforePack);
</BeforePack>
</PropertyGroup>

<!-- FIXME: Temporarily Generate WorkloadManifest.targets and WorkloadManifest.json files inline while content is trivial. -->
<Target Name="_GenerateXAWorkloadContent"
DependsOnTargets="_GetDefaultPackageVersion" >
<PropertyGroup>
<WorkloadManifestTargetsPath>$(OutputPath)\workload-manifest\WorkloadManifest.targets</WorkloadManifestTargetsPath>
<WorkloadManifestJsonPath>$(OutputPath)\workload-manifest\WorkloadManifest.json</WorkloadManifestJsonPath>
<WorkloadManifestTargetsContent>
<![CDATA[
<Project>
<Import Project="Sdk.targets"
Sdk="Microsoft.Android.SDK"
Condition=" '%24(TargetPlatformIdentifier)' == 'Android' " />
</Project>
]]>
</WorkloadManifestTargetsContent>
<WorkloadManifestJsonContent>
<![CDATA[
{
"version": 5,
"workloads": {
"microsoft-android-sdk-full": {
"description": "Android SDK",
"packs": [
"Microsoft.Android.Sdk",
"Microsoft.Android.Ref",
]
}
},
"packs": {
"Microsoft.Android.Sdk": {
"kind": "sdk",
"version": "$(AndroidPackVersionLong)"
},
"Microsoft.Android.Ref": {
"kind": "framework",
"version": "$(AndroidPackVersionLong)"
}
}
}
]]>
</WorkloadManifestJsonContent>
</PropertyGroup>

<WriteLinesToFile File="$(WorkloadManifestTargetsPath)"
Lines="$(WorkloadManifestTargetsContent)"
Overwrite="true" />

<WriteLinesToFile File="$(WorkloadManifestJsonPath)"
Lines="$(WorkloadManifestJsonContent)"
Overwrite="true" />

<ItemGroup>
<_PackageFiles Include="$(WorkloadManifestTargetsPath)" PackagePath="\" />
<_PackageFiles Include="$(WorkloadManifestJsonPath)" PackagePath="\" />
</ItemGroup>
</Target>

</Project>
39 changes: 0 additions & 39 deletions build-tools/create-packs/Xamarin.Android.Sdk.Lite.proj

This file was deleted.

1 change: 1 addition & 0 deletions build-tools/scripts/DotNet.targets
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<MSBuild Projects="$(_TopDir)build-tools\xa-prep-tasks\xa-prep-tasks.csproj" />
<MSBuild Projects="$(_TopDir)Xamarin.Android.sln" Properties="DisableApiCompatibilityCheck=true" />
<MSBuild Projects="$(_TopDir)build-tools\create-packs\Microsoft.Android.Sdk.proj" Targets="CreateAllPacks" />
<MSBuild Projects="$(_TopDir)build-tools\create-packs\Microsoft.Android.Sdk.proj" Targets="ExtractWorkloadPacks" />
<!-- Clean up old, previously restored packages -->
<ItemGroup>
<_OldPackages Include="$(_TopDir)packages\microsoft.android.*\**\*.nupkg" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ static class KnownProperties
public const string CommandLineToolsVersion = nameof (CommandLineToolsVersion);
public const string CommandLineToolsFolder = nameof (CommandLineToolsFolder);
public const string DotNetPreviewPath = "DotNetPreviewPath";
public const string DotNetPreviewVersionFull = "DotNetPreviewVersionFull";
public const string EmulatorVersion = "EmulatorVersion";
public const string EmulatorPkgRevision = "EmulatorPkgRevision";
public const string IgnoreMaxMonoVersion = "IgnoreMaxMonoVersion";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ namespace Xamarin.Android.Prepare
properties.Add (KnownProperties.CommandLineToolsFolder, StripQuotes ("@CommandLineToolsFolder@"));
properties.Add (KnownProperties.CommandLineToolsVersion, StripQuotes ("@CommandLineToolsVersion@"));
properties.Add (KnownProperties.DotNetPreviewPath, StripQuotes (@"@DotNetPreviewPath@"));
properties.Add (KnownProperties.DotNetPreviewVersionFull, StripQuotes ("@DotNetPreviewVersionFull@"));
properties.Add (KnownProperties.EmulatorVersion, StripQuotes ("@EmulatorVersion@"));
properties.Add (KnownProperties.EmulatorPkgRevision, StripQuotes ("@EmulatorPkgRevision@"));
properties.Add (KnownProperties.IgnoreMaxMonoVersion, StripQuotes ("@IgnoreMaxMonoVersion@"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,6 @@ public static partial class Defaults
public static readonly Version JetBrainsOpenJDK8Version = new Version (Configurables.JetBrainsOpenJDK8VersionFull);
public static readonly Version JetBrainsOpenJDK8Release = new Version (Configurables.JetBrainsOpenJDK8Release);

// Version number from: https://github.com/dotnet/installer#installers-and-binaries
public const string DotNetPreviewVersion = "5.0.100-rc.2.20480.7";
public const string DotNetTestRuntimeVersion = "3.1.3";

// Mono runtimes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ protected override async Task<bool> Execute (Context context)
{
var dotnetPath = context.Properties.GetRequiredValue (KnownProperties.DotNetPreviewPath);
dotnetPath = dotnetPath.TrimEnd (new char [] { Path.DirectorySeparatorChar });
var dotnetPreviewVersion = Configurables.Defaults.DotNetPreviewVersion;
var dotnetPreviewVersion = context.Properties.GetRequiredValue (KnownProperties.DotNetPreviewVersionFull);
var dotnetTestRuntimeVersion = Configurables.Defaults.DotNetTestRuntimeVersion;

// Delete any custom Microsoft.Android packs that may have been installed by test runs. Other ref/runtime packs will be ignored.
Expand Down
1 change: 1 addition & 0 deletions build-tools/xaprepare/xaprepare/xaprepare.targets
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
<Replacement Include="@CommandLineToolsFolder@=$(CommandLineToolsFolder)" />
<Replacement Include="@CommandLineToolsVersion@=$(CommandLineToolsVersion)" />
<Replacement Include="@DotNetPreviewPath@=$(DotNetPreviewPath)" />
<Replacement Include="@DotNetPreviewVersionFull@=$(DotNetPreviewVersionFull)" />
<Replacement Include="@EmulatorVersion@=$(EmulatorVersion)" />
<Replacement Include="@EmulatorPkgRevision@=$(EmulatorPkgRevision)" />
<Replacement Include="@IgnoreMaxMonoVersion@=$(IgnoreMaxMonoVersion)" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\targets\Microsoft.Android.Sdk.DefaultItems.props" />
</Project>

This file was deleted.

Loading