Skip to content

Commit

Permalink
MicroBuild
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffkl committed Feb 27, 2023
1 parent 1c5caef commit ab98b47
Show file tree
Hide file tree
Showing 15 changed files with 63 additions and 76 deletions.
3 changes: 3 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
<PackageVersion Include="Microsoft.CodeAnalysis.Workspaces.Common" Version="4.3.1" />
<PackageVersion Include="Microsoft.CSharp" Version="$(SystemPackagesVersion)" />
<PackageVersion Include="Microsoft.DataAI.NuGetRecommender.Contracts" Version="2.1.0" />
<PackageVersion Include="Microsoft.DotNet.Build.Tasks.Feed" Version="6.0.0-beta.20528.5" />
<PackageVersion Include="Microsoft.DotNet.Maestro.Tasks" Version="1.1.0-beta.21378.2" />
<PackageVersion Include="Microsoft.Extensions.CommandLineUtils.Sources" Version="3.0.0-preview6.19253.5" />
<PackageVersion Include="Microsoft.Extensions.FileProviders.Abstractions" Version="$(MicrosoftExtensionsFileProvidersAbstractionsPackageVersion)" />
<PackageVersion Include="Microsoft.Extensions.FileSystemGlobbing" Version="$(MicrosoftExtensionsFileSystemGlobbingPackageVersion)" />
Expand Down Expand Up @@ -123,6 +125,7 @@

<ItemGroup>
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" Condition="'$(Shipping)' == 'true' AND '$(IsXPlat)' != 'true'" />
<GlobalPackageReference Include="Microsoft.VisualStudioEng.MicroBuild.Core" version="1.0.0" />
</ItemGroup>

<ItemGroup Condition=" '$(UsePublicApiAnalyzer)' == 'true' ">
Expand Down
4 changes: 0 additions & 4 deletions build/bootstrap.proj
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,7 @@
<!-- After changing versions here, run configure.ps1 -->

<ItemGroup>
<PackageDownload Include="Microsoft.VisualStudioEng.MicroBuild.Core" version="[1.0.0]" />
<PackageDownload Include="Microsoft.DotNet.Build.Tasks.Feed" version="[6.0.0-beta.20528.5]" /> <!-- for publishing to the .NET Core build asset registry (BAR) -->
<PackageDownload Include="Microsoft.DotNet.Maestro.Tasks" version="[1.1.0-beta.21378.2]" /> <!-- for publishing to the .NET Core build asset registry (BAR) -->
<PackageDownload Include="NuGet.Client.EndToEnd.TestData" version="[1.0.0]" />

</ItemGroup>

</Project>
5 changes: 0 additions & 5 deletions build/common.project.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'README.md'))\packages\Microsoft.VisualStudioEng.MicroBuild.Core\1.0.0\build\Microsoft.VisualStudioEng.MicroBuild.Core.props" Condition="Exists('$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), &quot;README.md&quot;))\packages\Microsoft.VisualStudioEng.MicroBuild.Core\1.0.0\build\Microsoft.VisualStudioEng.MicroBuild.Core.props')" />

