Skip to content

Commit

Permalink
Build VS installers for WebAssembly and Mobile workloads (dotnet#55769)
Browse files Browse the repository at this point in the history
In order to support generating installers, this change adds the mono.workloads subset and the associated yml.
  • Loading branch information
directhex authored Jul 22, 2021
1 parent 1b4f786 commit e60882e
Show file tree
Hide file tree
Showing 12 changed files with 499 additions and 1 deletion.
1 change: 1 addition & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
<CoreClrProjectRoot>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'src', 'coreclr'))</CoreClrProjectRoot>
<MonoProjectRoot>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'src', 'mono'))</MonoProjectRoot>
<InstallerProjectRoot>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'src', 'installer'))</InstallerProjectRoot>
<WorkloadsProjectRoot>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'src', 'workloads'))</WorkloadsProjectRoot>
<SharedNativeRoot>$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'src', 'native'))</SharedNativeRoot>
<RepoToolsLocalDir>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'tools-local'))</RepoToolsLocalDir>
<RepoTasksDir>$([MSBuild]::NormalizeDirectory('$(MSBuildThisFileDirectory)', 'src', 'tasks'))</RepoTasksDir>
Expand Down
7 changes: 6 additions & 1 deletion eng/Subsets.props
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@
<SubsetName Include="Mono.Packages" Description="The projects that produce NuGet packages for the Mono runtime." />
<SubsetName Include="Mono.WasmRuntime" Description="The WebAssembly runtime." />
<SubsetName Include="Mono.MsCorDbi" Description="The implementation of ICorDebug interface." />

<SubsetName Include="Mono.Workloads" OnDemand="true" Description="Builds the installers and the insertion metadata for Blazor workloads." />

<!-- Libs -->
<SubsetName Include="Libs" Description="The libraries native part, refs and source assemblies, test infra and packages, but NOT the tests (use Libs.Tests to request those explicitly)" />
<SubsetName Include="Libs.Native" Description="The native libraries used in the shared framework." />
Expand Down Expand Up @@ -247,6 +248,10 @@
<ItemGroup Condition="$(_subset.Contains('+mono.corelib+'))">
<ProjectToBuild Include="$(MonoProjectRoot)System.Private.CoreLib\System.Private.CoreLib.csproj" Category="mono" />
</ItemGroup>

<ItemGroup Condition="$(_subset.Contains('+mono.workloads+'))">
<ProjectToBuild Include="$(WorkloadsProjectRoot)\workloads.csproj" Category="mono" />
</ItemGroup>

<!-- Libraries sets -->
<ItemGroup Condition="$(_subset.Contains('+libs.native+'))">
Expand Down
4 changes: 4 additions & 0 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>e97027cf100d2b532adce387e5cb93a373de93c9</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.Build.Tasks.Workloads" Version="6.0.0-beta.21369.3">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>e97027cf100d2b532adce387e5cb93a373de93c9</Sha>
</Dependency>
<Dependency Name="Microsoft.DotNet.CodeAnalysis" Version="6.0.0-beta.21369.3">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>e97027cf100d2b532adce387e5cb93a373de93c9</Sha>
Expand Down
7 changes: 7 additions & 0 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,10 @@
<MicrosoftDotNetXUnitConsoleRunnerVersion>2.5.1-beta.21369.3</MicrosoftDotNetXUnitConsoleRunnerVersion>
<MicrosoftDotNetBuildTasksArchivesVersion>6.0.0-beta.21369.3</MicrosoftDotNetBuildTasksArchivesVersion>
<MicrosoftDotNetBuildTasksPackagingVersion>6.0.0-beta.21369.3</MicrosoftDotNetBuildTasksPackagingVersion>
<MicrosoftDotNetBuildTasksInstallersPackageVersion>6.0.0-beta.21369.3</MicrosoftDotNetBuildTasksInstallersPackageVersion>
<MicrosoftDotNetBuildTasksInstallersVersion>6.0.0-beta.21369.3</MicrosoftDotNetBuildTasksInstallersVersion>
<MicrosoftDotNetBuildTasksPackagingVersion>6.0.0-beta.21369.3</MicrosoftDotNetBuildTasksPackagingVersion>
<MicrosoftDotNetBuildTasksWorkloadsPackageVersion>6.0.0-beta.21369.3</MicrosoftDotNetBuildTasksWorkloadsPackageVersion>
<MicrosoftDotNetRemoteExecutorVersion>6.0.0-beta.21369.3</MicrosoftDotNetRemoteExecutorVersion>
<MicrosoftDotNetVersionToolsTasksVersion>6.0.0-beta.21369.3</MicrosoftDotNetVersionToolsTasksVersion>
<MicrosoftDotNetPackageTestingVersion>6.0.0-beta.21369.3</MicrosoftDotNetPackageTestingVersion>
Expand Down Expand Up @@ -183,5 +186,9 @@
<!-- emscripten / Node -->
<MicrosoftNETWorkloadEmscriptenManifest60100Version>6.0.0-rc.1.21369.1</MicrosoftNETWorkloadEmscriptenManifest60100Version>
<MicrosoftNETRuntimeEmscriptenVersion>$(MicrosoftNETWorkloadEmscriptenManifest60100Version)</MicrosoftNETRuntimeEmscriptenVersion>
<!-- workloads -->
<SwixPackageVersion>1.1.87-gba258badda</SwixPackageVersion>
<WixPackageVersion>3.14.0-dotnet</WixPackageVersion>
<MonoWorkloadManifestVersion>6.0.0-preview.5.21275.7</MonoWorkloadManifestVersion>
</PropertyGroup>
</Project>
100 changes: 100 additions & 0 deletions eng/pipelines/mono/templates/workloads-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
parameters:
archType: ''
buildConfig: ''
container: ''
dependOnEvaluatePaths: false
dependsOn: []
isOfficialBuild: false
osGroup: ''
osSubgroup: ''
platform: ''
pool: ''
runtimeVariant: ''
stagedBuild: false
testGroup: ''
timeoutInMinutes: ''
variables: {}

