Skip to content

Commit e515ea9

Browse files
committed
Merge branch 'dev' of https://github.com/Azure/azure-powershell into dev
2 parents 28289db + 31d9ac0 commit e515ea9

File tree

200 files changed

+4243
-4108
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

200 files changed

+4243
-4108
lines changed

AzurePowershell.Test.targets

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@
5050
Command="MSTest.exe /testcontainer:$(_testAssembly) /testsettings:$(_testSettings) /category:$(_testFilter) /resultsfile:$(_testResult)"
5151
ContinueOnError="false" />
5252
</Target>
53-
54-
<Target Name="InvokeXUnit">
53+
54+
<Target Name="DeclareXunitTests">
5555
<ItemGroup>
5656
<AsmXUnitTests Include=".\src\ServiceManagement\Common\Commands.Common.Test\bin\Debug\Microsoft.WindowsAzure.Commands.Common.Test.dll"/>
5757
<AsmXUnitTests Include=".\src\ServiceManagement\Services\Commands.Test\bin\Debug\Microsoft.WindowsAzure.Commands.Test.dll"/>
@@ -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,10 +85,12 @@
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>
91-
91+
</Target>
92+
93+
<Target Name="InvokeXUnit" DependsOnTargets="DeclareXunitTests">
9294
<Message Importance="high" Text="Running XUnit tests" />
9395
<MakeDir Directories="$(TestOutputDirectory)" ContinueOnError="false" />
9496
<Exec
@@ -97,7 +99,7 @@
9799
<OnError ExecuteTargets="TimeoutErrorHandler"/>
98100
</Target>
99101

100-
<Target Name="InvokeXUnitAll">
102+
<Target Name="InvokeXUnitAll" DependsOnTargets="DeclareXunitTests">
101103
<Message Importance="high" Text="Running XUnit tests" />
102104
<MakeDir Directories="$(TestOutputDirectory)" ContinueOnError="false" />
103105
<Exec

build.proj

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@
1818
1919
/p:CodeSign=True;DelaySign=True
2020
Test the code sign workflow locally.
21-
21+
22+
/p:Scope
23+
'ServiceManagement': service management
24+
'AzureStorage': storage data plane cmdlets
25+
'Subfolder under src\ResourceManager': An individual cmdlet module
26+
By default, it builds all
2227
-->
2328

2429
<!-- Define build properties -->
@@ -36,11 +41,15 @@
3641
<SetupOutputDirectory>$(PublishDirectory)\Setup</SetupOutputDirectory>
3742
<TestOutputDirectory>$(PublishDirectory)\TestResults</TestOutputDirectory>
3843
<BuildInParallel Condition="'$(BuildInParallel)' == ''">true</BuildInParallel>
39-
<NuGetPublishingSource Condition=" '$(NuGetPublishingSource)' != '' ">http://psget/PSGallery/api/v2/</NuGetPublishingSource>
44+
<NuGetPublishingSource Condition=" '$(NuGetPublishingSource)' == '' ">http://psget/PSGallery/api/v2/</NuGetPublishingSource>
45+
<Scope Condition=" $(Scope) == '' " >all</Scope>
4046
</PropertyGroup>
4147
<ItemGroup>
42-
<CmdletSolutionsToBuild Include=".\src\ResourceManager.sln;.\src\ServiceManagement.sln" Condition=" '$(Scope)' == '' "/>
43-
<CmdletSolutionsToBuild Include=".\src\$(Scope).sln" Condition=" '$(Scope)' != '' "/>
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' "/>
51+
<CmdletSolutionsToBuild Include=".\src\ServiceManagement\ServiceManagement.sln"
52+
Condition=" '$(Scope)' == 'ServiceManagement' or '$(Scope)' == 'AzureStorage' "/>
4453
<SetupSln Include=".\setup\azurepowershell.sln" />
4554
<SetupPowershellGetSln Include=".\setup-powershellget\powershellget.sln" />
4655
</ItemGroup>
@@ -76,7 +85,7 @@
7685
Targets="Clean"
7786
Properties="Configuration=$(Configuration);Platform=Any CPU"
7887
ContinueOnError="false"
79-
Condition=" '$(Scope)' == '' "/>
88+
Condition=" '$(Scope)' == 'all' "/>
8089