<!-- Helper properties -->
<PropertyGroup>
<IsXPlat>false</IsXPlat>
Expand Down Expand Up @@ -43,9 +41,6 @@
<NuGetBuildLocalizationRepository>$(RepositoryRootDirectory)submodules\NuGet.Build.Localization\</NuGetBuildLocalizationRepository>
<LocalizationRootDirectory>$(NuGetBuildLocalizationRepository)localize</LocalizationRootDirectory>
<LocalizationWorkDirectory>$(RepositoryRootDirectory)localize</LocalizationWorkDirectory>
<MicroBuildDirectory>$(SolutionPackagesFolder)microsoft.visualstudioeng.microbuild.core\1.0.0\build\</MicroBuildDirectory>
<MicrosoftDotNetBuildTasksFeedFilePath>$(SolutionPackagesFolder)microsoft.dotnet.build.tasks.feed\6.0.0-beta.20528.5\tools\netcoreapp2.1\Microsoft.DotNet.Build.Tasks.Feed.dll</MicrosoftDotNetBuildTasksFeedFilePath>
<MicrosoftDotNetMaestroTasksFilePath>$(SolutionPackagesFolder)microsoft.dotnet.maestro.tasks\1.1.0-beta.21378.2\tools\netcoreapp3.1\Microsoft.DotNet.Maestro.Tasks.dll</MicrosoftDotNetMaestroTasksFilePath>
<NoWarn>$(NoWarn);NU5105;MSB3277;NETSDK1138</NoWarn>
<!-- additional warnings new in .NET 6 that we need to disable when building with source-build -->
<NoWarn Condition="'$(DotNetBuildFromSource)' == 'true'">$(NoWarn);CS1998;CA1416;CS0618;CS1574</NoWarn>
Expand Down
3 changes: 0 additions & 3 deletions build/common.targets
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,4 @@ Condition=" ('%(Extension)' == '.dll' OR '%(Filename)' == 'NuGet.CommandLine.XPl
Text="Newtonsoft.Json must be version $(NewtonsoftJsonPackageVersion) but resolved %(Reference.NuGetPackageVersion)"
Condition=" %(Reference.NuGetPackageId) == 'Newtonsoft.Json' AND %(Reference.NuGetPackageVersion) != '$(NewtonsoftJsonPackageVersion)' " />
</Target>

<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'README.md'))\packages\Microsoft.VisualStudioEng.MicroBuild.Core\1.0.0\build\Microsoft.VisualStudioEng.MicroBuild.Core.targets" Condition="Exists('$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), &quot;README.md&quot;))\packages\Microsoft.VisualStudioEng.MicroBuild.Core\1.0.0\build\Microsoft.VisualStudioEng.MicroBuild.Core.targets')" />

</Project>
2 changes: 0 additions & 2 deletions build/loc.proj
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,4 @@
<Copy SourceFiles="@(_EnglishBinaries)" DestinationFiles="@(_EnglishBinaries->'%(DestinationPath)')" />
<Copy SourceFiles="@(_LocalizeFiles)" DestinationFiles="@(_LocalizeFiles->'%(DestinationPath)')" />
</Target>

<Import Project="$(MicroBuildDirectory)Microsoft.VisualStudioEng.MicroBuild.Core.targets" />
</Project>
30 changes: 16 additions & 14 deletions build/publish.proj
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'README.md'))\build\common.props" />

<Project Sdk="Microsoft.Build.NoTargets" DefaultTargets="PublishToBuildAssetRegistry">
<!--
=================================================================
Publish NuGet builds to the .NET Core build asset registry (BAR).
=================================================================
-->
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<ArtifactsLogDir Condition="'$(ArtifactsLogDir)' == ''">$(MSBuildThisFileDirectory)PublishToBuildAssetRegistryLogs</ArtifactsLogDir>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.DotNet.Maestro.Tasks" />
<PackageReference Include="Microsoft.DotNet.Build.Tasks.Feed" />
</ItemGroup>

<Import Project="$(BuildCommonDirectory)common.targets" />

<UsingTask TaskName="Microsoft.DotNet.Build.Tasks.Feed.PushToAzureDevOpsArtifacts" AssemblyFile="$(MicrosoftDotNetBuildTasksFeedFilePath)" />
<UsingTask TaskName="Microsoft.DotNet.Maestro.Tasks.PushMetadataToBuildAssetRegistry" AssemblyFile="$(MicrosoftDotNetMaestroTasksFilePath)" />
<UsingTask TaskName="Microsoft.DotNet.Build.Tasks.Feed.PushToAzureDevOpsArtifacts" AssemblyFile="$(PkgMicrosoft_DotNet_Build_Tasks_Feed)\tools\netcoreapp2.1\Microsoft.DotNet.Build.Tasks.Feed.dll" />
<UsingTask TaskName="Microsoft.DotNet.Maestro.Tasks.PushMetadataToBuildAssetRegistry" AssemblyFile="$(PkgMicrosoft_DotNet_Maestro_Tasks)\tools\netcoreapp3.1\Microsoft.DotNet.Maestro.Tasks.dll" />


