Skip to content

Commit a451007

Browse files
committed
Merge pull request Azure#1001 from yugangw-msft/profilefirst
Several bug fixes to get individual cmdlet module published
2 parents feb6a31 + feab3b3 commit a451007

File tree

4 files changed

+38
-19
lines changed

4 files changed

+38
-19
lines changed

AzurePowershell.Test.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
<AsmXUnitTests Include=".\src\ServiceManagement\RecoveryServices\Commands.RecoveryServices.Test\bin\Debug\Microsoft.Azure.Commands.RecoveryServices.Test.dll"/>
6363
<AsmXUnitTests Include=".\src\ServiceManagement\Network\Commands.Network.Test\bin\Debug\Microsoft.WindowsAzure.Commands.ServiceManagement.Network.Test.dll"/>
6464
</ItemGroup>
65-
<ItemGroup Condition=" '$(scope)' == '' ">
65+
<ItemGroup Condition=" '$(scope)' == 'all' ">
6666
<XUnitTests Include=".\src\ResourceManager\SiteRecovery\Commands.SiteRecovery.Test\bin\Debug\Microsoft.Azure.Commands.SiteRecovery.Test.dll"/>
6767
<XUnitTests Include=".\src\ResourceManager\Sql\Commands.Sql.Test\bin\Debug\Microsoft.Azure.Commands.Sql.Test.dll"/>
6868
<XUnitTests Include=".\src\ResourceManager\Resources\Commands.Resources.Test\bin\Debug\Microsoft.Azure.Commands.Resources.Test.dll"/>
@@ -85,7 +85,7 @@
8585
<ItemGroup Condition=" '$(scope)' == 'ServiceManagement' ">
8686
<XUnitTests Include="@(AsmXUnitTests)"/>
8787
</ItemGroup>
88-
<ItemGroup Condition=" '$(scope)' !='' and '$(scope)' != 'ServiceManagement' ">
88+
<ItemGroup Condition=" '$(scope)' != 'all' and '$(scope)' != 'ServiceManagement' and '$(scope)' != 'AzureStorage' ">
8989
<XUnitTests Include="$(MSBuildProjectDirectory)\src\ResourceManager\$(scope)\*\bin\Debug\*.Test.dll"/>
9090
</ItemGroup>
9191
</Target>

build.proj

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,14 @@
4242
<TestOutputDirectory>$(PublishDirectory)\TestResults</TestOutputDirectory>
4343
<BuildInParallel Condition="'$(BuildInParallel)' == ''">true</BuildInParallel>
4444
<NuGetPublishingSource Condition=" '$(NuGetPublishingSource)' == '' ">http://psget/PSGallery/api/v2/</NuGetPublishingSource>
45+
<Scope Condition=" $(Scope) == '' " >all</Scope>
4546
</PropertyGroup>
4647
<ItemGroup>
47-
<CmdletSolutionsToBuild Include=".\src\ResourceManager\**\*.sln;.\src\ServiceManagement\ServiceManagement.sln" Condition=" '$(Scope)' == '' "/>
48-
<CmdletSolutionsToBuild Include=".\src\ResourceManager\$(Scope)\*.sln" Condition=" '$(Scope)' != '' and '$(Scope)' != 'ServiceManagement' "/>
48+
<CmdletSolutionsToBuild Include=".\src\ResourceManager\**\*.sln;.\src\ServiceManagement\ServiceManagement.sln" Condition=" '$(Scope)' == 'all' "/>
49+
<CmdletSolutionsToBuild Include=".\src\ResourceManager\$(Scope)\*.sln"
50+
Condition=" '$(Scope)' != 'all' and '$(Scope)' != 'ServiceManagement' and '$(Scope)' != 'AzureStorage' "/>
4951
<CmdletSolutionsToBuild Include=".\src\ServiceManagement\ServiceManagement.sln"
50-
Condition=" '$(Scope)' != '' and ('$(Scope)' == 'ServiceManagement' or '$(Scope)' == 'AzureStorage') "/>
52+
Condition=" '$(Scope)' == 'ServiceManagement' or '$(Scope)' == 'AzureStorage' "/>
5153
<SetupSln Include=".\setup\azurepowershell.sln" />
5254
<SetupPowershellGetSln Include=".\setup-powershellget\powershellget.sln" />
5355
</ItemGroup>
@@ -83,7 +85,7 @@
8385
Targets="Clean"
8486
Properties="Configuration=$(Configuration);Platform=Any CPU"
8587
ContinueOnError="false"
86-
Condition=" '$(Scope)' == '' "/>
88+
Condition=" '$(Scope)' == 'all' "/>
8789

8890
<!-- Delete the publish files -->
8991
<Message Importance="high" Text="Cleaning publish files..." ContinueOnError="false" />
@@ -165,17 +167,17 @@
165167
Targets="Build"
166168
Properties="Configuration=$(Configuration);Platform=Any CPU"
167169
ContinueOnError="false"
168-
Condition=" '$(Scope)' == '' "/>
170+
Condition=" '$(Scope)' == 'all' "/>
169171

170172
<MSBuild
171173
Projects="@(SetupSln)"
172174
Targets="Build"
173175
Properties="Configuration=$(Configuration);Platform=Any CPU"
174176
ContinueOnError="false"
175-
Condition=" '$(Scope)' == '' "/>
177+
Condition=" '$(Scope)' == 'all' "/>
176178

177179
<CallTarget Targets="CodeSignInstaller"
178-
Condition=" '$(CodeSign)' == 'true' and '$(Scope)' == ''" />
180+
Condition=" '$(CodeSign)' == 'true' and '$(Scope)' == 'all'" />
179181
</Target>
180182

