Skip to content
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
4 changes: 2 additions & 2 deletions eng/AfterSolutionBuild.targets
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project>

<Import Project="Common.props" />
<Import Project="tools\RepoTasks\RepoTasks.tasks" />
<Import Project="SharedFramework.External.props" />
<Import Project="SharedFramework.Local.props" />

<!-- This is temporary until we can use FrameworkReference to build our own packages. -->
<Target Name="RemoveSharedFrameworkOnlyRefsFromNuspec" AfterTargets="Pack"
Condition=" '$(MSBuildRuntimeType)' == 'core' ">
<Target Name="RemoveSharedFrameworkOnlyRefsFromNuspec" AfterTargets="Pack" Condition="'$(BuildManaged)' == 'true'">
<ItemGroup>
<_BuildOutput Include="$(ArtifactsShippingPackagesDir)*.nupkg"
Exclude="$(ArtifactsShippingPackagesDir)*.symbols.nupkg" />
Expand Down
160 changes: 88 additions & 72 deletions eng/Build.props

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion eng/Npm.Workspace.FunctionalTests.nodeproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project>
<Project DefaultTargets="Build">

<!-- Import Directory.Build.Props -->
<Import Project="$(MSBuildThisFileDirectory)..\Directory.Build.props" />
Expand Down
2 changes: 1 addition & 1 deletion eng/Npm.Workspace.nodeproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project>
<Project DefaultTargets="Build">