<Target Name="PublishToBuildAssetRegistry">
Expand All @@ -20,15 +23,15 @@
<AssetManifestPath>$(ArtifactsLogDir)AssetManifest\$(AssetManifestFileName)</AssetManifestPath>
</PropertyGroup>

<Error Condition="'$(NuGetClientNupkgsDirectoryPath)' == ''" Text="The property '$(NuGetClientNupkgsDirectoryPath)' is required. Set it at the command-line with /property:&lt;NuGetClientNupkgsDirectoryPath&gt;" />
<Error Condition="!Exists($(NuGetClientNupkgsDirectoryPath))" Text="The package directory path '$(NuGetClientNupkgsDirectoryPath)' does not exist." />
<Error Condition="Exists($(AssetManifestPath))" Text="The manifest file '$(AssetManifestPath)' already exists." />

<CreateItem Include="$([System.IO.Path]::Combine($(NuGetClientNupkgsDirectoryPath), '*.nupkg'))">
<Output TaskParameter="Include" ItemName="ItemsToPush" />
</CreateItem>

<Error Condition="'@(ItemsToPush)' == ''" Text="No packages to push." />
<ItemGroup>
<ItemsToPush Include="$(NuGetClientNupkgsDirectoryPath)/*.nupkg" />
</ItemGroup>

<Error Condition="@(ItemsToPush->Count()) == 0" Text="There were no packages found at '$(NuGetClientNupkgsDirectoryPath)'." />
<Error Condition="'$(BUILD_BUILDNUMBER)' == ''" Text="The BUILD_BUILDNUMBER property is required." />
<Error Condition="'$(ArtifactsLogDir)' == ''" Text="The ArtifactsLogDir property is required." />
<Error Condition="'$(BUILD_SOURCEBRANCH)' == ''" Text="The BUILD_SOURCEBRANCH property is required." />
Expand Down Expand Up @@ -69,5 +72,4 @@
ManifestsPath="$(ArtifactsLogDir)AssetManifest\"
AssetVersion="$(Version)" />
</Target>

</Project>
2 changes: 0 additions & 2 deletions build/sign.proj
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,4 @@
</FilesToSign>
</ItemGroup>
</Target>

<Import Project="$(MicroBuildDirectory)Microsoft.VisualStudioEng.MicroBuild.Core.targets" />
</Project>
12 changes: 6 additions & 6 deletions eng/pipelines/templates/Build_and_UnitTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -239,9 +239,9 @@ steps:
- task: MSBuild@1
displayName: "Generate Build Tools package"
inputs:
solution: "setup/Microsoft.VisualStudio.NuGet.BuildTools.vsmanproj"
solution: "setup\\Microsoft.VisualStudio.NuGet.BuildTools\\Microsoft.VisualStudio.NuGet.BuildTools.vsmanproj"
configuration: "$(BuildConfiguration)"
msbuildArguments: "/restore:false /property:BuildNumber=$(BuildNumber) /property:IsVsixBuild=true /binarylogger:$(Build.StagingDirectory)\\binlog\\12.BuildToolsVSIX.binlog"
msbuildArguments: "/property:BuildNumber=$(BuildNumber) /property:IsVsixBuild=true /binarylogger:$(Build.StagingDirectory)\\binlog\\12.BuildToolsVSIX.binlog"
condition: " and(succeeded(), eq(variables['BuildRTM'], 'false'))"

- task: MSBuild@1
Expand Down Expand Up @@ -287,17 +287,17 @@ steps:
- task: MSBuild@1
displayName: "Generate VSMAN file for NuGet Core VSIX"
inputs:
solution: "setup\\Microsoft.VisualStudio.NuGet.Core.vsmanproj"
solution: "setup\\Microsoft.VisualStudio.NuGet.Core\\Microsoft.VisualStudio.NuGet.Core.vsmanproj"
configuration: "$(BuildConfiguration)"
msbuildArguments: "/restore:false /property:ManifestDirPath=$(Build.ArtifactStagingDirectory)/sbom /binarylogger:$(Build.StagingDirectory)\\binlog\\14.GenerateVSManifestForVSIX.binlog"
condition: " and(succeeded(),eq(variables['BuildRTM'], 'false')) "

