xref: /aosp_15_r20/external/pigweed/third_party/re2/docs.rst (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1*61c4878aSAndroid Build Coastguard Worker.. _module-pw_third_party_re2:
2*61c4878aSAndroid Build Coastguard Worker
3*61c4878aSAndroid Build Coastguard Worker===
4*61c4878aSAndroid Build Coastguard WorkerRE2
5*61c4878aSAndroid Build Coastguard Worker===
6*61c4878aSAndroid Build Coastguard WorkerThe ``$dir_pw_third_party/re2/`` module provides build files to allow
7*61c4878aSAndroid Build Coastguard Workeroptionally including upstream RE2.
8*61c4878aSAndroid Build Coastguard Worker
9*61c4878aSAndroid Build Coastguard Worker.. _module-pw_third_party_re2-using_upstream:
10*61c4878aSAndroid Build Coastguard Worker
11*61c4878aSAndroid Build Coastguard Worker------------------
12*61c4878aSAndroid Build Coastguard WorkerUsing upstream RE2
13*61c4878aSAndroid Build Coastguard Worker------------------
14*61c4878aSAndroid Build Coastguard WorkerIf you want to use RE2, you must do the following:
15*61c4878aSAndroid Build Coastguard Worker
16*61c4878aSAndroid Build Coastguard WorkerSubmodule
17*61c4878aSAndroid Build Coastguard Worker=========
18*61c4878aSAndroid Build Coastguard WorkerAdd RE2 to your workspace with the following command.
19*61c4878aSAndroid Build Coastguard Worker
20*61c4878aSAndroid Build Coastguard Worker.. code-block:: sh
21*61c4878aSAndroid Build Coastguard Worker
22*61c4878aSAndroid Build Coastguard Worker   git submodule add https://github.com/google/re2.git \
23*61c4878aSAndroid Build Coastguard Worker     third_party/re2/src
24*61c4878aSAndroid Build Coastguard Worker
25*61c4878aSAndroid Build Coastguard WorkerGN
26*61c4878aSAndroid Build Coastguard Worker==
27*61c4878aSAndroid Build Coastguard Worker* Set the GN var ``dir_pw_third_party_re2`` to the location of the
28*61c4878aSAndroid Build Coastguard Worker  RE2 source.
29*61c4878aSAndroid Build Coastguard Worker
30*61c4878aSAndroid Build Coastguard Worker  If you used the command above, this will be
31*61c4878aSAndroid Build Coastguard Worker  ``//third_party/re2/src``
32*61c4878aSAndroid Build Coastguard Worker
33*61c4878aSAndroid Build Coastguard Worker  This can be set in your args.gn or .gn file like:
34*61c4878aSAndroid Build Coastguard Worker  ``dir_pw_third_party_re2 = "//third_party/re2/src"``
35*61c4878aSAndroid Build Coastguard Worker
36*61c4878aSAndroid Build Coastguard WorkerUpdating
37*61c4878aSAndroid Build Coastguard Worker========
38*61c4878aSAndroid Build Coastguard WorkerThe GN build files are generated from the third-party Bazel build files using
39*61c4878aSAndroid Build Coastguard Worker$dir_pw_build/py/pw_build/generate_3p_gn.py.
40*61c4878aSAndroid Build Coastguard Worker
41*61c4878aSAndroid Build Coastguard WorkerThe script uses data taken from ``$dir_pw_third_party/re2/repo.json``.
42*61c4878aSAndroid Build Coastguard Worker
43*61c4878aSAndroid Build Coastguard WorkerThe script should be re-run whenever the submodule is updated or the JSON file
44*61c4878aSAndroid Build Coastguard Workeris modified. Specify the location of the Bazel repository can be specified using
45*61c4878aSAndroid Build Coastguard Workerthe ``-w`` option, e.g.
46*61c4878aSAndroid Build Coastguard Worker
47*61c4878aSAndroid Build Coastguard Worker.. code-block:: sh
48*61c4878aSAndroid Build Coastguard Worker
49*61c4878aSAndroid Build Coastguard Worker   python pw_build/py/pw_build/generate_3p_gn.py \
50*61c4878aSAndroid Build Coastguard Worker     -w third_party/re2/src
51*61c4878aSAndroid Build Coastguard Worker
52*61c4878aSAndroid Build Coastguard WorkerVersion
53*61c4878aSAndroid Build Coastguard Worker=======
54*61c4878aSAndroid Build Coastguard WorkerThe update script was last run for revision `c9cba76`_.
55*61c4878aSAndroid Build Coastguard Worker
56*61c4878aSAndroid Build Coastguard Worker.. _c9cba76: https://github.com/google/re2/tree/c9cba76063cf4235c1a15dd14a24a4ef8d623761
57