-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This CL adds the files needed to build RE2. These files were generated by `//pw_build/py/pw_build/generate_3p_gn.py`. Change-Id: I9dd2691bdbb593fb74922bdeae59eb04454dc472 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/135958 Reviewed-by: Rob Mohr <[email protected]> Presubmit-Verified: CQ Bot Account <[email protected]> Commit-Queue: Aaron Green <[email protected]> Reviewed-by: Taylor Cramer <[email protected]>
- Loading branch information
1 parent
1875778
commit 292b3a6
Showing
11 changed files
with
256 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Copyright 2023 The Pigweed Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
"""Install and check status of RE2.""" | ||
|
||
import pathlib | ||
from typing import Sequence | ||
|
||
import pw_package.git_repo | ||
import pw_package.package_manager | ||
|
||
|
||
class Re2(pw_package.git_repo.GitRepo): | ||
"""Install and check status of RE2.""" | ||
|
||
def __init__(self, *args, **kwargs): | ||
super().__init__( | ||
*args, | ||
name='re2', | ||
url=( | ||
'https://pigweed.googlesource.com/' | ||
'third_party/github/google/re2' | ||
), | ||
commit='11073deb73b3d01018308863c0bcdfd0d51d3e70', | ||
**kwargs, | ||
) | ||
|
||
def info(self, path: pathlib.Path) -> Sequence[str]: | ||
return ( | ||
f'{self.name} installed in: {path}', | ||
"Enable by running 'gn args out' and adding this line:", | ||
f' dir_pw_third_party_re2 = "{path}"', | ||
) | ||
|
||
|
||
pw_package.package_manager.register(Re2) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
# Copyright 2023 The Pigweed Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
|
||
# DO NOT MANUALLY EDIT! | ||
# This file was automatically generated by pw_build/gn_writer.py | ||
|
||
import("//build_overrides/pigweed.gni") | ||
|
||
import("$dir_pw_build/target_types.gni") | ||
import("$dir_pw_docgen/docs.gni") | ||
import("$dir_pw_third_party/re2/re2.gni") | ||
|
||
config("re2_public_config1") { | ||
include_dirs = [ "$dir_pw_third_party_re2" ] | ||
} | ||
|
||
# Generated from //:re2 | ||
pw_source_set("re2") { | ||
public = [ | ||
"$dir_pw_third_party_re2/re2/filtered_re2.h", | ||
"$dir_pw_third_party_re2/re2/re2.h", | ||
"$dir_pw_third_party_re2/re2/set.h", | ||
"$dir_pw_third_party_re2/re2/stringpiece.h", | ||
] | ||
sources = [ | ||
"$dir_pw_third_party_re2/re2/bitmap256.cc", | ||
"$dir_pw_third_party_re2/re2/bitmap256.h", | ||
"$dir_pw_third_party_re2/re2/bitstate.cc", | ||
"$dir_pw_third_party_re2/re2/compile.cc", | ||
"$dir_pw_third_party_re2/re2/dfa.cc", | ||
"$dir_pw_third_party_re2/re2/filtered_re2.cc", | ||
"$dir_pw_third_party_re2/re2/mimics_pcre.cc", | ||
"$dir_pw_third_party_re2/re2/nfa.cc", | ||
"$dir_pw_third_party_re2/re2/onepass.cc", | ||
"$dir_pw_third_party_re2/re2/parse.cc", | ||
"$dir_pw_third_party_re2/re2/perl_groups.cc", | ||
"$dir_pw_third_party_re2/re2/pod_array.h", | ||
"$dir_pw_third_party_re2/re2/prefilter.cc", | ||
"$dir_pw_third_party_re2/re2/prefilter.h", | ||
"$dir_pw_third_party_re2/re2/prefilter_tree.cc", | ||
"$dir_pw_third_party_re2/re2/prefilter_tree.h", | ||
"$dir_pw_third_party_re2/re2/prog.cc", | ||
"$dir_pw_third_party_re2/re2/prog.h", | ||
"$dir_pw_third_party_re2/re2/re2.cc", | ||
"$dir_pw_third_party_re2/re2/regexp.cc", | ||
"$dir_pw_third_party_re2/re2/regexp.h", | ||
"$dir_pw_third_party_re2/re2/set.cc", | ||
"$dir_pw_third_party_re2/re2/simplify.cc", | ||
"$dir_pw_third_party_re2/re2/sparse_array.h", | ||
"$dir_pw_third_party_re2/re2/sparse_set.h", | ||
"$dir_pw_third_party_re2/re2/stringpiece.cc", | ||
"$dir_pw_third_party_re2/re2/tostring.cc", | ||
"$dir_pw_third_party_re2/re2/unicode_casefold.cc", | ||
"$dir_pw_third_party_re2/re2/unicode_casefold.h", | ||
"$dir_pw_third_party_re2/re2/unicode_groups.cc", | ||
"$dir_pw_third_party_re2/re2/unicode_groups.h", | ||
"$dir_pw_third_party_re2/re2/walker-inl.h", | ||
"$dir_pw_third_party_re2/util/logging.h", | ||
"$dir_pw_third_party_re2/util/mix.h", | ||
"$dir_pw_third_party_re2/util/mutex.h", | ||
"$dir_pw_third_party_re2/util/rune.cc", | ||
"$dir_pw_third_party_re2/util/strutil.cc", | ||
"$dir_pw_third_party_re2/util/strutil.h", | ||
"$dir_pw_third_party_re2/util/utf.h", | ||
"$dir_pw_third_party_re2/util/util.h", | ||
] | ||
cflags = [ "-pthread" ] | ||
ldflags = [ "-pthread" ] | ||
public_configs = [ ":re2_public_config1" ] | ||
configs = [ "configs:internal_disabled_warnings" ] | ||
remove_configs = [ "$dir_pw_fuzzer:instrumentation" ] | ||
} | ||
|
||
pw_doc_group("docs") { | ||
sources = [ "docs.rst" ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Copyright 2023 The Pigweed Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
|
||
# Targets that include RE2 headers need to include this config. | ||
config("disabled_warnings") { | ||
cflags = [ | ||
"-Wno-dtor-name", | ||
"-Wno-gnu-anonymous-struct", | ||
"-Wno-nested-anon-types", | ||
] | ||
} | ||
|
||
# This config should only be used to build the RE2 library itself. | ||
config("internal_disabled_warnings") { | ||
cflags = [ | ||
"-Wno-c99-extensions", | ||
"-Wno-cast-qual", | ||
"-Wno-shadow", | ||
"-Wno-switch-enum", | ||
"-Wno-unused-parameter", | ||
] | ||
configs = [ ":disabled_warnings" ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
.. _module-pw_third_party_re2: | ||
|
||
=== | ||
RE2 | ||
=== | ||
The ``$dir_pw_third_party/re2/`` module provides build files to allow | ||
optionally including upstream RE2. | ||
|
||
------------------ | ||
Using upstream RE2 | ||
------------------ | ||
If you want to use RE2, you must do the following: | ||
|
||
Submodule | ||
========= | ||
Add RE2 to your workspace with the following command. | ||
|
||
.. code-block:: sh | ||
git submodule add https://github.com/google/re2.git \ | ||
third_party/re2/src | ||
GN | ||
== | ||
* Set the GN var ``dir_pw_third_party_re2`` to the location of the | ||
RE2 source. | ||
|
||
If you used the command above, this will be | ||
``//third_party/re2/src`` | ||
|
||
This can be set in your args.gn or .gn file like: | ||
``dir_pw_third_party_re2 = "//third_party/re2/src"`` | ||
|
||
Updating | ||
======== | ||
The GN build files are generated from the third-party Bazel build files using | ||
$dir_pw_build/py/pw_build/generate_3p_gn.py. | ||
|
||
The script uses data taken from ``$dir_pw_third_party/re2/repo.json``. | ||
|
||
The script should be re-run whenever the submodule is updated or the JSON file | ||
is modified. Specify the location of the Bazel repository can be specified using | ||
the ``-w`` option, e.g. | ||
|
||
.. code-block:: sh | ||
python pw_build/py/pw_build/generate_3p_gn.py \ | ||
-w third_party/re2/src | ||
Version | ||
======= | ||
The update script was last run for revision: | ||
11073deb73b3d01018308863c0bcdfd0d51d3e70 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Copyright 2023 The Pigweed Authors | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); you may not | ||
# use this file except in compliance with the License. You may obtain a copy of | ||
# the License at | ||
# | ||
# https://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT | ||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the | ||
# License for the specific language governing permissions and limitations under | ||
# the License. | ||
|
||
# DO NOT MANUALLY EDIT! | ||
# This file was automatically generated by pw_build/gn_writer.py | ||
|
||
declare_args() { | ||
# If compiling tests with RE2, this variable is set to the path to the RE2 | ||
# installation. When set, a pw_source_set for the RE2 library is created at | ||
# "$dir_pw_third_party/re2". | ||
dir_pw_third_party_re2 = "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "RE2", | ||
"add": [ "$dir_pw_third_party/re2/configs:internal_disabled_warnings" ], | ||
"remove": [ "$dir_pw_fuzzer:instrumentation" ] | ||
} |