- task: MSBuild@1
displayName: "Generate VSMAN file for Build Tools VSIX"
inputs:
solution: "setup\\Microsoft.VisualStudio.NuGet.BuildTools.vsmanproj"
solution: "setup\\Microsoft.VisualStudio.NuGet.BuildTools\\Microsoft.VisualStudio.NuGet.BuildTools.vsmanproj"
configuration: "$(BuildConfiguration)"
msbuildArguments: "/restore:false /property:IsVsixBuild=false /property:ManifestDirPath=$(Build.ArtifactStagingDirectory)/sbom /binarylogger:$(Build.StagingDirectory)\\binlog\\15.GenerateVSManifestForToolsVSIX.binlog"
msbuildArguments: "/property:IsVsixBuild=false /property:ManifestDirPath=$(Build.ArtifactStagingDirectory)/sbom /binarylogger:$(Build.StagingDirectory)\\binlog\\15.GenerateVSManifestForToolsVSIX.binlog"
condition: " and(succeeded(),eq(variables['BuildRTM'], 'false')) "

- task: PowerShell@1
Expand Down Expand Up @@ -482,7 +482,7 @@ steps:
- task: CmdLine@2
displayName: "Publish to the .NET Core build asset registry (BAR)"
inputs:
script: dotnet msbuild $(Build.Repository.LocalPath)\build\publish.proj /t:PublishToBuildAssetRegistry /property:NuGetClientNupkgsDirectoryPath=$(Build.Repository.LocalPath)\artifacts\$(NupkgOutputDir) /property:BUILD_BUILDNUMBER=$(Build.BuildNumber) /property:BUILD_SOURCEBRANCH=$(Build.SourceBranchName) /property:BUILD_SOURCEVERSION=$(Build.SourceVersion) /property:BUILD_REPOSITORY_URI=$(Build.Repository.Uri) /property:BUILD_REPOSITORY_NAME=$(Build.Repository.Name) /property:ArtifactsLogDir=$(Build.Repository.LocalPath)\artifacts\manifests\ /property:MaestroApiEndpoint=$(MaestroApiEndpoint) /property:MaestroAccessToken=$(MaestroAccessToken) /binarylogger:$(Build.StagingDirectory)\binlog\PublishToBuildAssetRegistry.binlog
script: dotnet msbuild $(Build.Repository.LocalPath)\build\publish.proj /t:PublishToBuildAssetRegistry /property:NuGetClientNupkgsDirectoryPath=$(Build.Repository.LocalPath)\artifacts\$(NupkgOutputDir) /property:BUILD_BUILDNUMBER=$(Build.BuildNumber) /property:BUILD_SOURCEBRANCH=$(Build.SourceBranchName) /property:BUILD_SOURCEVERSION=$(Build.SourceVersion) /property:BUILD_REPOSITORY_URI=$(Build.Repository.Uri) /property:BUILD_REPOSITORY_NAME=$(Build.Repository.Name) /property:ArtifactsLogDir=$(Build.Repository.LocalPath)\artifacts\manifests\ /property:MaestroApiEndpoint=$(MaestroApiEndpoint) /property:MaestroAccessToken=$(MaestroAccessToken) /binarylogger:$(Build.StagingDirectory)\binlog\PublishToBuildAssetRegistry.binlog
workingDirectory: cli
failOnStderr: true
env:
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
// eng/source-build/global.json has the entry for the Arcade version we need for
// Arcade-powered source-build.
"msbuild-sdks": {
"Microsoft.Build.NoTargets": "1.0.80"
"Microsoft.Build.NoTargets": "3.7.0"
}
}
6 changes: 6 additions & 0 deletions setup/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project>
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
<PropertyGroup>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'README.md'))\build\common.props" />

