Build native assets by default (#22611)
* Build native assets by default - #22556 - make `-BuildNative` primarily useful when you want _only_ native assets - can also build `-Projects` with desktop `msbuild` using `-BuildNative` - remove `-ForceCoreMsbuild` option nit: extra `Remove-Item`s caused `MSBuild` function to do redundant work * !fixup! Get `/bl` options working again nit: Place SiteExtensions .binlogs correctly wherever script is run from * !fixup! Remove *.vcxproj from Servers build - native projects are built implicitly * !fixup! Remove `-buildNative` from IIS build script
This commit is contained in:
parent
eb33b9657b
commit
ee80cd5ccd
59
build.ps1
59
build.ps1
|
|
@ -54,7 +54,8 @@ You can also use -NoBuildManaged to suppress this project type.
|
||||||
|
|
||||||
.PARAMETER BuildNative
|
.PARAMETER BuildNative
|
||||||
Build native projects (C++).
|
Build native projects (C++).
|
||||||
You can also use -NoBuildNative to suppress this project type.
|
This is the default for x64 and x86 builds but useful when you want to build _only_ native projects.
|
||||||
|
You can use -NoBuildNative to suppress this project type.
|
||||||
|
|
||||||
.PARAMETER BuildNodeJS
|
.PARAMETER BuildNodeJS
|
||||||
Build NodeJS projects (TypeScript, JS).
|
Build NodeJS projects (TypeScript, JS).
|
||||||
|
|
@ -89,8 +90,21 @@ Key for feed that can be used when downloading .NET runtimes
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Building both native and managed projects.
|
Building both native and managed projects.
|
||||||
|
|
||||||
|
build.ps1
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
|
build.ps1 -BuildManaged
|
||||||
|
|
||||||
|
or
|
||||||
|
|
||||||
build.ps1 -BuildManaged -BuildNative
|
build.ps1 -BuildManaged -BuildNative
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Build only native projects.
|
||||||
|
|
||||||
|
build.ps1 -BuildNative
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
Building a subfolder of code.
|
Building a subfolder of code.
|
||||||
|
|
||||||
|
|
@ -146,10 +160,6 @@ param(
|
||||||
|
|
||||||
[switch]$NoBuildRepoTasks,
|
[switch]$NoBuildRepoTasks,
|
||||||
|
|
||||||
# Disable pre-build of C++ code in x64 (default) and x86 builds. Affects -All and -Projects handling and causes
|
|
||||||
# -BuildInstallers and -BuildNative to be ignored.
|
|
||||||
[switch]$ForceCoreMsbuild,
|
|
||||||
|
|
||||||
# Diagnostics
|
# Diagnostics
|
||||||
[Alias('bl')]
|
[Alias('bl')]
|
||||||
[switch]$BinaryLog,
|
[switch]$BinaryLog,
|
||||||
|
|
@ -191,15 +201,12 @@ if ($Projects) {
|
||||||
{
|
{
|
||||||
$Projects = Join-Path (Get-Location) $Projects
|
$Projects = Join-Path (Get-Location) $Projects
|
||||||
}
|
}
|
||||||
$MSBuildArguments += "/p:ProjectToBuild=$Projects"
|
|
||||||
}
|
}
|
||||||
# When adding new sub-group build flags, add them to this check.
|
# When adding new sub-group build flags, add them to this check.
|
||||||
elseif (-not ($All -or $BuildNative -or $BuildManaged -or $BuildNodeJS -or $BuildInstallers -or $BuildJava)) {
|
elseif (-not ($All -or $BuildNative -or $BuildManaged -or $BuildNodeJS -or $BuildInstallers -or $BuildJava)) {
|
||||||
Write-Warning "No default group of projects was specified, so building the 'managed' and its dependent subsets of projects. Run ``build.cmd -help`` for more details."
|
Write-Warning "No default group of projects was specified, so building the managed and native projects and their dependencies. Run ``build.cmd -help`` for more details."
|
||||||
|
|
||||||
# This goal of this is to pick a sensible default for `build.cmd` with zero arguments.
|
|
||||||
# Now that we support subfolder invokations of build.cmd, we will be pushing to have build.cmd build everything (-all) by default
|
|
||||||
|
|
||||||
|
# The goal of this is to pick a sensible default for `build.cmd` with zero arguments.
|
||||||
$BuildManaged = $true
|
$BuildManaged = $true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -261,10 +268,21 @@ if ($DotNetRuntimeSourceFeed -or $DotNetRuntimeSourceFeedKey) {
|
||||||
|
|
||||||
# Split build categories between dotnet msbuild and desktop msbuild. Use desktop msbuild as little as possible.
|
# Split build categories between dotnet msbuild and desktop msbuild. Use desktop msbuild as little as possible.
|
||||||
[string[]]$dotnetBuildArguments = $MSBuildArguments
|
[string[]]$dotnetBuildArguments = $MSBuildArguments
|
||||||
if ($All) { $dotnetBuildArguments += '/p:BuildAllProjects=true'; $BuildNative = $true }
|
if ($All) { $dotnetBuildArguments += '/p:BuildAllProjects=true' }
|
||||||
|
if ($Projects) {
|
||||||
|
if ($BuildNative) {
|
||||||
|
$MSBuildArguments += "/p:ProjectToBuild=$Projects"
|
||||||
|
} else {
|
||||||
|
$dotnetBuildArguments += "/p:ProjectToBuild=$Projects"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($NoBuildInstallers) { $MSBuildArguments += "/p:BuildInstallers=false"; $BuildInstallers = $false }
|
if ($NoBuildInstallers) { $MSBuildArguments += "/p:BuildInstallers=false"; $BuildInstallers = $false }
|
||||||
if ($BuildInstallers) { $MSBuildArguments += "/p:BuildInstallers=true" }
|
if ($BuildInstallers) { $MSBuildArguments += "/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 ($NoBuildNative) { $MSBuildArguments += "/p:BuildNative=false"; $BuildNative = $false }
|
||||||
if ($BuildNative) { $MSBuildArguments += "/p:BuildNative=true"}
|
if ($BuildNative) { $MSBuildArguments += "/p:BuildNative=true"}
|
||||||
|
|
||||||
|
|
@ -276,12 +294,13 @@ if ($NoBuildNodeJS) { $dotnetBuildArguments += "/p:BuildNodeJS=false"; $BuildNod
|
||||||
if ($BuildNodeJS) { $dotnetBuildArguments += "/p:BuildNodeJS=true" }
|
if ($BuildNodeJS) { $dotnetBuildArguments += "/p:BuildNodeJS=true" }
|
||||||
|
|
||||||
# Don't bother with two builds if just one will build everything. Ignore super-weird cases like
|
# Don't bother with two builds if just one will build everything. Ignore super-weird cases like
|
||||||
# "-Projects ... -NoBuildJava -NoBuildManaged -NoBuildNodeJS".
|
# "-Projects ... -NoBuildJava -NoBuildManaged -NoBuildNodeJS". An empty `./build.ps1` command will build both
|
||||||
$ForceCoreMsbuild = $ForceCoreMsbuild -or -not ($BuildInstallers -or $BuildNative) -or `
|
# managed and native projects.
|
||||||
$Architecture.StartsWith("arm", [System.StringComparison]::OrdinalIgnoreCase)
|
$performDesktopBuild = ($BuildInstallers -or $BuildNative) -and `
|
||||||
$performDotnetBuild = $ForceCoreMsbuild -or $BuildJava -or $BuildManaged -or $BuildNodeJS -or `
|
-not $Architecture.StartsWith("arm", [System.StringComparison]::OrdinalIgnoreCase)
|
||||||
|
$performDotnetBuild = $BuildJava -or $BuildManaged -or $BuildNodeJS -or `
|
||||||
($All -and -not ($NoBuildJava -and $NoBuildManaged -and $NoBuildNodeJS)) -or `
|
($All -and -not ($NoBuildJava -and $NoBuildManaged -and $NoBuildNodeJS)) -or `
|
||||||
($Projects -and -not ($BuildInstallers -or $BuildNative))
|
($Projects -and -not ($BuildInstallers -or $specifiedBuildNative))
|
||||||
|
|
||||||
$foundJdk = $false
|
$foundJdk = $false
|
||||||
$javac = Get-Command javac -ErrorAction Ignore -CommandType Application
|
$javac = Get-Command javac -ErrorAction Ignore -CommandType Application
|
||||||
|
|
@ -378,11 +397,11 @@ if ($BinaryLog) {
|
||||||
$ToolsetBuildArguments += "/bl:" + (Join-Path $LogDir "Build.repotasks.binlog")
|
$ToolsetBuildArguments += "/bl:" + (Join-Path $LogDir "Build.repotasks.binlog")
|
||||||
} else {
|
} else {
|
||||||
# Use a different binary log path when running desktop msbuild if doing both builds.
|
# Use a different binary log path when running desktop msbuild if doing both builds.
|
||||||
if (-not $ForceCoreMsbuild -and $performDotnetBuild) {
|
if ($performDesktopBuild -and $performDotnetBuild) {
|
||||||
$MSBuildArguments += [System.IO.Path]::ChangeExtension($bl, "native.binlog")
|
$MSBuildArguments += "/bl:" + [System.IO.Path]::ChangeExtension($bl, "native.binlog")
|
||||||
}
|
}
|
||||||
|
|
||||||
$ToolsetBuildArguments += [System.IO.Path]::ChangeExtension($bl, "repotasks.binlog")
|
$ToolsetBuildArguments += "/bl:" + [System.IO.Path]::ChangeExtension($bl, "repotasks.binlog")
|
||||||
}
|
}
|
||||||
} elseif ($CI) {
|
} elseif ($CI) {
|
||||||
# Ensure the artifacts/log directory isn't empty to avoid warnings.
|
# Ensure the artifacts/log directory isn't empty to avoid warnings.
|
||||||
|
|
@ -421,7 +440,7 @@ try {
|
||||||
@ToolsetBuildArguments
|
@ToolsetBuildArguments
|
||||||
}
|
}
|
||||||
|
|
||||||
if (-not $ForceCoreMsbuild) {
|
if ($performDesktopBuild) {
|
||||||
Write-Host
|
Write-Host
|
||||||
Remove-Item variable:global:_BuildTool -ErrorAction Ignore
|
Remove-Item variable:global:_BuildTool -ErrorAction Ignore
|
||||||
$msbuildEngine = 'vs'
|
$msbuildEngine = 'vs'
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,6 @@ try {
|
||||||
& "$repoRoot\build.ps1" -ci:$ci -nobl -noBuildRepoTasks -noRestore -buildNative -configuration Debug
|
& "$repoRoot\build.ps1" -ci:$ci -nobl -noBuildRepoTasks -noRestore -buildNative -configuration Debug
|
||||||
|
|
||||||
Remove-Item variable:global:_BuildTool -ErrorAction Ignore
|
Remove-Item variable:global:_BuildTool -ErrorAction Ignore
|
||||||
Remove-Item variable:global:_DotNetInstallDir -ErrorAction Ignore
|
|
||||||
Remove-Item variable:global:_ToolsetBuildProj -ErrorAction Ignore
|
|
||||||
Remove-Item variable:global:_MSBuildExe -ErrorAction Ignore
|
|
||||||
|
|
||||||
$excludeCIBinarylog = $true
|
$excludeCIBinarylog = $true
|
||||||
$msbuildEngine = 'dotnet'
|
$msbuildEngine = 'dotnet'
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
@ECHO OFF
|
@ECHO OFF
|
||||||
SET RepoRoot=%~dp0..\..\..
|
SET RepoRoot=%~dp0..\..\..
|
||||||
%RepoRoot%\build.cmd -BuildNative -projects %~dp0**\*.csproj %*
|
%RepoRoot%\build.cmd -projects %~dp0**\*.csproj %*
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
@ECHO OFF
|
@ECHO OFF
|
||||||
SET RepoRoot=%~dp0..\..
|
SET RepoRoot=%~dp0..\..
|
||||||
%RepoRoot%\build.cmd -projects %~dp0**\*.*proj %*
|
%RepoRoot%\build.cmd -projects %~dp0**\*.csproj %*
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,14 @@ SET RepoRoot=%~dp0..\..
|
||||||
|
|
||||||
ECHO Building x64 Microsoft.AspNetCore.Runtime.SiteExtension
|
ECHO Building x64 Microsoft.AspNetCore.Runtime.SiteExtension
|
||||||
CALL "%RepoRoot%\build.cmd" -arch x64 -projects "%~dp0Runtime\Microsoft.AspNetCore.Runtime.SiteExtension.pkgproj" ^
|
CALL "%RepoRoot%\build.cmd" -arch x64 -projects "%~dp0Runtime\Microsoft.AspNetCore.Runtime.SiteExtension.pkgproj" ^
|
||||||
/bl:artifacts/log/SiteExtensions-Runtime-x86.binlog %*
|
"/bl:%RepoRoot%/artifacts/log/SiteExtensions-Runtime-x86.binlog" %*
|
||||||
IF %ERRORLEVEL% NEQ 0 (
|
IF %ERRORLEVEL% NEQ 0 (
|
||||||
EXIT /b %ErrorLevel%
|
EXIT /b %ErrorLevel%
|
||||||
)
|
)
|
||||||
|
|
||||||
ECHO Building x86 Microsoft.AspNetCore.Runtime.SiteExtension
|
ECHO Building x86 Microsoft.AspNetCore.Runtime.SiteExtension
|
||||||
CALL "%RepoRoot%\build.cmd" -arch x86 -projects "%~dp0Runtime\Microsoft.AspNetCore.Runtime.SiteExtension.pkgproj" ^
|
CALL "%RepoRoot%\build.cmd" -arch x86 -projects "%~dp0Runtime\Microsoft.AspNetCore.Runtime.SiteExtension.pkgproj" ^
|
||||||
/bl:artifacts/log/SiteExtensions-Runtime-x86.binlog %*
|
"/bl:%RepoRoot%/artifacts/log/SiteExtensions-Runtime-x86.binlog" %*
|
||||||
IF %ERRORLEVEL% NEQ 0 (
|
IF %ERRORLEVEL% NEQ 0 (
|
||||||
EXIT /b %ErrorLevel%
|
EXIT /b %ErrorLevel%
|
||||||
)
|
)
|
||||||
|
|
@ -19,14 +19,14 @@ ECHO Building x64 LoggingBranch
|
||||||
REM /p:DisableTransitiveFrameworkReferences=true is needed to prevent SDK from picking up transitive references to
|
REM /p:DisableTransitiveFrameworkReferences=true is needed to prevent SDK from picking up transitive references to
|
||||||
REM Microsoft.AspNetCore.App as framework references https://github.com/dotnet/sdk/pull/3221
|
REM Microsoft.AspNetCore.App as framework references https://github.com/dotnet/sdk/pull/3221
|
||||||
CALL "%RepoRoot%\build.cmd" -arch x64 -projects "%~dp0LoggingBranch\LB.csproj" ^
|
CALL "%RepoRoot%\build.cmd" -arch x64 -projects "%~dp0LoggingBranch\LB.csproj" ^
|
||||||
/p:DisableTransitiveFrameworkReferences=true /bl:artifacts/log/SiteExtensions-LoggingBranch-x64.binlog %*
|
/p:DisableTransitiveFrameworkReferences=true "/bl:%RepoRoot%/artifacts/log/SiteExtensions-LoggingBranch-x64.binlog" %*
|
||||||
IF %ERRORLEVEL% NEQ 0 (
|
IF %ERRORLEVEL% NEQ 0 (
|
||||||
EXIT /b %ErrorLevel%
|
EXIT /b %ErrorLevel%
|
||||||
)
|
)
|
||||||
|
|
||||||
ECHO Building x86 LoggingBranch
|
ECHO Building x86 LoggingBranch
|
||||||
CALL "%RepoRoot%\build.cmd" -arch x86 -projects "%~dp0LoggingBranch\LB.csproj" ^
|
CALL "%RepoRoot%\build.cmd" -arch x86 -projects "%~dp0LoggingBranch\LB.csproj" ^
|
||||||
/p:DisableTransitiveFrameworkReferences=true /bl:artifacts/log/SiteExtensions-LoggingBranch-x86.binlog %*
|
/p:DisableTransitiveFrameworkReferences=true "/bl:%RepoRoot%/artifacts/log/SiteExtensions-LoggingBranch-x86.binlog" %*
|
||||||
IF %ERRORLEVEL% NEQ 0 (
|
IF %ERRORLEVEL% NEQ 0 (
|
||||||
EXIT /b %ErrorLevel%
|
EXIT /b %ErrorLevel%
|
||||||
)
|
)
|
||||||
|
|
@ -34,7 +34,7 @@ IF %ERRORLEVEL% NEQ 0 (
|
||||||
ECHO Building Microsoft.AspNetCore.AzureAppServices.SiteExtension
|
ECHO Building Microsoft.AspNetCore.AzureAppServices.SiteExtension
|
||||||
CALL "%RepoRoot%\build.cmd" -projects ^
|
CALL "%RepoRoot%\build.cmd" -projects ^
|
||||||
"%~dp0LoggingAggregate\src\Microsoft.AspNetCore.AzureAppServices.SiteExtension\Microsoft.AspNetCore.AzureAppServices.SiteExtension.csproj" ^
|
"%~dp0LoggingAggregate\src\Microsoft.AspNetCore.AzureAppServices.SiteExtension\Microsoft.AspNetCore.AzureAppServices.SiteExtension.csproj" ^
|
||||||
/bl:artifacts/log/SiteExtensions-LoggingAggregate.binlog %*
|
"/bl:%RepoRoot%/artifacts/log/SiteExtensions-LoggingAggregate.binlog" %*
|
||||||
IF %ERRORLEVEL% NEQ 0 (
|
IF %ERRORLEVEL% NEQ 0 (
|
||||||
EXIT /b %ErrorLevel%
|
EXIT /b %ErrorLevel%
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue