Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*.php diff=php

* export-ignore
/protoc-gen-php -export-ignore
/src/ -export-ignore
/src/** -export-ignore
/CHANGELOG.md -export-ignore
Expand Down
1 change: 0 additions & 1 deletion .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
->setFinder(
Finder::create()
->in(__DIR__ . '/src')
->in(__DIR__ . '/bin')
->in(__DIR__ . '/tests')
->exclude(['snapshots'])
->append([
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ check: fixer-check rector-check composer-validate composer-normalize-check deps-
.PHONY: check

executable:
chmod +x bin/compiler.php
chmod +x protoc-gen-php

generate: executable
rm -rf compiled/*
protoc -I./protos --plugin=protoc-gen-php-plugin=./bin/compiler.php ./protos/*.proto --php-plugin_out=compiled
protoc -I./protos --plugin=protoc-gen-php-plugin=./protoc-gen-php ./protos/*.proto --php-plugin_out=compiled
.PHONY: generate

# -----------------------
Expand Down
6 changes: 4 additions & 2 deletions box.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
{
"chmod": "0755",
"directories": [
"bin",
"src",
"vendor"
],
"main": "bin/compiler.php",
"files": [
"protoc-gen-php"
],
"main": "protoc-gen-php",
"output": "protoc-gen-php",
"shebang": "#!/usr/bin/env php"
}
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"php": "^8.4",
"ext-bcmath": "*",
"ext-filter": "*",
"composer-runtime-api": "^2.2",
"nette/php-generator": "^4.2.1",
"thesis/package-version": "^0.1.2",
"thesis/protobuf": "^0.2",
Expand All @@ -43,7 +44,7 @@
}
},
"bin": [
"bin/compiler.php"
"protoc-gen-php"
],
"config": {
"lock": false,
Expand Down
1 change: 0 additions & 1 deletion phpstan.dist.neon
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ parameters:
level: max
paths:
- src
- bin
- tests
excludePaths:
- tests/snapshots
Expand Down
2 changes: 1 addition & 1 deletion bin/compiler.php → protoc-gen-php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

declare(strict_types=1);

require_once __DIR__ . '/../vendor/autoload.php';
require_once $_composer_autoload_path ?? __DIR__ . '/vendor/autoload.php';

if (is_string($configuredMemoryLimit = getenv('THESIS_PLUGIN_MEMORY_LIMIT'))) {
@ini_set('memory_limit', $configuredMemoryLimit);
Expand Down
2 changes: 1 addition & 1 deletion tests/CompilerMemoryLimitTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public function testCompilerRaisesDefaultMemoryLimitTo512M(): void
private static function runCompilerScript(string $initialMemoryLimit, ?string $envMemoryLimit = null): string
{
$code = <<<'PHP'
require 'bin/compiler.php';
require 'protoc-gen-php';
fwrite(STDERR, "\nMEMORY_LIMIT=" . ini_get('memory_limit') . "\n");
PHP;

Expand Down
2 changes: 1 addition & 1 deletion tests/tools/generate-snapshots.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -euo pipefail

FIXTURES_ROOT="tests/fixtures"
SNAPSHOTS_ROOT="tests/snapshots"
PLUGIN="$(realpath "$(pwd)/bin/compiler.php")"
PLUGIN="$(realpath "$(pwd)/protoc-gen-php")"

if [[ ! -x "$PLUGIN" ]]; then
echo "Plugin not executable: $PLUGIN" >&2
Expand Down