Skip to content
Draft
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
2 changes: 2 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
build --protocopt=--experimental_allow_proto3_optional
build --cxxopt=-std=c++17
build --noenable_bzlmod
2 changes: 1 addition & 1 deletion .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
php-version: '8.2'

- name: Install dependencies
run: |
Expand Down
6 changes: 3 additions & 3 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ switched_rules_by_language(
# gRPC.
http_archive(
name = "com_github_grpc_grpc",
sha256 = "4b64cbc454cc4fd0801a2823111e1d99f519c765dfa116905740f7ca2256d085",
urls = ["https://github.com/grpc/grpc/archive/v1.51.1.zip"],
strip_prefix = "grpc-1.51.1",
sha256 = "c682fc39baefc6e804d735e6b48141157b7213602cc66dbe0bf375b904d8b5f9",
urls = ["https://github.com/grpc/grpc/archive/v1.64.2.tar.gz"],
strip_prefix = "grpc-1.64.2",
)

load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
Expand Down
12 changes: 6 additions & 6 deletions bazel_example/WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "com_google_protobuf",
sha256 = "f7042d540c969b00db92e8e1066a9b8099c8379c33f40f360eb9e1d98a36ca26",
strip_prefix = "protobuf-3.21.12",
urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.21.12.zip"],
sha256 = "e4ff2aeb767da6f4f52485c2e72468960ddfe5262483879ef6ad552e52757a77",
strip_prefix = "protobuf-27.2",
urls = ["https://github.com/protocolbuffers/protobuf/archive/v27.2.tar.gz"],
)

load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
Expand All @@ -27,9 +27,9 @@ protobuf_deps()

http_archive(
name = "com_github_grpc_grpc",
sha256 = "4b64cbc454cc4fd0801a2823111e1d99f519c765dfa116905740f7ca2256d085",
strip_prefix = "grpc-1.51.1",
urls = ["https://github.com/grpc/grpc/archive/v1.51.1.zip"],
sha256 = "c682fc39baefc6e804d735e6b48141157b7213602cc66dbe0bf375b904d8b5f9",
strip_prefix = "grpc-1.64.2",
urls = ["https://github.com/grpc/grpc/archive/v1.64.2.tar.gz"],
)

load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@
}
},
"require": {
"php": "^8.1",
"php": "^8.2",
"google/protobuf": "^4.0",
"friendsofphp/php-cs-fixer": "^3",
"symfony/yaml": "^5.2",
"symplify/coding-standard": "9.4.70",
"microsoft/tolerant-php-parser": "^0.1.2"
"microsoft/tolerant-php-parser": "^0.1.2",
"symplify/coding-standard": "13.0.1"
},
"require-dev": {
"phpunit/phpunit": "^9.5",
Expand All @@ -53,7 +53,7 @@
},
"config": {
"platform": {
"php": "8.1"
"php": "8.2"
}
}
}
10 changes: 4 additions & 6 deletions repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,10 @@ def gapic_generator_php_repositories():
urls = ["https://github.com/googleapis/rules_gapic/archive/v%s.tar.gz" % _rules_gapic_version],
)

_php_version = "8.1.13"
_php_version = "8.2.30"
maybe(
php,
name = "php_micro",
prebuilt_phps = [
"@gapic_generator_php//:rules_php_gapic/resources/php-%s_linux_x86_64.tar.gz" % _php_version,
],
urls = ["https://www.php.net/distributions/php-%s.tar.gz" % _php_version ],
strip_prefix = "php-%s" % _php_version,
)
Expand All @@ -42,12 +39,13 @@ def gapic_generator_php_repositories():
)

# Import Bazel-only dependencies.
_protobuf_version = "3.13.0"
_protobuf_version = "27.2"
maybe(
http_archive,
name = "com_google_protobuf",
urls = ["https://github.com/protocolbuffers/protobuf/archive/v%s.zip" % _protobuf_version],
urls = ["https://github.com/protocolbuffers/protobuf/archive/v%s.tar.gz" % _protobuf_version],
strip_prefix = "protobuf-%s" % _protobuf_version,
sha256 = "e4ff2aeb767da6f4f52485c2e72468960ddfe5262483879ef6ad552e52757a77",
)

