From e57ea715eb7d9234ceaec1e7df12b539480fa876 Mon Sep 17 00:00:00 2001 From: Shivam Mathur Date: Wed, 20 Jul 2022 19:20:56 +0530 Subject: [PATCH] Fix scoped tool setup on Windows --- src/scripts/tools/add_tools.ps1 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/scripts/tools/add_tools.ps1 b/src/scripts/tools/add_tools.ps1 index cfe900717..62cc38a6b 100644 --- a/src/scripts/tools/add_tools.ps1 +++ b/src/scripts/tools/add_tools.ps1 @@ -215,11 +215,12 @@ Function Add-ComposertoolHelper() { $scoped_dir_suffix = (Get-FileHash -InputStream $release_stream -Algorithm sha256).Hash $scoped_dir = "$composer_bin\_tools\$tool-$scoped_dir_suffix" $unix_scoped_dir = $scoped_dir.replace('\', '/') - if((composer show $prefix$tool -d $unix_scoped_dir -a 2>&1 | findstr '^type *: *composer-plugin') -and ($composer_args -ne '')) { - composer config -d $unix_scoped_dir --no-plugins allow-plugins."$prefix$release" true >$null 2>&1 - } if(-not(Test-Path $scoped_dir)) { New-Item -ItemType Directory -Force -Path $scoped_dir > $null 2>&1 + Set-Content -Path $scoped_dir\composer.json -Value "{}" + if((composer show $prefix$tool $tool_version -d $unix_scoped_dir -a 2>&1 | findstr '^type *: *composer-plugin') -and ($composer_args -ne '')) { + composer config -d $unix_scoped_dir --no-plugins allow-plugins."$prefix$tool" true >$null 2>&1 + } composer require $prefix$release -d $unix_scoped_dir $composer_args >$null 2>&1 } [System.Environment]::SetEnvironmentVariable(($tool.replace('-', '_') + '_bin'), "$scoped_dir\vendor\bin")