-
Notifications
You must be signed in to change notification settings - Fork 50
Prompt to install build tools if they're missing #452
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
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
d826187
434: added initial implementation of build tool checker
asgrim 90b164d
434: define more build tools in checker and deduplicate
asgrim 4a85df4
Allow build tool package name to be null
asgrim ae10e7f
434: improved messaging and flow for prompts
asgrim 88068ee
434: add build tools check for build and install commands
asgrim 5b33c98
434: add --auto-install-build-tools and --no-build-tools-check flags …
asgrim d061382
434: ensure warning is not emitted when package manager does not have…
asgrim 772a35e
434: add phpize install
asgrim b08066a
434: add test for CheckAllBuildTools
asgrim e369a29
434: add more test cases for build tool checkers
asgrim e1f3f4d
434: check if we can install with sudo or gracefully fail on error in…
asgrim e0fab35
434: added yum/dnf support for PackageManager
asgrim 81d8f98
434: ensure phpize is thoroughly checked on dnf/yum systems due to pl…
asgrim 69b5290
434: added a set of Dockerfile-based end-to-end tests to check build …
asgrim 82b1ec2
434: run Dockerfile e2e test in CI
asgrim d6a2892
434: add brew support for build tool checker
asgrim 1a15aa0
434: don't check for build tools on Windows at all
asgrim 60236eb
434: define a virtual package for Alpine
asgrim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| <?php | ||
|
|
||
| declare(strict_types=1); | ||
|
|
||
| namespace Php\Pie\SelfManage\BuildTools; | ||
|
|
||
| use Php\Pie\Platform\TargetPlatform; | ||
| use Symfony\Component\Process\ExecutableFinder; | ||
|
|
||
| use function array_key_exists; | ||
| use function str_replace; | ||
|
|
||
| /** @internal This is not public API for PIE, so should not be depended upon unless you accept the risk of BC breaks */ | ||
| class BinaryBuildToolFinder | ||
| { | ||
| /** @param array<PackageManager::*, non-empty-string|null> $packageManagerPackages */ | ||
| public function __construct( | ||
| public readonly string $tool, | ||
| private readonly array $packageManagerPackages, | ||
| ) { | ||
| } | ||
|
|
||
| public function check(): bool | ||
| { | ||
| return (new ExecutableFinder())->find($this->tool) !== null; | ||
| } | ||
|
|
||
| /** @return non-empty-string|null */ | ||
| public function packageNameFor(PackageManager $packageManager, TargetPlatform $targetPlatform): string|null | ||
| { | ||
| if (! array_key_exists($packageManager->value, $this->packageManagerPackages) || $this->packageManagerPackages[$packageManager->value] === null) { | ||
| return null; | ||
| } | ||
|
|
||
| // If we need to customise specific package names depending on OS | ||
| // specific parameters, this is likely the place to do it | ||
| return str_replace( | ||
| '{major}', | ||
| (string) $targetPlatform->phpBinaryPath->majorVersion(), | ||
| str_replace( | ||
| '{minor}', | ||
| (string) $targetPlatform->phpBinaryPath->minorVersion(), | ||
| $this->packageManagerPackages[$packageManager->value], | ||
| ), | ||
| ); | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.