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
2 changes: 2 additions & 0 deletions docs/Invoke-FSCPSCompile.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,6 @@ This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable
## NOTES
Author: Oleksandr Nikolaiev (@onikolaiev)

To enable parallel MSBuild compilation, set the `msBuildParameters` value in your FSC-PS settings file before invoking this cmdlet. Example: `/MaxCpuCount:16 /p:BuildInParallel=true`. When omitted or empty, the compile step uses the existing default MSBuild behavior.

## RELATED LINKS
1 change: 1 addition & 0 deletions fscps.tools/internal/configurations/configuration.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Set-PSFConfig -FullName 'fscps.tools.settings.all.buildVersion' -Value '' -Initi
Set-PSFConfig -FullName 'fscps.tools.settings.all.solutionName' -Value '' -Initialize -Description ''
Set-PSFConfig -FullName 'fscps.tools.settings.all.enableBuildCaching' -Value $false -Initialize -Description ''
Set-PSFConfig -FullName 'fscps.tools.settings.all.cleanupAfterBuild' -Value $true -Initialize -Description 'Cleanup build cache after build'
Set-PSFConfig -FullName 'fscps.tools.settings.all.msBuildParameters' -Value '' -Initialize -Description 'Additional MSBuild command-line arguments appended to the compile step (e.g. /MaxCpuCount:16 /p:BuildInParallel=true).'
Set-PSFConfig -FullName 'fscps.tools.settings.all.exportModel' -Value $false -Initialize -Description 'Option to generate axmodel file. IMPORTANT!!! generatePackages option should be set to True'
Set-PSFConfig -FullName 'fscps.tools.settings.all.uploadPackageToLCS' -Value $false -Initialize -Description 'Option to upload the generated package to the LCS after the build and generate process. IMPORTANT!!! generatePackages option should be set to True'
Set-PSFConfig -FullName 'fscps.tools.settings.all.models' -Value '' -Initialize -Description 'Comma-delimited array of models.'
Expand Down
10 changes: 8 additions & 2 deletions fscps.tools/internal/functions/invoke-commercecompile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,20 @@ function Invoke-CommerceCompile {
$origLocation = Get-Location
Set-Location $SolutionBuildFolderPath

$commerceMsBuildParameters = "/t:restore,rebuild /property:Configuration=Release /property:NuGetInteractive=true /property:BuildingInsideVisualStudio=false"
if (-not [string]::IsNullOrWhiteSpace($settings.msBuildParameters)) {
$commerceMsBuildParameters = "$commerceMsBuildParameters $($settings.msBuildParameters)"
Write-PSFMessage -Level Important -Message "Using additional MSBuild parameters: $($settings.msBuildParameters)"
}

if($msbuildpath -ne "")
{
$msbuildexepath = Join-Path $msbuildpath "MSBuild\Current\Bin\MSBuild.exe"
$msbuildresult = Invoke-MsBuild -Path (Join-Path $SolutionBuildFolderPath $settings.solutionName) -MsBuildParameters "/t:restore,rebuild /property:Configuration=Release /property:NuGetInteractive=true /property:BuildingInsideVisualStudio=false" -MsBuildFilePath "$msbuildexepath" -ShowBuildOutputInCurrentWindow -BypassVisualStudioDeveloperCommandPrompt @CMDOUT
$msbuildresult = Invoke-MsBuild -Path (Join-Path $SolutionBuildFolderPath $settings.solutionName) -MsBuildParameters $commerceMsBuildParameters -MsBuildFilePath "$msbuildexepath" -ShowBuildOutputInCurrentWindow -BypassVisualStudioDeveloperCommandPrompt @CMDOUT
}
else
{
$msbuildresult = Invoke-MsBuild -Path (Join-Path $SolutionBuildFolderPath $settings.solutionName) -MsBuildParameters "/t:restore,rebuild /property:Configuration=Release /property:NuGetInteractive=true /property:BuildingInsideVisualStudio=false" -ShowBuildOutputInCurrentWindow @CMDOUT
$msbuildresult = Invoke-MsBuild -Path (Join-Path $SolutionBuildFolderPath $settings.solutionName) -MsBuildParameters $commerceMsBuildParameters -ShowBuildOutputInCurrentWindow @CMDOUT
}

$responseObject.BUILD_LOG_FILE_PATH = $msbuildresult.BuildLogFilePath
Expand Down
8 changes: 7 additions & 1 deletion fscps.tools/internal/functions/invoke-fsccompile.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,13 @@ function Invoke-FSCCompile {

Set-Content $BuidPropsFile (Get-Content $BuidPropsFile).Replace('ReferenceFolders', $msReferenceFolder)

$msbuildresult = Invoke-MsBuild -Path (Join-Path $SolutionBuildFolderPath "\Build\Build.sln") -P "/p:BuildTasksDirectory=$msBuildTasksDirectory /p:MetadataDirectory=$msMetadataDirectory /p:FrameworkDirectory=$msFrameworkDirectory /p:ReferencePath=$msReferencePath /p:OutputDirectory=$msOutputDirectory" -ShowBuildOutputInCurrentWindow @CMDOUT
$msBuildParameters = ""
if (-not [string]::IsNullOrWhiteSpace($settings.msBuildParameters)) {
$msBuildParameters = $settings.msBuildParameters
Write-PSFMessage -Level Important -Message "Using additional MSBuild parameters: $($settings.msBuildParameters)"
}

$msbuildresult = Invoke-MsBuild -Path (Join-Path $SolutionBuildFolderPath "\Build\Build.sln") -P "/p:BuildTasksDirectory=$msBuildTasksDirectory /p:MetadataDirectory=$msMetadataDirectory /p:FrameworkDirectory=$msFrameworkDirectory /p:ReferencePath=$msReferencePath /p:OutputDirectory=$msOutputDirectory" -MsBuildParameters $msBuildParameters -ShowBuildOutputInCurrentWindow @CMDOUT

$responseObject.BUILD_LOG_FILE_PATH = $msbuildresult.BuildLogFilePath

Expand Down
1 change: 1 addition & 0 deletions wiki/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ The settings file can be everywhere and provided to the fscps.tools through the
| repoToken | Repository access token | All | All | "" |
| fscPsVer | Version of the fscps.tools module | All | All | {current module version} |
| enableBuildCaching | If true, will "cache" FSC models after build and upload it to the ModelStorage storage account. If next build triggered fscps will check the CRC of each model folder and if its equal with the cached CRC the folder with the model binaries will be extracted to the source folder, and target model will be skipped to the build. | FSCM | All | false |
| msBuildParameters | Additional MSBuild command-line arguments appended to the compile step. Opt-in: leave empty for current single-threaded behavior. Example: `/MaxCpuCount:16 /p:BuildInParallel=true` | All | All | "" |


## Environments settings
Expand Down
Loading