File: README.md

package info (click to toggle)
firefox 145.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,653,528 kB
  • sloc: cpp: 7,594,999; javascript: 6,459,658; ansic: 3,752,909; python: 1,403,455; xml: 629,809; asm: 438,679; java: 186,421; sh: 67,287; makefile: 19,169; objc: 13,086; perl: 12,982; yacc: 4,583; cs: 3,846; pascal: 3,448; lex: 1,720; ruby: 1,003; exp: 762; php: 436; lisp: 258; awk: 247; sql: 66; sed: 54; csh: 10
file content (73 lines) | stat: -rw-r--r-- 2,768 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# Protobuf vendoring and generated code

Protocol Buffers (protobuf) source is available at:

    https://github.com/protocolbuffers/protobuf

This code is covered under the BSD license (see LICENSE). Documentation is
available at https://developers.google.com/protocol-buffers/.

The tree's current version of the protobuf library is 21.6.

We do not include the protobuf tests or the protoc compiler.

--------------------------------------------------------------------------------

## Upgrading the protobuf library

**WARNING:** The vendoring process may download and execute untrusted code from
the protobuf repository. Only vendor releases from trusted sources and review
the vendored content carefully.

1. Decide the protobuf release version you want to vendor (for example, `v21.6`).

2. From the Gecko top source directory, use the standard moz.yaml vendoring workflow
   to re-vendor protobuf. Options are documented in `toolkit/components/protobuf/moz.yaml`.
   See also the Firefox build docs for common vendoring operations: [Common vendoring operations]
   (https://firefox-source-docs.mozilla.org/mozbuild/vendor/index.html#common-vendoring-operations)

   Run:

```bash
mach vendor toolkit/components/protobuf/moz.yaml -r v21.6 --patch-mode none
```

   and then apply local patches:

```bash
mach vendor toolkit/components/protobuf/moz.yaml --patch-mode only
```

   Where `-r v21.6` specifies the protobuf version.

   Vendoring automatically regenerates all `.pb.cc` and `.pb.h` files specified
   in `scripts/regenerate_cpp_files.py`.

3. Update the moz.build to export the new set of headers and add any new .cc
   files to the unified sources and remove old ones. Note that we only
   need:
   - files contained in the `libprotobuf_lite_srcs` target
     ([file_lists.cmake](https://github.com/protocolbuffers/protobuf/blob/main/src/file_lists.cmake))
   - the header files they need
   - gzip streams (for devtools)

## Adding or updating generated C++ files

When a `.proto` source file is added, moved, or otherwise changed, update
`scripts/generate_files.py` so the generated C++ files are produced in the
correct location with the right include paths.

1. Edit `scripts/generate_files.py` and add or adjust a `run_protoc(...)`
   entry for the affected `.proto` file(s). Set `cpp_out` to the directory
   where the generated files should live, and `includes` to directories that
   contain the `.proto` sources (paths are relative to the top source dir).

2. Regenerate the files using:

```bash
   mach python toolkit/components/protobuf/scripts/generate_files.py
```

3. If new generated files appear in a directory that is not already listing
   them, update the corresponding `moz.build` in that directory to include
   the new files.