Skip to content

Commit f7451dc

Browse files
committed
Ran format on more pwsh files, seems the format all extension did not do that.
1 parent 9edc354 commit f7451dc

7 files changed

Lines changed: 89 additions & 102 deletions

bootstrap.ps1

Lines changed: 24 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,14 @@ try {
99
$IsLinux = $Runtime::IsOSPlatform($OSPlatform::Linux)
1010
$IsMacOS = $Runtime::IsOSPlatform($OSPlatform::OSX)
1111
$IsWindows = $Runtime::IsOSPlatform($OSPlatform::Windows)
12-
}
13-
catch {
12+
} catch {
1413
# If these are already set, then they're read-only and we're done
1514
try {
1615
$IsCoreCLR = $false
1716
$IsLinux = $false
1817
$IsMacOS = $false
1918
$IsWindows = $true
20-
}
21-
catch { }
19+
} catch { }
2220
}
2321

2422
if ($IsLinux) {
@@ -33,75 +31,71 @@ if ($IsLinux) {
3331
function Start-DotnetBootstrap {
3432
[CmdletBinding(
3533
SupportsShouldProcess = $true,
36-
ConfirmImpact = "High")]
34+
ConfirmImpact = 'High')]
3735
param(
38-
[string]$Channel = "preview",
36+
[string]$Channel = 'preview',
3937
#[string]$Version = "latest",
4038
# we currently pin dotnet-cli version, because tool
4139
# is currently migrating to msbuild toolchain
4240
# and requires constant updates to our build process.
43-
[string]$Version = "2.1.503"
41+
[string]$Version = '2.1.503'
4442
)
4543

4644
# Install ours and .NET's dependencies
4745
$Deps = @()
4846
if ($IsUbuntu) {
4947
# Build tools
50-
$Deps += "curl", "g++", "cmake", "make"
48+
$Deps += 'curl', 'g++', 'cmake', 'make'
5149

5250
# .NET Core required runtime libraries
53-
$Deps += "libunwind8"
54-
if ($IsUbuntu14) { $Deps += "libicu52" }
55-
elseif ($IsUbuntu16) { $Deps += "libicu55" }
51+
$Deps += 'libunwind8'
52+
if ($IsUbuntu14) { $Deps += 'libicu52' }
53+
elseif ($IsUbuntu16) { $Deps += 'libicu55' }
5654

5755
# Install dependencies
5856
sudo apt-get install -y -qq $Deps
59-
}
60-
elseif ($IsCentOS) {
57+
} elseif ($IsCentOS) {
6158
# Build tools
62-
$Deps += "which", "curl", "gcc-c++", "cmake", "make"
59+
$Deps += 'which', 'curl', 'gcc-c++', 'cmake', 'make'
6360

6461
# .NET Core required runtime libraries
65-
$Deps += "libicu", "libunwind"
62+
$Deps += 'libicu', 'libunwind'
6663

6764
# Install dependencies
6865
sudo yum install -y -q $Deps
69-
}
70-
elseif ($IsMacOS) {
66+
} elseif ($IsMacOS) {
7167

7268
# Build tools
73-
$Deps += "curl", "cmake"
69+
$Deps += 'curl', 'cmake'
7470

7571
# .NET Core required runtime libraries
76-
$Deps += "openssl"
72+
$Deps += 'openssl'
7773

7874
# Install dependencies
7975
brew install $Deps
8076
}
8177

82-
$obtainUrl = "https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain"
78+
$obtainUrl = 'https://raw.githubusercontent.com/dotnet/cli/master/scripts/obtain'
8379

8480
# Install for Linux and OS X
8581
if ($IsLinux -or $IsMacOS) {
8682
# Uninstall all previous dotnet packages
8783
$uninstallScript = if ($IsUbuntu) {
88-
"dotnet-uninstall-debian-packages.sh"
89-
}
90-
elseif ($IsMacOS) {
91-
"dotnet-uninstall-pkgs.sh"
84+
'dotnet-uninstall-debian-packages.sh'
85+
} elseif ($IsMacOS) {
86+
'dotnet-uninstall-pkgs.sh'
9287
}
9388

9489
if ($uninstallScript) {
9590
curl -s $obtainUrl/uninstall/$uninstallScript -o $uninstallScript
9691
chmod +x $uninstallScript
9792
sudo ./$uninstallScript
98-
}
99-
else {
100-
Write-Warning "This script only removes prior versions of dotnet for Ubuntu 14.04 and OS X"
93+
} else {
94+
Write-Warning 'This script only removes prior versions of dotnet for Ubuntu 14.04 and OS X'
10195
}
10296

10397
# Install new dotnet 1.0.0 preview packages
104-
$installScript = "dotnet-install.sh"
98+
$installScript = 'dotnet-install.sh'
10599
curl -s $obtainUrl/$installScript -o $installScript
106100
chmod +x $installScript
107101
bash ./$installScript -c $Channel -v $Version
@@ -110,15 +104,15 @@ function Start-DotnetBootstrap {
110104
if ($IsMacOS) {
111105
# This is the library shipped with .NET Core
112106
# This is allowed to fail as the user may have installed other versions of dotnet
113-
Write-Warning ".NET Core links the incorrect OpenSSL, correcting .NET CLI libraries..."
107+
Write-Warning '.NET Core links the incorrect OpenSSL, correcting .NET CLI libraries...'
114108
find $env:HOME/.dotnet -name System.Security.Cryptography.Native.dylib | xargs sudo install_name_tool -add_rpath /usr/local/opt/openssl/lib
115109
}
116110
}
117111

118112
# Install for Windows
119113
if ($IsWindows) {
120114
Remove-Item -ErrorAction SilentlyContinue -Recurse -Force ~\AppData\Local\Microsoft\dotnet
121-
$installScript = "dotnet-install.ps1"
115+
$installScript = 'dotnet-install.ps1'
122116
Invoke-WebRequest -Uri $obtainUrl/$installScript -OutFile $installScript
123117
& ./$installScript -c $Channel -Version $Version
124118
}

build.ps1

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
# Copyright (c) Microsoft Corporation. All rights reserved.
22
# Licensed under the MIT License.
33

4-
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingWriteHost", "")]
5-
[CmdletBinding(DefaultParameterSetName="build")]
4+
[System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWriteHost', '')]
5+
[CmdletBinding(DefaultParameterSetName = 'build')]
66
param (
7-
[Parameter(ParameterSetName="build")]
7+
[Parameter(ParameterSetName = 'build')]
88
[switch]
99
$Clean,
1010

11-
[Parameter(ParameterSetName="build")]
11+
[Parameter(ParameterSetName = 'build')]
1212
[switch]
1313
$Build,
1414

15-
[Parameter(ParameterSetName="publish")]
15+
[Parameter(ParameterSetName = 'publish')]
1616
[switch]
1717
$Publish,
1818

19-
[Parameter(ParameterSetName="publish")]
19+
[Parameter(ParameterSetName = 'publish')]
2020
[switch]
2121
$Signed,
2222

23-
[ValidateSet("Debug", "Release")]
24-
[string] $BuildConfiguration = "Debug",
23+
[ValidateSet('Debug', 'Release')]
24+
[string] $BuildConfiguration = 'Debug',
2525

26-
[ValidateSet("net472")]
27-
[string] $BuildFramework = "net472"
26+
[ValidateSet('net472')]
27+
[string] $BuildFramework = 'net472'
2828
)
2929

3030
Import-Module -Name "$PSScriptRoot/buildtools.psd1" -Force
@@ -46,11 +46,11 @@ $script:BuildFramework = $BuildFramework
4646

4747
if ($env:TF_BUILD) {
4848
$vstsCommandString = "vso[task.setvariable variable=BUILD_OUTPUT_PATH]$OutDirectory"
49-
Write-Host ("sending " + $vstsCommandString)
49+
Write-Host ('sending ' + $vstsCommandString)
5050
Write-Host "##$vstsCommandString"
5151

5252
$vstsCommandString = "vso[task.setvariable variable=SIGNED_OUTPUT_PATH]$SignedDirectory"
53-
Write-Host ("sending " + $vstsCommandString)
53+
Write-Host ('sending ' + $vstsCommandString)
5454
Write-Host "##$vstsCommandString"
5555
}
5656

@@ -61,33 +61,26 @@ if ($Clean) {
6161
Remove-Item -Path $OutDirectory -Force -Recurse -ErrorAction Stop -Verbose
6262
}
6363

64-
if (Test-Path "${SrcPath}/code/bin")
65-
{
64+
if (Test-Path "${SrcPath}/code/bin") {
6665
Remove-Item -Path "${SrcPath}/code/bin" -Recurse -Force -ErrorAction Stop -Verbose
6766
}
6867

69-
if (Test-Path "${SrcPath}/code/obj")
70-
{
68+
if (Test-Path "${SrcPath}/code/obj") {
7169
Remove-Item -Path "${SrcPath}/code/obj" -Recurse -Force -ErrorAction Stop -Verbose
7270
}
7371
}
7472

75-
if (-not (Test-Path $OutDirectory))
76-
{
73+
if (-not (Test-Path $OutDirectory)) {
7774
$script:OutModule = New-Item -ItemType Directory -Path (Join-Path $OutDirectory $ModuleName)
78-
}
79-
else
80-
{
75+
} else {
8176
$script:OutModule = Join-Path $OutDirectory $ModuleName
8277
}
8378

84-
if ($Build.IsPresent -or $PsCmdlet.ParameterSetName -eq "Build")
85-
{
79+
if ($Build.IsPresent -or $PsCmdlet.ParameterSetName -eq 'Build') {
8680
$sb = (Get-Item Function:DoBuild).ScriptBlock
8781
Invoke-ModuleBuild -BuildScript $sb
8882
}
8983

90-
if ($Publish.IsPresent)
91-
{
84+
if ($Publish.IsPresent) {
9285
Publish-ModulePackage -Signed:$Signed.IsPresent
9386
}

buildtools.psd1

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,28 @@
33

44
@{
55
# Script module or binary module file associated with this manifest.
6-
RootModule = '.\buildtools.psm1'
6+
RootModule = '.\buildtools.psm1'
77

88
# Version number of this module.
9-
ModuleVersion = '1.0.0'
9+
ModuleVersion = '1.0.0'
1010

1111
# Supported PSEditions
1212
CompatiblePSEditions = @('Core')
1313

1414
# ID used to uniquely identify this module
15-
GUID = 'fcdd259e-1163-4da2-8bfa-ce36a839f337'
15+
GUID = 'fcdd259e-1163-4da2-8bfa-ce36a839f337'
1616

1717
# Author of this module
18-
Author = 'Microsoft Corporation'
18+
Author = 'Microsoft Corporation'
1919

2020
# Company or vendor of this module
21-
CompanyName = 'Microsoft Corporation'
21+
CompanyName = 'Microsoft Corporation'
2222

2323
# Copyright statement for this module
24-
Copyright = '(c) Microsoft Corporation. All rights reserved.'
24+
Copyright = '(c) Microsoft Corporation. All rights reserved.'
2525

2626
# Description of the functionality provided by this module
27-
Description = "Build utilties."
27+
Description = 'Build utilties.'
2828

2929
# Modules that must be imported into the global environment prior to importing this module
3030
#RequiredModules = @(
@@ -34,18 +34,18 @@
3434
#)
3535

3636
# Minimum version of the PowerShell engine required by this module
37-
PowerShellVersion = '5.1'
37+
PowerShellVersion = '5.1'
3838

3939
# Cmdlets to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no cmdlets to export.
40-
CmdletsToExport = @()
40+
CmdletsToExport = @()
4141

4242
# Functions to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no functions to export.
43-
FunctionsToExport = @(
43+
FunctionsToExport = @(
4444
'Get-BuildConfiguration', 'Invoke-ModuleBuild', 'Publish-ModulePackage', 'Install-ModulePackageForTest', 'Invoke-ModuleTests', 'Invoke-ModuleTestsACR')
4545

4646
# Variables to export from this module
47-
VariablesToExport = '*'
47+
VariablesToExport = '*'
4848

4949
# Aliases to export from this module, for best performance, do not use wildcards and do not delete the entry, use an empty array if there are no aliases to export.
50-
AliasesToExport = @()
50+
AliasesToExport = @()
5151
}

src/InstallPSResourceGetPolicyDefinitions.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ $ErrorActionPreference = 'Stop'
2222
function Test-Elevated {
2323
[CmdletBinding()]
2424
[OutputType([bool])]
25-
Param()
25+
param()
2626

2727
# if the current Powershell session was called with administrator privileges,
2828
# the Administrator Group's well-known SID will show up in the Groups for the current identity.
2929
# Note that the SID won't show up unless the process is elevated.
30-
return (([Security.Principal.WindowsIdentity]::GetCurrent()).Groups -contains "S-1-5-32-544")
30+
return (([Security.Principal.WindowsIdentity]::GetCurrent()).Groups -contains 'S-1-5-32-544')
3131
}
3232
$IsWindowsOs = $PSHOME.EndsWith('\WindowsPowerShell\v1.0', [System.StringComparison]::OrdinalIgnoreCase) -or $IsWindows
3333

@@ -47,8 +47,8 @@ $admxName = 'PSResourceRepository.admx'
4747
$admlName = 'PSResourceRepository.adml'
4848
$admx = Get-Item -Path (Join-Path -Path $Path -ChildPath $admxName)
4949
$adml = Get-Item -Path (Join-Path -Path $Path -ChildPath $admlName)
50-
$admxTargetPath = Join-Path -Path $env:WINDIR -ChildPath "PolicyDefinitions"
51-
$admlTargetPath = Join-Path -Path $admxTargetPath -ChildPath "en-US"
50+
$admxTargetPath = Join-Path -Path $env:WINDIR -ChildPath 'PolicyDefinitions'
51+
$admlTargetPath = Join-Path -Path $admxTargetPath -ChildPath 'en-US'
5252

5353
$files = @($admx, $adml)
5454
foreach ($file in $files) {

src/Microsoft.PowerShell.PSResourceGet.psm1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ function Import-PSGetRepository {
1818
} else {
1919
$PSGetAppLocalPath = Microsoft.PowerShell.Management\Join-Path -Path ([System.Management.Automation.Platform]::SelectProductNameForDirectory('CACHE')) -ChildPath 'PowerShellGet'
2020
}
21-
$PSRepositoriesFilePath = Microsoft.PowerShell.Management\Join-Path -Path $PSGetAppLocalPath -ChildPath "PSRepositories.xml"
21+
$PSRepositoriesFilePath = Microsoft.PowerShell.Management\Join-Path -Path $PSGetAppLocalPath -ChildPath 'PSRepositories.xml'
2222
$PSGetRepositories = Microsoft.PowerShell.Utility\Import-Clixml $PSRepositoriesFilePath -ea SilentlyContinue
2323

2424
Microsoft.PowerShell.Utility\Write-Verbose ('Found {0} registered PowerShellGet repositories.' -f $PSGetRepositories.Count)
2525

2626
if ($PSGetRepositories.Count) {
2727
$repos = @(
2828
$PSGetRepositories.Values |
29-
Microsoft.PowerShell.Core\Where-Object { $_.PackageManagementProvider -eq 'NuGet' -and $_.Name -ne 'PSGallery' } |
30-
Microsoft.PowerShell.Utility\Select-Object Name, Trusted, SourceLocation
29+
Microsoft.PowerShell.Core\Where-Object { $_.PackageManagementProvider -eq 'NuGet' -and $_.Name -ne 'PSGallery' } |
30+
Microsoft.PowerShell.Utility\Select-Object Name, Trusted, SourceLocation
3131
)
3232

3333
Microsoft.PowerShell.Utility\Write-Verbose ('Selected {0} NuGet repositories.' -f $repos.Count)

0 commit comments

Comments
 (0)