jobs:
- template: xplat-pipeline-job.yml
parameters:
archType: ${{ parameters.archType }}
buildConfig: ${{ parameters.buildConfig }}
container: ${{ parameters.container }}
condition: ${{ parameters.isOfficialBuild }}
helixType: 'build/product/'
osGroup: ${{ parameters.osGroup }}
osSubgroup: ${{ parameters.osSubgroup }}
pool: ${{ parameters.pool }}
runtimeVariant: ${{ parameters.runtimeVariant }}
stagedBuild: ${{ parameters.stagedBuild }}
timeoutInMinutes: ${{ parameters.timeoutInMinutes }}
dependOnEvaluatePaths: ${{ parameters.dependOnEvaluatePaths }}

dependsOn: ${{ parameters.dependsOn }}

name: workloadsbuild
displayName: Build Workloads

variables:
- name: officialBuildIdArg
value: ''
- ${{ if and(eq(variables['System.TeamProject'], 'internal'), ne(variables['Build.Reason'], 'PullRequest')) }}:
- name: officialBuildIdArg
value: '/p:OfficialBuildId=$(Build.BuildNumber)'
- name: SignType
value: $[ coalesce(variables.OfficialSignType, 'real') ]
- ${{ parameters.variables }}

steps:
- task: DownloadPipelineArtifact@2
inputs:
artifact: 'IntermediateArtifacts'
path: $(workloadPackagesPath)
patterns: |
IntermediateArtifacts/MonoRuntimePacks/Shipping/Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.android-*.nupkg
IntermediateArtifacts/MonoRuntimePacks/Shipping/Microsoft.NETCore.App.Runtime.AOT.win-x64.Cross.browser-wasm*.nupkg
IntermediateArtifacts/MonoRuntimePacks/Shipping/Microsoft.NETCore.App.Runtime.Mono.android-*.nupkg
IntermediateArtifacts/MonoRuntimePacks/Shipping/Microsoft.NETCore.App.Runtime.Mono.browser-wasm*.nupkg
IntermediateArtifacts/MonoRuntimePacks/Shipping/Microsoft.NETCore.App.Runtime.Mono.ios-*.nupkg
IntermediateArtifacts/MonoRuntimePacks/Shipping/Microsoft.NETCore.App.Runtime.Mono.iossimulator-*.nupkg
IntermediateArtifacts/MonoRuntimePacks/Shipping/Microsoft.NETCore.App.Runtime.Mono.maccatalyst-*.nupkg
IntermediateArtifacts/MonoRuntimePacks/Shipping/Microsoft.NETCore.App.Runtime.Mono.tvos-*.nupkg
IntermediateArtifacts/MonoRuntimePacks/Shipping/Microsoft.NETCore.App.Runtime.Mono.tvossimulator-*.nupkg
IntermediateArtifacts/MonoRuntimePacks/Shipping/Microsoft.NET.Workload.Mono.ToolChain.Manifest*.nupkg
IntermediateArtifacts/MonoRuntimePacks/Shipping/Microsoft.NET.Runtime.MonoTargets.Sdk*.nupkg
IntermediateArtifacts/MonoRuntimePacks/Shipping/Microsoft.NET.Runtime.MonoAOTCompiler.Task*.nupkg
IntermediateArtifacts/MonoRuntimePacks/Shipping/Microsoft.NET.Runtime.WebAssembly.Sdk*.nupkg
- task: CopyFiles@2
displayName: Flatten packages
inputs:
sourceFolder: $(workloadPackagesPath)
contents: '*/Shipping/*.nupkg'
cleanTargetFolder: false
targetFolder: $(workloadPackagesPath)
flattenFolders: true

