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

Update protobuf to 5.28 #12

Merged
merged 1 commit into from
Sep 25, 2024
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
14 changes: 8 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ repos:
language: system
types_or: [python, pyi]
require_serial: true
exclude: | # exclude required because --all-files passes py and pyi
(?x)^(
docs/.*|
tests/.*|
firebase_messaging/proto/.*py$
)$
# exclude required because --all-files passes py and pyi
# should match pattern in pyproject.toml
exclude: |
(?x)(
^docs/.*|
^tests/.*|
^firebase_messaging/proto/.*py$
)
40 changes: 40 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,46 @@
* [gitchub_changelog_generator](https://github.com/github-changelog-generator)
* [github access token](https://github.com/github-changelog-generator/github-changelog-generator#github-token)

## Updating protobuf version

Skip this part under normal circumstances.
Only required if protobuf minimum depencey is updated.

### Update protobuf version

```bash
export PROTOBUF_VERSION=x.x.0
uv add "protobuf>$PROTOBUF_VERSION"
uv add --dev "types-protobuf>$PROTOBUF_VERSION"
```

### Download and unzip latest protoc compiler

Replace download url with correct version/platform

```bash
cd /var/tmp
wget https://github.com/protocolbuffers/protobuf/releases/download/v28.0/protoc-28.0-linux-x86_64.zip
unzip protoc-28.0-linux-x86_64.zip
sudo cp bin/protoc /usr/local/bin/
cd <project-dir>
protoc --version # check version as expected
```

### Update generated python files

```bash
export PROTO_DIR="firebase_messaging/proto"
protoc --proto_path=$PROTO_DIR --python_out=$PROTO_DIR $PROTO_DIR/android_checkin.proto $PROTO_DIR/checkin.proto $PROTO_DIR/mcs.proto
protoc --proto_path=$PROTO_DIR --pyi_out=$PROTO_DIR $PROTO_DIR/android_checkin.proto $PROTO_DIR/checkin.proto $PROTO_DIR/mcs.proto
```

### Fix relative import

`protoc` doesn't do relative imports https://github.com/protocolbuffers/protobuf/issues/1491

In `checkin_pb2.py` and `checkin_pb2.pyi` put `from . ` in front of `import android_checkin_pb2 ...`

## Export changelog token

```bash
Expand Down
47 changes: 28 additions & 19 deletions firebase_messaging/proto/android_checkin_pb2.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading