Skip to content

Commit

Permalink
Add "symlink" option for "bin-compat" config (#9959)
Browse files Browse the repository at this point in the history
  • Loading branch information
blankse committed Jun 9, 2021
1 parent 7157097 commit a9031e4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
7 changes: 4 additions & 3 deletions doc/06-config.md
Expand Up @@ -253,11 +253,12 @@ Defaults to `false`. Whether to use the Composer cache in read-only mode.
## bin-compat

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
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
in the Windows host OS.
run Composer inside a linux VM but still want the `.bat` proxies available for use
in the Windows host OS. If set to `symlink` Composer will always symlink even on
Windows/WSL.

## prepend-autoloader

Expand Down
4 changes: 2 additions & 2 deletions res/composer-schema.json
Expand Up @@ -251,8 +251,8 @@
"description": "Whether to use the Composer cache in read-only mode."
},
"bin-compat": {
"enum": ["auto", "full"],
"description": "The compatibility of the binaries, defaults to \"auto\" (automatically guessed) and can be \"full\" (compatible with both Windows and Unix-based systems)."
"enum": ["auto", "full", "symlink"],
"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": {
"type": ["string", "boolean"],
Expand Down
2 changes: 1 addition & 1 deletion src/Composer/Command/ConfigCommand.php
Expand Up @@ -390,7 +390,7 @@ function ($val) {
),
'bin-compat' => array(
function ($val) {
return in_array($val, array('auto', 'full'));
return in_array($val, array('auto', 'full', 'symlink'));
},
function ($val) {
return $val;
Expand Down
2 changes: 2 additions & 0 deletions src/Composer/Installer/BinaryInstaller.php
Expand Up @@ -92,6 +92,8 @@ public function installBinaries(PackageInterface $package, $installPath, $warnOn
}
} elseif ($this->binCompat === "full") {
$this->installFullBinaries($binPath, $link, $bin, $package);
} elseif ($this->binCompat === "symlink") {
$this->installSymlinkBinaries($binPath, $link);
}
Silencer::call('chmod', $link, 0777 & ~umask());
}
Expand Down

0 comments on commit a9031e4

Please sign in to comment.