- script: $(Build.SourcesDirectory)$(dir)build$(scriptExt) -subset mono.workloads -arch $(archType) -c $(buildConfig) $(officialBuildIdArg) -ci
displayName: Build workload artifacts

# Upload packages wrapping msis
- template: /eng/pipelines/common/upload-intermediate-artifacts-step.yml
parameters:
name: workloads

# Delete wixpdb files before they are uploaded to artifacts
- task: DeleteFiles@1
displayName: Delete wixpdb's
inputs:
SourceFolder: $(workloadArtifactsPath)
Contents: '*.wixpdb'

# Upload artifacts to be used for generating VS components
- task: PublishPipelineArtifact@1
displayName: Publish workload artifacts
inputs:
targetPath: $(Build.SourcesDirectory)/artifacts/VSSetup/$(_BuildConfig)/Insertion
artifactName: 'Insertion'
continueOnError: true
condition: always()
6 changes: 6 additions & 0 deletions eng/pipelines/mono/templates/xplat-pipeline-job.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ jobs:
- name: nativeTestArtifactRootFolderPath
value: '$(binTestsPath)/obj/$(osGroup).$(archType).$(buildConfigUpper)'

- name: workloadPackagesPath
value: $(Build.SourcesDirectory)/artifacts/workloadPackages

- name: workloadArtifactsPath
value: $(Build.SourcesDirectory)/artifacts/workloads

- name: liveRuntimeBuildConfigUpper
${{ if eq(parameters.liveRuntimeBuildConfig, 'release') }}:
value: 'Release'
Expand Down
29 changes: 29 additions & 0 deletions eng/pipelines/runtime-official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,35 @@ stages:
- windows_x86
- Linux_x64

#
# Build Blazor Workload
#
- template: /eng/pipelines/common/platform-matrix.yml
parameters:
jobTemplate: /eng/pipelines/mono/templates/workloads-build.yml
buildConfig: release
platforms:
- windows_x64
jobParameters:
isOfficialBuild: ${{ variables.isOfficialBuild }}
dependsOn:
- Build_Android_arm_release_AllSubsets_Mono
- Build_Android_arm64_release_AllSubsets_Mono
- Build_Android_x86_release_AllSubsets_Mono
- Build_Android_x64_release_AllSubsets_Mono
- Build_Browser_wasm_release_AllSubsets_Mono
- Build_iOS_arm_release_AllSubsets_Mono
- Build_iOS_arm64_release_AllSubsets_Mono
- Build_iOSSimulator_x64_release_AllSubsets_Mono
- Build_iOSSimulator_x86_release_AllSubsets_Mono
- Build_iOSSimulator_arm64_release_AllSubsets_Mono
- Build_MacCatalyst_arm64_release_AllSubsets_Mono
- Build_MacCatalyst_x64_release_AllSubsets_Mono
- Build_tvOS_arm64_release_AllSubsets_Mono
- Build_tvOSSimulator_arm64_release_AllSubsets_Mono
- Build_tvOSSimulator_x64_release_AllSubsets_Mono
- Build_Windows_x64_release_CrossAOT_Mono

- ${{ if eq(variables.isOfficialBuild, true) }}:
- template: /eng/pipelines/official/stages/publish.yml
parameters:
Expand Down
42 changes: 42 additions & 0 deletions src/workloads/VSSetup.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VSSetupProps>1</VSSetupProps>
</PropertyGroup>

<PropertyGroup>
<VSDropServiceUri>https://vsdrop.corp.microsoft.com/file/v1/</VSDropServiceUri>
<DropServiceUri>https://devdiv.artifacts.visualstudio.com/</DropServiceUri>
<DropExe>$(MSBuildThisDirectory)Tools\Drop.App\lib\net45\Drop.exe</DropExe>
<!-- Default drop expiration date is 10 years from now -->
<DropExpiration Condition="'$(DropExpiration)' == ''">10</DropExpiration>
<DropExpirationDate>$([System.DateTime]::Now.AddYears($(DropExpiration)).ToString("M/d/yyyy h:m:s tt"))</DropExpirationDate>
<!-- Timeout in minutes -->
<DropTimeout>10</DropTimeout>
<!-- Can be set to 'info', 'warn', 'error', 'verbose' -->
<DropTraceLevel>verbose</DropTraceLevel>