<!-- Import Directory.Build.Props -->
<Import Project="$(MSBuildThisFileDirectory)..\Directory.Build.props" />
Expand Down
5 changes: 2 additions & 3 deletions eng/Tools.props
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<Project>
<!-- Update the generated files when we restore projects. Skip in desktop msbuild due to VS 16.8 requirements. -->
<!-- Update the generated files when we restore projects. -->
<Target Name="GenerateDirectoryBuildFiles"
AfterTargets="Restore"
Condition=" '$(MSBuildRuntimeType)' == 'core' ">
AfterTargets="Restore">
<!-- Separate invocations and use different properties to ensure second can load the restored package info. -->
<MSBuild Projects="$(RepoRoot)eng\tools\GenerateFiles\GenerateFiles.csproj"
RemoveProperties="BaseIntermediateOutputPath"
Expand Down
54 changes: 31 additions & 23 deletions eng/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ param(
[Alias('v')]
[string]$Verbosity = 'minimal',
[switch]$DumpProcesses, # Capture all running processes and dump them to a file.
[string]$msbuildEngine = 'dotnet',

# Other lifecycle targets
[switch]$Help, # Show help
Expand Down Expand Up @@ -288,24 +289,20 @@ if ($RuntimeSourceFeed -or $RuntimeSourceFeedKey) {
}

# Split build categories between dotnet msbuild and desktop msbuild. Use desktop msbuild as little as possible.
[string[]]$dotnetBuildArguments = $MSBuildArguments
[string[]]$dotnetBuildArguments = ''
[string[]]$MSBuildOnlyArguments = ''

if ($All) { $dotnetBuildArguments += '/p:BuildAllProjects=true' }
if ($Projects) {
if ($BuildNative) {
$MSBuildArguments += "/p:ProjectToBuild=$Projects"
} else {
$dotnetBuildArguments += "/p:ProjectToBuild=$Projects"
}
}
if ($Projects) { $MSBuildArguments += "/p:ProjectToBuild=$Projects" }

if ($NoBuildInstallers) { $MSBuildArguments += "/p:BuildInstallers=false"; $BuildInstallers = $false }
if ($BuildInstallers) { $MSBuildArguments += "/p:BuildInstallers=true" }
if ($NoBuildInstallers) { $MSBuildOnlyArguments += "/p:BuildInstallers=false"; $BuildInstallers = $false }
if ($BuildInstallers) { $MSBuildOnlyArguments += "/p:BuildInstallers=true" }

# Build native projects by default unless -NoBuildNative was specified.
$specifiedBuildNative = $BuildNative
$BuildNative = $true
if ($NoBuildNative) { $MSBuildArguments += "/p:BuildNative=false"; $BuildNative = $false }
if ($BuildNative) { $MSBuildArguments += "/p:BuildNative=true"}
if ($NoBuildNative) { $MSBuildOnlyArguments += "/p:BuildNative=false"; $BuildNative = $false }
if ($BuildNative) { $MSBuildOnlyArguments += "/p:BuildNative=true"}

if ($NoBuildJava) { $dotnetBuildArguments += "/p:BuildJava=false"; $BuildJava = $false }
if ($BuildJava) { $dotnetBuildArguments += "/p:BuildJava=true" }
Expand All @@ -317,23 +314,24 @@ if ($BuildNodeJS) { $dotnetBuildArguments += "/p:BuildNodeJSUnlessSourcebuild=tr
# Don't bother with two builds if just one will build everything. Ignore super-weird cases like
# "-Projects ... -NoBuildJava -NoBuildManaged -NoBuildNodeJS". An empty `./build.ps1` command will build both
# managed and native projects.
$performDesktopBuild = $BuildInstallers -or $BuildNative
$performDotnetBuild = $BuildJava -or $BuildManaged -or $BuildNodeJS -or `

# If -msbuildEngine vs is explicitly passed in, use desktop msbuild only.
# This is necessary for one-shot builds like within the VMR.

$performDesktopBuild = $BuildInstallers -or $BuildNative -or $msbuildEngine -eq 'vs'
$performDotnetBuild = $msBuildEngine -ne 'vs' -and ($BuildJava -or $BuildManaged -or $BuildNodeJS -or `
($All -and -not ($NoBuildJava -and $NoBuildManaged -and $NoBuildNodeJS)) -or `
($Projects -and -not ($BuildInstallers -or $specifiedBuildNative))
($Projects -and -not ($BuildInstallers -or $specifiedBuildNative)))

# Initialize global variables need to be set before the import of Arcade is imported
$restore = $RunRestore

# Though VS Code may indicate $nodeReuse and $msbuildEngine are unused, tools.ps1 uses them.
# Though VS Code may indicate $nodeReuse is unused, tools.ps1 uses them.

# Disable node reuse - Workaround perpetual issues in node reuse and custom task assemblies
$nodeReuse = $false
$env:MSBUILDDISABLENODEREUSE=1

# Use `dotnet msbuild` by default
$msbuildEngine = 'dotnet'

# Ensure passing neither -bl nor -nobl on CI avoids errors in tools.ps1. This is needed because both parameters are
# $false by default i.e. they always exist. (We currently avoid binary logs but that is made visible in the YAML.)
if ($CI -and -not $excludeCIBinarylog) {
Expand Down Expand Up @@ -414,12 +412,17 @@ if ($BinaryLog) {
$bl = GetMSBuildBinaryLogCommandLineArgument($MSBuildArguments)
if (-not $bl) {
$dotnetBuildArguments += "/bl:" + (Join-Path $LogDir "Build.binlog")
$MSBuildArguments += "/bl:" + (Join-Path $LogDir "Build.native.binlog")

# When running both builds, use a different binary log path for the desktop msbuild.
if ($performDesktopBuild -and $performDotnetBuild) {
$MSBuildOnlyArguments += "/bl:" + (Join-Path $LogDir "Build.native.binlog")
}

$ToolsetBuildArguments += "/bl:" + (Join-Path $LogDir "Build.repotasks.binlog")
} else {
# Use a different binary log path when running desktop msbuild if doing both builds.
if ($performDesktopBuild -and $performDotnetBuild) {
$MSBuildArguments += "/bl:" + [System.IO.Path]::ChangeExtension($bl, "native.binlog")
$MSBuildOnlyArguments += "/bl:" + [System.IO.Path]::ChangeExtension($bl, "native.binlog")
}

$ToolsetBuildArguments += "/bl:" + [System.IO.Path]::ChangeExtension($bl, "repotasks.binlog")
Expand Down Expand Up @@ -478,15 +481,20 @@ try {
Remove-Item variable:global:_BuildTool -ErrorAction Ignore
$msbuildEngine = 'vs'

MSBuild $toolsetBuildProj /p:RepoRoot=$RepoRoot @MSBuildArguments
# When running with desktop msbuild only, append the dotnet build specific arguments.
if (-not $performDotnetBuild) {
$MSBuildOnlyArguments += $dotnetBuildArguments
}

MSBuild $toolsetBuildProj /p:RepoRoot=$RepoRoot @MSBuildArguments @MSBuildOnlyArguments
}

if ($performDotnetBuild) {
Write-Host
Remove-Item variable:global:_BuildTool -ErrorAction Ignore
$msbuildEngine = 'dotnet'

MSBuild $toolsetBuildProj /p:RepoRoot=$RepoRoot @dotnetBuildArguments
MSBuild $toolsetBuildProj /p:RepoRoot=$RepoRoot @MSBuildArguments @dotnetBuildArguments
}
}
}
Expand Down
4 changes: 0 additions & 4 deletions eng/targets/ResolveReferences.targets
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,6 @@
Condition=" '@(PackageReference->HasMetadata('Private')->Count())' != '0' "
Code="BUILD004"
Text="%25(Private) metadata should not be applied to the %(Identity) package reference. Did you mean %25(PrivateAssets)?" />
<Warning
Condition=" '@(ProjectReference->HasMetadata('PrivateAssets')->Count())' != '0' "
Code="BUILD005"
Text="%25(PrivateAssets) metadata should not be applied to the %(Identity) project reference. Did you mean %25(Private)?" />
<Warning
Condition=" '@(Reference->HasMetadata('PrivateAssets')->Count())' != '0' "
Code="BUILD006"
Expand Down
7 changes: 6 additions & 1 deletion eng/tools/GenerateFiles/GenerateFiles.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@
</ItemGroup>

<!-- Update artifacts/bin/GenerateFiles/Directory.Build.* files. -->
<Target Name="GenerateDirectoryBuildFiles">
<Target Name="GenerateDirectoryBuildFiles"
Inputs="$(MSBuildThisFileDirectory)Directory.Build.props.in;
$(MSBuildThisFileDirectory)Directory.Build.targets.in"
Outputs="$(BaseOutputPath)Directory.Build.props;
$(BaseOutputPath)Directory.Build.targets;
$(ConfigDirectory)dotnet-tools.json">
<PropertyGroup>
<_TemplateProperties>
AspNetCorePatchVersion=$(AspNetCorePatchVersion);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,17 @@
</When>
<Otherwise>
<ItemGroup>
<ProjectReference Include="..\SharedFrameworkLib\SharedFrameworkLib.wixproj" SetPlatform="Platform=x86">
<ProjectReference Include="..\SharedFrameworkLib\SharedFrameworkLib.wixproj"
SetPlatform="Platform=x86"
Condition="'$(DotNetBuild)' != 'true' or '$(Platform)' == 'Win32'">
<Name>SharedFrameworkLib</Name>
<Project>{5244BC49-2568-4701-80A6-EAB8950AB5FA}</Project>
<Private>True</Private>
<DoNotHarvest>True</DoNotHarvest>
</ProjectReference>
<ProjectReference Include="..\SharedFrameworkLib\SharedFrameworkLib.wixproj" SetPlatform="Platform=x64">
<ProjectReference Include="..\SharedFrameworkLib\SharedFrameworkLib.wixproj"
SetPlatform="Platform=x64"
Condition="'$(DotNetBuild)' != 'true' or '$(Platform)' == 'x64'">
<Name>SharedFrameworkLib</Name>
<Project>{5244BC49-2568-4701-80A6-EAB8950AB5FA}</Project>
<Private>True</Private>
Expand Down
Loading