181183
<!-- Do everything possible -->
@@ -295,7 +297,7 @@
295297
</Target>
296298

297299
<!-- Publish all packages -->
298-
<Target Name="Publish" DependsOnTargets="Build">
300+
<Target Name="Publish">
299301
<Error Condition=" '$(NuGetKey)' == '' " Text="You must provide the NuGetKey parameter to the build: /p:NuGetKey=YOUR_PUBLISHING_KEY" />
300302
<Message Importance="high" Text="Publishing Cmdlets..." />
301303
<Exec Command="$(PowerShellCommand) -NonInteractive -NoLogo -NoProfile -Command &quot;. $(LibraryToolsFolder)\PublishModules.ps1 $(Configuration) $(Scope) $(NuGetKey) \&quot;$(NuGetPublishingSource)\&quot; &quot;"/>

src/ResourceManager/ApiManagement/ApiManagement.sln

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Microsoft Visual Studio Solution File, Format Version 12.00
22
# Visual Studio 2013
3-
VisualStudioVersion = 12.0.31101.0
3+
VisualStudioVersion = 12.0.40629.0
44
MinimumVisualStudioVersion = 10.0.40219.1
55
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{95C16AED-FD57-42A0-86C3-2CF4300A4817}"
66
EndProject
@@ -32,6 +32,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Co
3232
EndProject
3333
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ServiceManagement.Common", "..\..\ServiceManagement\Common\Commands.ServiceManagement.Common\Commands.ServiceManagement.Common.csproj", "{CFF09E81-1E31-444E-B4D4-A21E946C29E2}"
3434
EndProject
35+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Tags", "..\Tags\Commands.Tags\Commands.Tags.csproj", "{2493A8F7-1949-4F29-8D53-9D459046C3B8}"
36+
EndProject
3537
Global
3638
GlobalSection(SolutionConfigurationPlatforms) = preSolution
3739
Debug|Any CPU = Debug|Any CPU
@@ -94,6 +96,10 @@ Global
9496
{CFF09E81-1E31-444E-B4D4-A21E946C29E2}.Debug|Any CPU.Build.0 = Debug|Any CPU
9597
{CFF09E81-1E31-444E-B4D4-A21E946C29E2}.Release|Any CPU.ActiveCfg = Release|Any CPU
9698
{CFF09E81-1E31-444E-B4D4-A21E946C29E2}.Release|Any CPU.Build.0 = Release|Any CPU
99+
{2493A8F7-1949-4F29-8D53-9D459046C3B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
100+
{2493A8F7-1949-4F29-8D53-9D459046C3B8}.Debug|Any CPU.Build.0 = Debug|Any CPU
101+
{2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.ActiveCfg = Release|Any CPU
102+
{2493A8F7-1949-4F29-8D53-9D459046C3B8}.Release|Any CPU.Build.0 = Release|Any CPU
97103
EndGlobalSection
98104
GlobalSection(SolutionProperties) = preSolution
99105
HideSolutionNode = FALSE

tools/PublishModules.ps1

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,19 @@ if ($repo -ne $null) {
5353
Register-PSRepository -Name $repoName -SourceLocation $repositoryLocation -PublishLocation $repositoryLocation/package -InstallationPolicy Trusted
5454
}
5555

56+
$resourceManagerRootFolder = "$packageFolder\$buildConfig\ResourceManager\AzureResourceManager"
57+
58+
if ($scope -eq 'All') {
59+
# Publish AzureRM.Profile first which is the common dependency
60+
Write-Host "Publishing profile module"
61+
Publish-Module -Path "$resourceManagerRootFolder\AzureRM.Profile" -NuGetApiKey $apiKey -Repository $repoName
62+
Write-Host "Published profile module"
63+
}
64+
5665
if (($scope -eq 'All') -or ($scope -eq 'ServiceManagement')) {
5766
$modulePath = "$packageFolder\$buildConfig\ServiceManagement\Azure"
5867
# Publish Azure module
59-
Write-Host "Publishing Azure module from $modulePath"
68+
Write-Host "Publishing ServiceManagement(aka Azure) module from $modulePath"
6069
Publish-Module -Path $modulePath -NuGetApiKey $apiKey -Repository $repoName
6170
}
6271

@@ -75,15 +84,17 @@ if ($scope -eq 'AzureRM') {
7584
Write-Host "Published Azure module"
7685
}
7786

78-
$resourceManagerRootFolder = "$packageFolder\$buildConfig\ResourceManager\AzureResourceManager"
7987
$resourceManagerModules = Get-ChildItem -Path $resourceManagerRootFolder -Directory
80-
if ($scope -eq 'All') {
81-
# Publish AzureRM modules
88+
if ($scope -eq 'All') {
8289
foreach ($module in $resourceManagerModules) {
83-
$modulePath = $module.FullName
84-
Write-Host "Publishing $module module from $modulePath"
85-
Publish-Module -Path $modulePath -NuGetApiKey $apiKey -Repository $repoName
86-
Write-Host "Published $module module"
90+
# filter out AzureRM.Profile which always gets published first
91+
# And "Azure.Storage" which is built out as test dependencies
92+
if (($module.Name -ne "AzureRM.Profile") -and ($module.Name -ne "Azure.Storage")) {
93+
$modulePath = $module.FullName
94+
Write-Host "Publishing $module module from $modulePath"
95+
Publish-Module -Path $modulePath -NuGetApiKey $apiKey -Repository $repoName
96+
Write-Host "Published $module module"
97+
}
8798
}
8899
} else {
89100
$modulePath = Join-Path $resourceManagerRootFolder "AzureRM.$scope"

0 commit comments

Comments
 (0)