8190
<!-- Delete the publish files -->
8291
<Message Importance="high" Text="Cleaning publish files..." ContinueOnError="false" />
@@ -104,7 +113,7 @@
104113
</Target>
105114

106115
<PropertyGroup>
107-
<NuGetCommand>$(MSBuildProjectDirectory)\src\.nuget\NuGet.exe</NuGetCommand>
116+
<NuGetCommand>$(MSBuildProjectDirectory)\tools\NuGet.exe</NuGetCommand>
108117
<NuGetRestoreConfigFile>$(MSBuildProjectDirectory)\restore.config</NuGetRestoreConfigFile>
109118
<NuGetRestoreConfigSwitch>-ConfigFile &quot;$(NuGetRestoreConfigFile)&quot;</NuGetRestoreConfigSwitch>
110119
<PowerShellCommand>C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe</PowerShellCommand>
@@ -131,13 +140,9 @@
131140
<Exec Command="$(NuGetCommand) sources add -Name LocalFeed -Source &quot;$(MSBuildProjectDirectory)\tools\LocalFeed&quot; $(NuGetRestoreConfigSwitch)"/>
132141

133142
<!-- Restore packages -->
134-
<Exec Command="$(NuGetCommand) restore $(MSBuildProjectDirectory)\src\ResourceManager.sln $(NuGetRestoreConfigSwitch)" ContinueOnError="false"
135-
Condition="$(Scope) == ''" />
136-
<Exec Command="$(NuGetCommand) restore $(MSBuildProjectDirectory)\src\ServiceManagement.sln $(NuGetRestoreConfigSwitch)" ContinueOnError="false"
137-
Condition="$(Scope) == ''" />
138-
<Exec Command="$(NuGetCommand) restore $(MSBuildProjectDirectory)\src\$(Scope).sln $(NuGetRestoreConfigSwitch)" ContinueOnError="false"
139-
Condition="$(Scope) != ''" />
140-
143+
<Exec Command="$(NuGetCommand) restore %(CmdletSolutionsToBuild.FullPath) $(NuGetRestoreConfigSwitch)"
144+
ContinueOnError="false" />
145+
141146
<!--Restore the xunit runner needed to run unit tests-->
142147
<Exec Command="$(NuGetCommand) restore $(MSBuildProjectDirectory)\packages.config -PackagesDirectory $(MSBuildProjectDirectory)\packages" />
143148

@@ -162,17 +167,17 @@
162167
Targets="Build"
163168
Properties="Configuration=$(Configuration);Platform=Any CPU"
164169
ContinueOnError="false"
165-
Condition=" '$(Scope)' == '' "/>
170+
Condition=" '$(Scope)' == 'all' "/>
166171

167172
<MSBuild
168173
Projects="@(SetupSln)"
169174
Targets="Build"
170175
Properties="Configuration=$(Configuration);Platform=Any CPU"
171176
ContinueOnError="false"
172-
Condition=" '$(Scope)' == '' "/>
177+
Condition=" '$(Scope)' == 'all' "/>
173178

174179
<CallTarget Targets="CodeSignInstaller"
175-
Condition=" '$(CodeSign)' == 'true' and '$(Scope)' == ''" />
180+
Condition=" '$(CodeSign)' == 'true' and '$(Scope)' == 'all'" />
176181
</Target>
177182

178183
<!-- Do everything possible -->
@@ -200,6 +205,10 @@
200205
<!-- Copying shortcut to be signed -->
201206
<Copy SourceFiles="$(LibraryRoot)setup-powershellget\Setup\ShortcutStartup.ps1"
202207
DestinationFolder="$(LibrarySourceFolder)\Package\$(Configuration)" />
208+
<Copy SourceFiles="$(LibraryRoot)tools\AzureRM\AzureRM.psd1"
209+
DestinationFolder="$(LibrarySourceFolder)\Package\$(Configuration)" />
210+
<Copy SourceFiles="$(LibraryRoot)tools\AzureRM\AzureRM.psm1"
211+
DestinationFolder="$(LibrarySourceFolder)\Package\$(Configuration)" />
203212

