Skip to content

Commit 0df982a

Browse files
authored
Remove dotnet format (#16)
1 parent 7a8752c commit 0df982a

File tree

3 files changed

+2
-59
lines changed

3 files changed

+2
-59
lines changed

build.ps1

+2-5
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,14 @@ param (
77

88
$RepoName = "NuGet.Test.Helpers"
99
$RepoRoot = $PSScriptRoot
10-
pushd $RepoRoot
10+
Push-Location $RepoRoot
1111

1212
# Load common build script helper methods
1313
. "$PSScriptRoot\build\common\common.ps1"
1414

1515
# Download tools
1616
Install-CommonBuildTools $RepoRoot
1717

18-
# Run dotnet-format to apply style fixes or fail on CI builds
19-
Invoke-DotnetFormat $RepoRoot
20-
2118
# Clean and write git info
2219
Remove-Artifacts $RepoRoot
2320
Invoke-DotnetMSBuild $RepoRoot ("build\build.proj", "/t:Clean;WriteGitInfo", "/p:Configuration=$Configuration")
@@ -41,5 +38,5 @@ if (-not $SkipTests)
4138
# Run build.proj
4239
Invoke-DotnetMSBuild $RepoRoot ("build\build.proj", "/t:$buildTargets", "/p:Configuration=$Configuration")
4340

44-
popd
41+
Pop-Location
4542
Write-Host "Success!"

build/common/common.ps1

-42
Original file line numberDiff line numberDiff line change
@@ -126,53 +126,11 @@ Function Invoke-DotnetMSBuild {
126126
Invoke-DotnetExe $RepoRoot $buildArgs
127127
}
128128

129-
Function Install-DotnetTools {
130-
param(
131-
[string]$RepoRoot
132-
)
133-
134-
$toolsPath = Join-Path $RepoRoot ".nuget/tools"
135-
136-
if (-not (Test-Path $toolsPath)) {
137-
Write-Host "Installing dotnet tools to $toolsPath"
138-
$args = @("tool","install","--tool-path",$toolsPath,"--ignore-failed-sources","dotnet-format","--version","5.1.250801")
139-
140-
Invoke-DotnetExe $RepoRoot $args
141-
}
142-
}
143-
144129
Function Install-CommonBuildTools {
145130
param(
146131
[string]$RepoRoot
147132
)
148133

149134
Install-DotnetCLI $RepoRoot
150135
Install-NuGetExe $RepoRoot
151-
Install-DotnetTools $RepoRoot
152-
}
153-
154-
Function Invoke-DotnetFormat {
155-
param(
156-
[string]$RepoRoot
157-
)
158-
159-
# Only run in local dev envs
160-
if ($env:CI -ne "True")
161-
{
162-
$formatExe = Join-Path $RepoRoot ".nuget/tools/dotnet-format.exe"
163-
164-
$args = @("--fix-whitespace", "--fix-style", "warn")
165-
166-
$command = "$formatExe $args"
167-
Write-Host "[EXEC] $command" -ForegroundColor Cyan
168-
169-
& $formatExe $args
170-
171-
if (-not $?) {
172-
Write-Warning "dotnet-format failed. Please fix the style errors!"
173-
174-
# Currently dotnet-format fails on CIs but not locally in some scenarios
175-
# exit 1
176-
}
177-
}
178136
}

build/common/common.sh

-12
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ run_standard_tests()
77
# Download dotnet cli
88
REPO_ROOT=$(pwd)
99
DOTNET=$(pwd)/.cli/dotnet
10-
DOTNET_TOOLS=$(pwd)/.nuget/tools
11-
DOTNET_FORMAT=$DOTNET_TOOLS/dotnet-format
1210

1311
if [ ! -f $DOTNET ]; then
1412
echo "Installing dotnet"
@@ -24,16 +22,6 @@ run_standard_tests()
2422
# Display info
2523
$DOTNET --info
2624

27-
# install dotnet-format
28-
if [ ! -d $DOTNET_TOOLS ]; then
29-
echo "Installing dotnet tools"
30-
mkdir -p .nuget/tools
31-
32-
$DOTNET tool install --tool-path $DOTNET_TOOLS --ignore-failed-sources dotnet-format --version 5.1.250801
33-
fi
34-
35-
$DOTNET_FORMAT --fix-whitespace --fix-style warn
36-
3725
# clean
3826
rm -r -f $(pwd)/artifacts
3927

0 commit comments

Comments
 (0)