<!-- Commandline parameters for drop.exe -->
<DropParamService>-s &quot;$(DropServiceUri)&quot;</DropParamService>
<DropParamTimeout>--timeout &quot;$(DropTimeout)&quot;</DropParamTimeout>
<DropParamTraceLevel>--tracelevel &quot;$(DropTraceLevel)&quot;</DropParamTraceLevel>
<DropParamExpirationDate>-x &quot;$(DropExpirationDate)&quot;</DropParamExpirationDate>
<!-- Use AAD for authentication -->
<DropParamAuth>-a</DropParamAuth>
</PropertyGroup>

<PropertyGroup>
<ManifestTeamProject Condition="'$(ManifestTeamProject)' == ''">dotnet</ManifestTeamProject>
<ManifestRepositoryName Condition="'$(ManifestRepositoryName)' == ''">installer</ManifestRepositoryName>
<ManifestBuildBranch Condition="'$(ManifestBuildBranch)' == ''">local_build</ManifestBuildBranch>
<ManifestBuildNumber Condition="'$(ManifestBuildNumber)' == ''">$([System.DateTime]::Now.ToString("yyMMdd")).1</ManifestBuildNumber>
</PropertyGroup>

<PropertyGroup>
<ManifestPublishUrl>https://vsdrop.corp.microsoft.com/file/v1/Products/$(ManifestTeamProject)/$(ManifestRepositoryName)/$(ManifestBuildBranch)/$(ManifestBuildNumber);</ManifestPublishUrl>
</PropertyGroup>

<PropertyGroup>
<ManifestIntermediateOutputPath>$(OutputPath)\obj\$(MSBuildProject)</ManifestIntermediateOutputPath>
</PropertyGroup>
</Project>
49 changes: 49 additions & 0 deletions src/workloads/VSSetup.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="VSSetup.props" Condition="'$(VSSetupProps)' != '1'"/>

<Target Name="PublishToVSDrop" DependsOnTargets="GetDropCmdLine">
<Exec Command="$(DropUpgradeCmd)" />
<Exec Command="$(DropCreateCmd)" />
<Exec Command="$(DropPublishCmd)" />
<Exec Command="$(DropFinalizeCmd)" />
<Exec Command="$(DropUpdateCmd)" />

<ItemGroup>
<DropManifests Include="$(VSDropSource)\*.vsman" />
</ItemGroup>

<WriteLinesToFile File="$(VSDropTxt)" Overwrite="true" Lines="@(DropManifests->'$(ManifestPublishUrl)%(Filename)%(Extension)')" />
</Target>

<Target Name="GetDropCmdLine">
<!-- Properties that will depend on each build configuration. We can only build the commandlines onces these are defined -->
<Error Text="VSDropSource property undefined" Condition="'$(VSDropSource)' == ''" />

<PropertyGroup>
<DropName>Products/$(ManifestTeamProject)/$(ManifestRepositoryName)/$(ManifestBuildBranch)/$(ManifestBuildNumber)</DropName>

<DropParamName>-n &quot;$(DropName)&quot;</DropParamName>
<DropParamSource>-d &quot;$(VSDropSource)&quot;</DropParamSource>

<DropUpgradeCmd>$(DropExe) Upgrade $(DropParamService) $(DropParamAuth) $(DropParamTimeout) $(DropParamTraceLevel)</DropUpgradeCmd>
<DropCreateCmd>$(DropExe) Create $(DropParamService) $(DropParamAuth) $(DropParamTimeout) $(DropParamTraceLevel) $(DropParamExpirationDate) $(DropParamName)</DropCreateCmd>
<DropPublishCmd>$(DropExe) Publish $(DropParamService) $(DropParamAuth) $(DropParamTimeout) $(DropParamTraceLevel) $(DropParamName) $(DropParamSource)</DropPublishCmd>
<DropFinalizeCmd>$(DropExe) Finalize $(DropParamService) $(DropParamAuth) $(DropParamTimeout) $(DropParamTraceLevel) $(DropParamName)</DropFinalizeCmd>
<DropUpdateCmd>$(DropExe) Update $(DropParamService) $(DropParamAuth) $(DropParamTimeout) $(DropParamTraceLevel) $(DropParamName) --neverExpire</DropUpdateCmd>
</PropertyGroup>
</Target>