maybe(
Expand Down
2 changes: 1 addition & 1 deletion rules_php_gapic/php.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ tar cf - --dereference src/ generated/ googleapis/ tools/ vendor/ composer.json
WD="$(pwd)"
PHP="$WD/$(dirname $0)/{run_name}.runfiles/$(basename $WD)/{php_short_path}"
cd "$(dirname $0)/{run_name}.runfiles/$(basename $WD)/{out_short_path}/install"
"$PHP" -n -d memory_limit=1024M './{entry_point}' {working_directory_flag} $@
"$PHP" -n -d display_errors=stderr -d error_reporting=0 -d memory_limit=1024M './{entry_point}' {working_directory_flag} $@
""".format(
php_short_path = ctx.file.php.short_path,
out_short_path = out_dir.short_path,
Expand Down
12 changes: 6 additions & 6 deletions rules_php_gapic/resources/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ The recommended (tested) way of doing it is as follows:
```
3. Download the specific PHP distribution sources from https://www.php.net/distributions:
```
curl https://www.php.net/distributions/php-8.1.13.tar.gz -o php-8.1.13.tar.gz
curl https://www.php.net/distributions/php-8.2.30.tar.gz -o php-8.2.30.tar.gz
```
4. Unpack the downloaded archive:
```
tar -xzpf php-8.1.13.tar.gz
tar -xzpf php-8.2.30.tar.gz
```
5. Go to the unpacked directory:
```
cd php-8.1.13
cd php-8.2.30
```
6. Run the build config:
```
Expand All @@ -44,9 +44,9 @@ The recommended (tested) way of doing it is as follows:
--disable-mbregex \
--with-openssl \
--enable-bcmath \
--prefix=/tmp/php-8.1.13
--prefix=/tmp/php-8.2.30
```
Please make sure that the `--prefix` destination folder has the same name as the root folder of your unpacked archive (i.e. the one you `cd` in step 3; it is usually `php-<version>`, e.g. `php-8.1.13`).
Please make sure that the `--prefix` destination folder has the same name as the root folder of your unpacked archive (i.e. the one you `cd` in step 3; it is usually `php-<version>`, e.g. `php-8.2.30`).
7. Run the build:
```
make -j10
Expand All @@ -62,7 +62,7 @@ The recommended (tested) way of doing it is as follows:
```
10. Pack the relevant binaries in the archive, using `php-<version>_<platform>.tar.gz` name format:
```
tar -zchpf php-8.1.13_linux_x86_64.tar.gz php-8.1.13/bin php-8.1.13/lib
tar -zchpf php-8.2.30_linux_x86_64.tar.gz php-8.2.30/bin php-8.2.30/lib
```
11. Copy the created archive to the `rules_gapic/php/resources` folder in this repository and post a PR.

Expand Down
2 changes: 1 addition & 1 deletion scripts/run_protoc_plugin.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/bin/bash
# This runs the protoc plugin in a similar way to how it is run using the bazel rules
php src/Main.php
php -d display_errors=stderr -d error_reporting=0 src/Main.php
2 changes: 2 additions & 0 deletions src/Ast/HasPhpDoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

trait HasPhpDoc
{
private $phpDoc;

/**
* Create a version of this ast element with PHP doc.
*
Expand Down
4 changes: 3 additions & 1 deletion src/Utils/Formatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,9 @@ private static function buildLineLengthFixer(int $lineLength)
)
),
$blockFinder,
new TokenAnalyzer\FunctionCallNameMatcher()
new TokenAnalyzer\FunctionCallNameMatcher(),
new TokenAnalyzer\Naming\MethodNameResolver(),
new TokenAnalyzer\HeredocAnalyzer(),
);

$fixer->configure([
Expand Down
Loading