Skip to content

Remove redundant 'dotnet restore' tasks in build because .Net Core 2 handles it automatically #899

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,6 @@ function Get-BuildTaskParams($project) {
$taskParams
}

function Get-RestoreTaskParams($project) {
@{
Inputs = "$BuildRoot/$project/$project.csproj"
Outputs = "$BuildRoot/$project/$project.csproj"
Jobs = {dotnet restore}
}
}

function Get-CleanTaskParams($project) {
@{
Jobs = {
Expand Down Expand Up @@ -122,13 +114,11 @@ popd
$projects = @("engine", "rules")
$projects | ForEach-Object {
Add-ProjectTask $_ build (Get-BuildTaskParams $_)
Add-ProjectTask $_ restore (Get-RestoreTaskParams $_)
Add-ProjectTask $_ clean (Get-CleanTaskParams $_)
Add-ProjectTask $_ test (Get-TestTaskParam $_) "$BuildRoot/tests"
}

task build "engine/build", "rules/build"
task restore "engine/restore", "rules/restore"
task clean "engine/clean", "rules/clean"
task test "engine/test", "rules/test"

Expand Down
30 changes: 0 additions & 30 deletions buildCoreClr.ps1
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
param(
# Automatically performs a 'dotnet restore' when being run the first time
[switch]$Build,
# Restore Projects in case NuGet packages have changed
[switch]$Restore,
[switch]$Uninstall,
[switch]$Install,

Expand All @@ -18,19 +15,6 @@ if ($Configuration -match "PSv3" -and $Framework -eq "netstandard1.6")
throw ("{0} configuration is not applicable to {1} framework" -f $Configuration,$Framework)
}

Function Test-DotNetRestore
{
param(
[string] $projectPath
)
Test-Path ([System.IO.Path]::Combine($projectPath, 'obj', 'project.assets.json'))
}

function Invoke-RestoreSolution
{
dotnet restore (Join-Path $PSScriptRoot .\PSScriptAnalyzer.sln)
}

Write-Progress "Building ScriptAnalyzer"
$solutionDir = Split-Path $MyInvocation.InvocationName
if (-not (Test-Path "$solutionDir/global.json"))
Expand All @@ -56,28 +40,14 @@ elseif ($Configuration -match 'PSv3') {
$destinationDirBinaries = "$destinationDir\PSv3"
}

if ($Restore.IsPresent)
{
Invoke-RestoreSolution
}

if ($build)
{

Write-Progress "Building Engine"
if (-not (Test-DotNetRestore((Join-Path $solutionDir Engine))))
{
Invoke-RestoreSolution
}
Push-Location Engine\
dotnet build Engine.csproj --framework $Framework --configuration $Configuration
Pop-Location


if (-not (Test-DotNetRestore((Join-Path $solutionDir Rules))))
{
Invoke-RestoreSolution
}
Write-Progress "Building for framework $Framework, configuration $Configuration"
Push-Location Rules\
dotnet build Rules.csproj --framework $Framework --configuration $Configuration
Expand Down