2023-05-04 15:23:23 +02:00
|
|
|
{
|
|
|
|
pkgs ? import <nixpkgs> { }
|
|
|
|
,phps ? import <phps>
|
|
|
|
}:
|
2023-04-03 08:41:22 +02:00
|
|
|
|
|
|
|
let
|
2023-05-04 15:23:23 +02:00
|
|
|
php = phps.packages.x86_64-linux.php82.buildEnv {
|
|
|
|
extensions = { enabled, all }: enabled ++ (with all; [
|
|
|
|
xdebug
|
|
|
|
]);
|
|
|
|
extraConfig = ''
|
|
|
|
xdebug.mode = debug
|
|
|
|
memory_limit = 4G
|
|
|
|
'';
|
|
|
|
};
|
2023-06-07 08:56:42 +02:00
|
|
|
inherit(php.packages) composer;
|
2023-04-03 08:41:22 +02:00
|
|
|
|
|
|
|
projectInstall = pkgs.writeShellApplication {
|
|
|
|
name = "project-install";
|
|
|
|
runtimeInputs = [
|
|
|
|
php
|
|
|
|
composer
|
|
|
|
];
|
|
|
|
text = ''
|
|
|
|
rm -rf vendor/ composer.lock .Build/
|
2023-05-04 15:23:23 +02:00
|
|
|
composer update --prefer-dist --no-progress --working-dir="$PROJECT_ROOT"
|
2023-04-03 08:41:22 +02:00
|
|
|
'';
|
|
|
|
};
|
2023-05-04 15:23:23 +02:00
|
|
|
|
2023-04-03 08:41:22 +02:00
|
|
|
projectValidateComposer = pkgs.writeShellApplication {
|
|
|
|
name = "project-validate-composer";
|
|
|
|
runtimeInputs = [
|
|
|
|
php
|
|
|
|
composer
|
|
|
|
];
|
|
|
|
text = ''
|
|
|
|
composer validate
|
|
|
|
'';
|
|
|
|
};
|
2023-05-04 15:23:23 +02:00
|
|
|
|
2023-04-03 08:41:22 +02:00
|
|
|
projectValidateXml = pkgs.writeShellApplication {
|
|
|
|
name = "project-validate-xml";
|
|
|
|
runtimeInputs = [
|
|
|
|
pkgs.libxml2
|
|
|
|
pkgs.wget
|
|
|
|
projectInstall
|
|
|
|
];
|
|
|
|
text = ''
|
|
|
|
project-install
|
|
|
|
xmllint --schema vendor/phpunit/phpunit/phpunit.xsd --noout phpunit.xml.dist
|
|
|
|
wget --no-check-certificate https://docs.oasis-open.org/xliff/v1.2/os/xliff-core-1.2-strict.xsd --output-document=xliff-core-1.2-strict.xsd
|
|
|
|
# shellcheck disable=SC2046
|
|
|
|
xmllint --schema xliff-core-1.2-strict.xsd --noout $(find Resources -name '*.xlf')
|
|
|
|
'';
|
|
|
|
};
|
2023-05-04 15:23:23 +02:00
|
|
|
|
|
|
|
projectPhpstan = pkgs.writeShellApplication {
|
|
|
|
name = "project-phpstan";
|
|
|
|
|
2023-04-03 08:41:22 +02:00
|
|
|
runtimeInputs = [
|
|
|
|
php
|
|
|
|
];
|
2023-05-04 15:23:23 +02:00
|
|
|
|
|
|
|
text = ''
|
|
|
|
./vendor/bin/phpstan
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
projectCgl = pkgs.writeShellApplication {
|
|
|
|
name = "project-cgl";
|
|
|
|
|
|
|
|
runtimeInputs = [
|
|
|
|
php
|
|
|
|
];
|
|
|
|
|
2023-04-03 08:41:22 +02:00
|
|
|
text = ''
|
2023-06-07 08:56:42 +02:00
|
|
|
PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --dry-run --diff
|
2023-04-03 08:41:22 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-05-04 15:23:23 +02:00
|
|
|
projectCglFix = pkgs.writeShellApplication {
|
|
|
|
name = "project-cgl-fix";
|
|
|
|
|
|
|
|
runtimeInputs = [
|
|
|
|
php
|
|
|
|
];
|
|
|
|
|
|
|
|
text = ''
|
2023-06-07 08:56:42 +02:00
|
|
|
PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix
|
2023-05-04 15:23:23 +02:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
projectTestsUnit = pkgs.writeShellApplication {
|
|
|
|
name = "project-tests-unit";
|
|
|
|
|
|
|
|
runtimeInputs = [
|
|
|
|
php
|
|
|
|
];
|
|
|
|
|
|
|
|
text = ''
|
|
|
|
./vendor/bin/phpunit --testsuite unit --color --testdox
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
projectTestsFunctional = pkgs.writeShellApplication {
|
|
|
|
name = "project-tests-functional";
|
|
|
|
|
|
|
|
runtimeInputs = [
|
|
|
|
php
|
|
|
|
];
|
|
|
|
|
|
|
|
text = ''
|
|
|
|
./vendor/bin/phpunit --testsuite functional --color --testdox
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
2023-04-03 08:41:22 +02:00
|
|
|
in pkgs.mkShell {
|
|
|
|
name = "TYPO3 Extension Watchlist";
|
|
|
|
buildInputs = [
|
|
|
|
projectInstall
|
|
|
|
projectValidateComposer
|
|
|
|
projectValidateXml
|
2023-05-04 15:23:23 +02:00
|
|
|
projectPhpstan
|
|
|
|
projectCgl
|
|
|
|
projectCglFix
|
|
|
|
projectTestsUnit
|
|
|
|
projectTestsFunctional
|
2023-04-03 08:41:22 +02:00
|
|
|
php
|
|
|
|
composer
|
|
|
|
];
|
|
|
|
|
|
|
|
shellHook = ''
|
|
|
|
export PROJECT_ROOT="$(pwd)"
|
|
|
|
|
|
|
|
export typo3DatabaseDriver=pdo_sqlite
|
|
|
|
'';
|
|
|
|
}
|