Skip to content

Commit 6706e7c

Browse files
authored
Allow RepositoryRootDirectory to be set (#10713)
* Allow custom repository root directory
1 parent 02a6e9c commit 6706e7c

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

build/common.ps1

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -200,19 +200,24 @@ Function Sign-Binaries {
200200
[int]$BuildNumber = (Get-BuildNumber),
201201
[string]$MSBuildVersion = $DefaultMSBuildVersion,
202202
[string[]]$ProjectsToSign = $null,
203-
[switch]$BinLog
203+
[switch]$BinLog,
204+
[string]$RepositoryRootDirectory = $null
204205
)
205206

206-
if ($ProjectsToSign -eq $null) {
207+
if ($null -eq $ProjectsToSign) {
207208
$repositoryDir = [IO.Path]::GetDirectoryName($PSScriptRoot)
208209
$defaultProjectsToSign = Join-Path $repositoryDir "src\**\*.csproj"
209210
$ProjectsToSign = @($defaultProjectsToSign)
210211
}
211212

212213
$projectsToSignProperty = $ProjectsToSign -join ';'
214+
$msbuildProperties = "/p:ProjectsToSign=`"$projectsToSignProperty`""
215+
if ($RepositoryRootDirectory) {
216+
$msbuildProperties += ";RepositoryRootDirectory=`"$RepositoryRootDirectory`""
217+
}
213218

214219
$ProjectPath = Join-Path $PSScriptRoot "sign-binaries.proj"
215-
Build-Solution $Configuration $BuildNumber -MSBuildVersion "$MSBuildVersion" $ProjectPath -MSBuildProperties "/p:ProjectsToSign=`"$projectsToSignProperty`"" -BinLog:$BinLog
220+
Build-Solution $Configuration $BuildNumber -MSBuildVersion "$MSBuildVersion" $ProjectPath -MSBuildProperties $msbuildProperties -BinLog:$BinLog
216221
}
217222

218223
Function Sign-Packages {

build/sign-binaries.proj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<Import Project="..\packages\MicroBuild.Core\build\MicroBuild.Core.props" Condition="Exists('..\packages\MicroBuild.Core\build\MicroBuild.Core.props')" />
44

55
<PropertyGroup>
6-
<RepositoryRootDirectory>$([System.IO.Path]::GetDirectoryName($(MSBuildProjectDirectory)))\</RepositoryRootDirectory>
6+
<RepositoryRootDirectory Condition="'$(RepositoryRootDirectory)' == ''">$([System.IO.Path]::GetDirectoryName($(MSBuildProjectDirectory)))\</RepositoryRootDirectory>
77
<IntermediateOutputPath>$(RepositoryRootDirectory)artifacts\sign\obj\</IntermediateOutputPath>
88
<OutDir>$(RepositoryRootDirectory)</OutDir>
99
<SignTargetsDependOn>BatchSign</SignTargetsDependOn>

0 commit comments

Comments
 (0)