Skip to content
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

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

Merged
merged 3 commits into from Jun 9, 2021
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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