204213
<ItemGroup>
205214
<DelaySignedAssembliesToSign Include="$(LibrarySourceFolder)\Package\$(Configuration)\**\Microsoft*Azure*Commands*.dll" />
@@ -251,6 +260,10 @@
251260
<!-- Copying signed shortcut back -->
252261
<Copy SourceFiles="$(LibrarySourceFolder)\Package\$(Configuration)\ShortcutStartup.ps1"
253262
DestinationFolder="$(LibraryRoot)setup-powershellget\Setup" />
263+
<Copy SourceFiles="$(LibrarySourceFolder)\Package\$(Configuration)\AzureRM.psd1"
264+
DestinationFolder="$(LibraryRoot)tools\AzureRM" />
265+
<Copy SourceFiles="$(LibrarySourceFolder)\Package\$(Configuration)\AzureRM.psm1"
266+
DestinationFolder="$(LibraryRoot)tools\AzureRM" />
254267
</Target>
255268

256269
<Target Name="CodeSignInstaller">
@@ -284,11 +297,10 @@
284297
</Target>
285298

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

294306
<PropertyGroup>

setup-powershellget/Setup/ShortcutStartup.ps1

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,32 @@ Param(
1717
[switch]$Install
1818
)
1919

20+
function EnsureRegistryPath
21+
{
22+
$originalpaths = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PSModulePath).PSModulePath
23+
if($originalpaths.Contains("$env:ProgramFiles\WindowsPowerShell\Modules") -eq $false)
24+
{
25+
Write-Output "Fixing PSModulePath"
26+
$newPath = "$originalpaths;$env:ProgramFiles\WindowsPowerShell\Modules"
27+
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name PSModulePath –Value $newPath
28+
}
29+
else
30+
{
31+
Write-Output "PSModulePath successfuly validated"
32+
}
33+
}
34+
2035
$error.clear()
2136
try {
2237
if ($Install.IsPresent) {
38+
EnsureRegistryPath
2339
Write-Output @"
2440
2541
Finalizing installation of Azure PowerShell.
2642
Installing Azure Modules from PowerShell Gallery.
2743
This may take some time...
2844
"@
29-
$env:PSModulePath = "$env:HOME\Documents\WindowsPowerShell\Modules;$env:ProgramFiles\WindowsPowerShell\Modules;$env:SystemRoot\system32\WindowsPowerShell\v1.0\Modules\"
45+
$env:PSModulePath = "$env:USERPROFILE\Documents\WindowsPowerShell\Modules;$env:ProgramFiles\WindowsPowerShell\Modules;$env:SystemRoot\system32\WindowsPowerShell\v1.0\Modules\"
3046

3147
Import-Module PackageManagement
3248

@@ -51,7 +67,11 @@ To use Azure Service Management cmdlets please execute the following cmdlet:
5167
$VerbosePreference = "Continue"
5268
}
5369
}
54-
catch { Write-Output $error }
55-
if ($error) {
56-
Read-Host -Prompt "An error occured during installation. Press any key..."
57-
}
70+
catch
71+
{
72+
Write-Output "An error occured during installation."
73+
Write-Output $error
74+
Write-Output "Press any key..."
75+
$host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
76+
}
77+

setup-powershellget/azurecmd.wxs

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
3-
3+
44
<?define productName="Microsoft Azure PowerShell - October 2015" ?>
55
<?define sourceDir="$(var.SolutionDir)..\src\Package\$(var.Configuration)" ?>
66
<?define caSourceDir="$(var.SolutionDir)setup\bin\$(var.Configuration)" ?>
@@ -28,8 +28,6 @@
2828
<Property Id="ALLUSERS" Value="1" />
2929
<!-- per machine install-->
3030

31-
<Property Id="POWERSHELLEXE"><![CDATA[C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe]]></Property>
32-
3331
<Property Id="PSCOMPATIBLEVERSION">
3432
<RegistrySearch Id="PSCOMPATIBLEVERSION" Root="HKLM" Key="SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine" Name="PSCompatibleVersion" Type="raw" />
3533
</Property>
@@ -60,19 +58,16 @@
6058
</Directory>
6159