<Target Name="VSSetupDiagnostic" DependsOnTargets="GetDropCmdLine">
<ItemGroup>
<VSSetupProperties Include="Drop cmd: $(DropUpgradeCmd)" />
<VSSetupProperties Include="Drop cmd: $(DropCreateCmd)" />
<VSSetupProperties Include="Drop cmd: $(DropPublishCmd)" />
<VSSetupProperties Include="Drop cmd: $(DropFinalizeCmd)" />
<VSSetupProperties Include="Drop cmd: $(DropUpdateCmd)" />
<VSSetupProperties Include="DropName: $(DropName)" />
</ItemGroup>

<Message Text="%(VSSetupProperties.Identity)" />
</Target>
</Project>
68 changes: 68 additions & 0 deletions src/workloads/mono_wasm_mobile.vsmanproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="VSSetup.targets" />

<PropertyGroup>
<DebugSymbols>false</DebugSymbols>
<IsShippingAssembly>false</IsShippingAssembly>
<PublishWindowsPdb>false</PublishWindowsPdb>
<TargetType>build-manifest</TargetType>
<FinalizeManifest>true</FinalizeManifest>
<FinalizeSkipLayout>false</FinalizeSkipLayout>
<ProductName>DotNetOptionalWorkloads</ProductName>
<ProductFamily>vs</ProductFamily>
<ProductFamilyVersion Condition="$(ProductFamilyVersion) == ''">42.42.42</ProductFamilyVersion>
<ComputeRelativeUrls>true</ComputeRelativeUrls>
<OutputPath>$(ManifestOutputPath)</OutputPath>
</PropertyGroup>

<ItemGroup>
<MergeManifest Include="$(ManifestOutputPath)\*.json">
<RelativeUrl>/</RelativeUrl>
</MergeManifest>
<MergeManifest Include="$(ManifestOutputPath)\CHS\*.json">
<RelativeUrl>/CHS/</RelativeUrl>
</MergeManifest>
<MergeManifest Include="$(ManifestOutputPath)\CHT\*.json">
<RelativeUrl>/CHT/</RelativeUrl>
</MergeManifest>
<MergeManifest Include="$(ManifestOutputPath)\CSY\*.json">
<RelativeUrl>/CSY/</RelativeUrl>
</MergeManifest>
<MergeManifest Include="$(ManifestOutputPath)\DEU\*.json">
<RelativeUrl>/DEU/</RelativeUrl>
</MergeManifest>
<MergeManifest Include="$(ManifestOutputPath)\ENU\*.json">
<RelativeUrl>/ENU/</RelativeUrl>
</MergeManifest>
<MergeManifest Include="$(ManifestOutputPath)\ESN\*.json">
<RelativeUrl>/ESN/</RelativeUrl>
</MergeManifest>
<MergeManifest Include="$(ManifestOutputPath)\FRA\*.json">
<RelativeUrl>/FRA/</RelativeUrl>
</MergeManifest>
<MergeManifest Include="$(ManifestOutputPath)\ITA\*.json">
<RelativeUrl>/ITA/</RelativeUrl>
</MergeManifest>
<MergeManifest Include="$(ManifestOutputPath)\JPN\*.json">
<RelativeUrl>/JPN/</RelativeUrl>
</MergeManifest>
<MergeManifest Include="$(ManifestOutputPath)\KOR\*.json">
<RelativeUrl>/KOR/</RelativeUrl>
</MergeManifest>
<MergeManifest Include="$(ManifestOutputPath)\PLK\*.json">
<RelativeUrl>/PLK/</RelativeUrl>
</MergeManifest>
<MergeManifest Include="$(ManifestOutputPath)\PTB\*.json">
<RelativeUrl>/PTB/</RelativeUrl>
</MergeManifest>
<MergeManifest Include="$(ManifestOutputPath)\RUS\*.json">
<RelativeUrl>/RUS/</RelativeUrl>
</MergeManifest>
<MergeManifest Include="$(ManifestOutputPath)\TRK\*.json">
<RelativeUrl>/TRK/</RelativeUrl>
</MergeManifest>
</ItemGroup>

<Import Project="$(SwixBuildTargets)"/>
</Project>
2 changes: 2 additions & 0 deletions src/workloads/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Building
The workloads project can only be built using .NET Framework msbuild. To build locally, run ```build -project src\workloads\workloads.csproj -msbuildEngine vs```
Loading

0 comments on commit e60882e

Please sign in to comment.