Skip to content

Commit 6d264a1

Browse files
committed
fix publish modules
1 parent 41a7993 commit 6d264a1

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

build.proj

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@
4444
<!-- Flags -->
4545
<CodeSign Condition ="'$(CodeSign)' == ''">false</CodeSign>
4646
<SkipHelp Condition ="'$(SkipHelp)' != 'true'">false</SkipHelp>
47+
<TargetBuild Condition="Exists($(TargetModule))">true</TargetBuild>
48+
<TargetBuild Condition="!Exists($(TargetModule))">false</TargetBuild>
49+
50+
4751
<!-- Set this true only if you want to test the CodeSign workflow locally -->
4852
<DelaySign Condition ="'$(DelaySign)' == ''">false</DelaySign>
4953
<NetCore Condition="'$(NetCore)' != 'false'">true</NetCore>
@@ -262,7 +266,7 @@
262266
<Exec Command="$(PowerShellCoreCommandPrefix) &quot;. $(RepoTools)/CleanupBuild.ps1 -BuildConfig $(Configuration) -GenerateDocumentationFile $(GenerateDocumentationFile) &quot;" />
263267

264268
<Error Condition="'$(NuGetKey)' == ''" Text="You must provide the NuGetKey parameter to the build: /p:NuGetKey=YOUR_PUBLISHING_KEY" />
265-
<Exec Command="$(PowerShellCoreCommandPrefix) &quot;. $(RepoTools)/PublishModules.ps1 -IsNetCore:$$(NetCore) -BuildConfig $(Configuration) -Scope $(Scope) -ApiKey $(NuGetKey) -RepositoryLocation \&quot;$(NuGetPublishingSource)\&quot;&quot; -NugetExe $(NuGetCommand)" />
269+
<Exec Command="$(PowerShellCoreCommandPrefix) &quot;. $(RepoTools)/PublishModules.ps1 -TargetBuild $(TargetBuild) -IsNetCore:$$(NetCore) -BuildConfig $(Configuration) -Scope $(Scope) -ApiKey $(NuGetKey) -RepositoryLocation \&quot;$(NuGetPublishingSource)\&quot;&quot; -NugetExe $(NuGetCommand)" />
266270
</Target>
267271

268272
<Target Name="BuildInstaller" AfterTargets="Publish" Condition="('$(Scope)' == 'All' or '$(Scope)' == 'Latest' or '$(Scope)' == 'Netcore')">

tools/PublishModules.ps1

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,10 @@ param(
5656
[string]$RepositoryLocation,
5757

5858
[Parameter(Mandatory = $false, Position = 5)]
59-
[string]$NugetExe
59+
[string]$NugetExe,
60+
61+
[Parameter(Mandatory = $false, Position = 6)]
62+
[string]$TargetBuild
6063
)
6164

6265
Import-Module "$PSScriptRoot\PublishModules.psm1"
@@ -117,7 +120,7 @@ $env:PSModulePath = "$env:PSModulePath;$tempRepoPath"
117120
$Errors = $null
118121

119122
try {
120-
$modules = Get-AllModules -BuildConfig $BuildConfig -Scope $Scope -PublishLocal:$PublishLocal -IsNetCore:$IsNetCore
123+
$modules = Get-AllModules -BuildConfig $BuildConfig -Scope $Scope -TargetBuild $TargetBuild -PublishLocal:$PublishLocal -IsNetCore:$IsNetCore
121124
Add-AllModules -ModulePaths $modules -TempRepo $tempRepoName -TempRepoPath $tempRepoPath -NugetExe $NugetExe
122125
Publish-AllModules -ModulePaths $modules -ApiKey $apiKey -TempRepoPath $tempRepoPath -RepoLocation $repositoryLocation -NugetExe $NugetExe -PublishLocal:$PublishLocal
123126
} catch {

tools/PublishModules.psm1

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,8 @@ function Get-AllModules {
267267
[ValidateNotNullOrEmpty()]
268268
[String]$Scope,
269269

270+
[String]$TargetBuild,
271+
270272
[switch]$PublishLocal,
271273

272274
[switch]$IsNetCore
@@ -275,7 +277,7 @@ function Get-AllModules {
275277
$clientModules = Get-ClientModules -BuildConfig $BuildConfig -Scope $Scope -PublishLocal:$PublishLocal -IsNetCore:$isNetCore
276278
Write-Host " "
277279

278-
if($clientModules.Length -le 2) {
280+
if($clientModules.Length -le 2 -and $TargetBuild -eq "true") {
279281
return @{
280282
ClientModules = $clientModules
281283
}

0 commit comments

Comments
 (0)