6260
<Property Id="POWERSHELLPATH">
63-
<RegistrySearch Id="POWERSHELLPATH"
61+
<RegistrySearch Id="POWERSHELLPATH"
6462
Type="raw"
6563
Root="HKLM"
6664
Key="SOFTWARE\Microsoft\PowerShell\3\PowerShellEngine"
6765
Name="ApplicationBase" />
6866
</Property>
6967

68+
<SetProperty Id="POWERSHELLEXE" Value="[WindowsFolder]System32\WindowsPowerShell\v1.0\powershell.exe" Before="AppSearch"/>
69+
7070
<DirectoryRef Id="PowerShellFolder">
71-
<Component Id="PSModulePath.System" Guid="273525B9-7AAB-421A-90C8-8E50A1840B8D">
72-
<CreateFolder />
73-
<!-- Work around bug that PowerShell does not always consider default module paths. -->
74-
<Environment Id="PSModulePath.SystemAppRoot" Action="set" Name="PSMODULEPATH" Part="last" Value="[PowerShellFolder]ServiceManagement" System="yes" />
75-
</Component>
7671
<Component Id="AzureSdkShortcutScript" Guid="3d0d589a-b34c-4c48-9a4c-df78f286c6a3">
7772
<File Id="AzureSdkShortcutScriptFile" KeyPath="yes" Source="$(var.SolutionDir)\Setup\ShortcutStartup.ps1" />
7873
</Component>
@@ -83,7 +78,7 @@
8378
<Shortcut Id="AzureSdkStartMenuShortcut"
8479
Name="Microsoft Azure PowerShell"
8580
Description="Microsoft PowerShell cmdlets"
86-
Target="[POWERSHELLPATH]\powershell.exe"
81+
Target="[POWERSHELLEXE]"
8782
Arguments="-NoExit -ExecutionPolicy Bypass -File &quot;[PowerShellFolder]\ShortcutStartup.ps1&quot;"/>
8883
<RemoveFolder Id="AzureSdkMenu" On="uninstall"/>
8984
<RemoveFile Id="RemoveStaleFiles" Directory="StaleAzureSdkMenu" Name="Windows Azure PowerShell.lnk" On="both"/>
@@ -92,15 +87,14 @@
9287
</DirectoryRef>
9388

9489
<Feature Id="azurecmd" Title="Microsoft Azure PowerShell" Level="1" Description="Windows PowerShell commandlets">
95-
<ComponentRef Id="PSModulePath.System" />
9690
<ComponentRef Id="AzureSdkShortcut" />
9791
<ComponentRef Id="AzureSdkShortcutScript" />
9892
</Feature>
9993

10094
<Binary Id="CustomActions" SourceFile="$(var.caSourceDir)\Microsoft.WindowsAzure.Setup.CA.dll"/>
101-
<CustomAction Id="UpdatePSShortcut" BinaryKey="CustomActions" DllEntry="UpdatePSShortcut" Execute ="deferred" Impersonate="no"/>
10295
<CustomAction Id="SetCustomActionDataValue" Return="check" Property="UpdatePSShortcut"
10396
Value="ShortcutPath=[AzureSdkMenu]Microsoft Azure PowerShell.lnk;DefaultShortcutPath=[ProgramMenuFolder]System Tools\Windows PowerShell.lnk" />
97+
<CustomAction Id="UpdatePSShortcut" BinaryKey="CustomActions" DllEntry="UpdatePSShortcut" Execute ="deferred" Impersonate="no"/>
10498
<CustomAction Id="SetExecutionPolicy" Property="POWERSHELLEXE" ExeCommand="-NoLogo -NoProfile -Command &quot;Set-ExecutionPolicy RemoteSigned -Force&quot;" Execute="deferred" Impersonate="no" Return="check"/>
10599
<CustomAction Id="RunModuleInstallScript" Property="POWERSHELLEXE" ExeCommand="-NoLogo -NoProfile -Command &quot;. \&quot;[PowerShellFolder]\ShortcutStartup.ps1\&quot; -Install&quot;" Execute="deferred" Impersonate="no" Return="check"/>
106100

src/.nuget/NuGet.Config

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)