1
0
Fork 0

Add "symlink" option for "bin-compat" config (#9959)

pull/9960/head
Sebastian Blank 2021-06-09 11:33:44 +02:00 committed by GitHub
parent 7157097ea0
commit a9031e40eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 6 deletions

View File

@ -253,11 +253,12 @@ Defaults to `false`. Whether to use the Composer cache in read-only mode.
## bin-compat ## bin-compat
Defaults to `auto`. Determines the compatibility of the binaries to be installed. Defaults to `auto`. Determines the compatibility of the binaries to be installed.
If it is `auto` then Composer only installs .bat proxy files when on Windows. If If it is `auto` then Composer only installs .bat proxy files when on Windows or WSL. If
set to `full` then both .bat files for Windows and scripts for Unix-based set to `full` then both .bat files for Windows and scripts for Unix-based
operating systems will be installed for each binary. This is mainly useful if you operating systems will be installed for each binary. This is mainly useful if you
run Composer inside a linux VM but still want the .bat proxies available for use run Composer inside a linux VM but still want the `.bat` proxies available for use
in the Windows host OS. in the Windows host OS. If set to `symlink` Composer will always symlink even on
Windows/WSL.
## prepend-autoloader ## prepend-autoloader

View File

@ -251,8 +251,8 @@
"description": "Whether to use the Composer cache in read-only mode." "description": "Whether to use the Composer cache in read-only mode."
}, },
"bin-compat": { "bin-compat": {
"enum": ["auto", "full"], "enum": ["auto", "full", "symlink"],
"description": "The compatibility of the binaries, defaults to \"auto\" (automatically guessed) and can be \"full\" (compatible with both Windows and Unix-based systems)." "description": "The compatibility of the binaries, defaults to \"auto\" (automatically guessed), can be \"full\" (compatible with both Windows and Unix-based systems) and \"symlink\" (symlink also for WSL)."
}, },
"discard-changes": { "discard-changes": {
"type": ["string", "boolean"], "type": ["string", "boolean"],

View File

@ -390,7 +390,7 @@ EOT
), ),
'bin-compat' => array( 'bin-compat' => array(
function ($val) { function ($val) {
return in_array($val, array('auto', 'full')); return in_array($val, array('auto', 'full', 'symlink'));
}, },
function ($val) { function ($val) {
return $val; return $val;

View File

@ -92,6 +92,8 @@ class BinaryInstaller
} }
} elseif ($this->binCompat === "full") { } elseif ($this->binCompat === "full") {
$this->installFullBinaries($binPath, $link, $bin, $package); $this->installFullBinaries($binPath, $link, $bin, $package);
} elseif ($this->binCompat === "symlink") {
$this->installSymlinkBinaries($binPath, $link);
} }
Silencer::call('chmod', $link, 0777 & ~umask()); Silencer::call('chmod', $link, 0777 & ~umask());
} }