<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<OutputArchitecture>neutral</OutputArchitecture>
<OutputLocalized>false</OutputLocalized>
<OutputName>$(MSBuildProjectName)</OutputName>
Expand All @@ -11,6 +9,7 @@
<MajorVSVersion>$([MSBuild]::Add($(MajorNuGetVersion), 11))</MajorVSVersion>
<!-- We set this to false here so we can batch sign the vsix later -->
<MicroBuild_SigningEnabled>false</MicroBuild_SigningEnabled>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>

<PropertyGroup>
Expand All @@ -29,12 +28,12 @@
<Package Include="Microsoft.VisualStudio.NuGet.BuildTools.swr" />
</ItemGroup>

<Target Name="TriggerBuildDependsOn"
BeforeTargets="Build"
DependsOnTargets="$(BuildDependsOn)" />

<Target Name="CopyToDropFolder" AfterTargets="Build">
<Copy SourceFiles="$(OutputPath)$(MSBuildProjectName).vsix" DestinationFolder="$(VsixPublishDestination)" />
<Copy SourceFiles="$(OutputPath)$(MSBuildProjectName).json" DestinationFolder="$(VsixPublishDestination)" />
</Target>

<!-- MicroBuild plugin fails if GetNativeManifest is not found for some reason -->
<Target Name="GetNativeManifest" />
<Import Project="$(MicroBuildDirectory)Microsoft.VisualStudioEng.MicroBuild.Core.targets" />
</Project>
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), 'README.md'))\build\common.props" />

<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<!-- Define properties that drive the manifest creation here. -->
<FinalizeManifest>true</FinalizeManifest>
<FinalizeSkipLayout>true</FinalizeSkipLayout>
<BuildNumber>$(SemanticVersion).$(BuildNumber)</BuildNumber>
<TargetName>$(MSBuildProjectName)</TargetName>
<OutputPath>$(VsixPublishDestination)</OutputPath>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>

<PropertyGroup Condition=" '$(IsVsixBuild)' == 'true' ">
Expand All @@ -21,16 +20,15 @@
</PropertyGroup>

<ItemGroup Condition=" '$(IsVsixBuild)' == 'true' ">
<ProjectReference Include="Microsoft.VisualStudio.NuGet.BuildTools.swixproj" SkipGetTargetFrameworkProperties="true" />
<ProjectReference Include="..\Microsoft.VisualStudio.NuGet.BuildTools.Swix\Microsoft.VisualStudio.NuGet.BuildTools.Swix.swixproj" />
</ItemGroup>

<ItemGroup Condition=" '$(IsVsixBuild)' != 'true' ">
<MergeManifest Include="$(VsixPublishDestination)$(MSBuildProjectName).json"
SBOMFileLocation="$(ManifestDirPath)\_manifest\spdx_2.2\manifest.spdx.json"
SBOMFileLocation="$(ManifestDirPath)\_manifest\spdx_2.2\manifest.spdx.json"
/>
</ItemGroup>

<Import Project="$(MicroBuildDirectory)Microsoft.VisualStudioEng.MicroBuild.Core.targets" />

<Target Name="ValidateManifest" Condition="'$(IsVsixBuild)' == 'true'"/>
<Target Name="ValidateManifest"
Condition="'$(IsVsixBuild)' == 'true'" />
</Project>
22 changes: 0 additions & 22 deletions setup/Microsoft.VisualStudio.NuGet.Core.vsmanproj

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project Sdk="Microsoft.Build.NoTargets">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<!-- Define properties that drive the manifest creation here. -->
<FinalizeManifest>true</FinalizeManifest>
<FinalizeSkipLayout>true</FinalizeSkipLayout>
<BuildNumber>$(SemanticVersion).$(BuildNumber)</BuildNumber>
<TargetName>$(MSBuildProjectName)</TargetName>
<OutputPath>$(VsixPublishDestination)</OutputPath>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
</PropertyGroup>

<ItemGroup>
<MergeManifest Include="$(VsixPublishDestination)Microsoft.VisualStudio.NuGet.Core.json"
SBOMFileLocation="$(ManifestDirPath)_manifest\spdx_2.2\manifest.spdx.json" />
</ItemGroup>
</Project>

0 comments on commit ab98b47

Please sign in to comment.