Bug 1888590 - Mark some subtests on trusted-types-event-handlers.html as failing...
[gecko.git] / third_party / googletest / gen_moz_build.py
blob1e78c5f88165b2b4297efa07cdba7ece6190050c
1 #!/usr/bin/env python3
2 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
3 # vim: set filetype=python:
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 import os
9 import json
12 def gen_includes(export_prefix, path_prefix):
13 result = ""
15 exports = []
16 for f in os.listdir(path_prefix):
17 # Explicitly ignore the "{gtest,gmock}/internal/custom" paths, as we
18 # replace files in them for custom configurations.
19 if f == "custom":
20 continue
22 path = os.path.join(path_prefix, f)
23 if os.path.isfile(path):
24 if os.path.splitext(f)[1] != ".h":
25 continue
26 exports.append(path)
27 else:
28 result += gen_includes(export_prefix + "." + f, path)
30 if exports:
31 result += "%s += [\n" % export_prefix
32 for export in sorted(exports):
33 result += " %s,\n" % json.dumps(export)
34 result += "]\n"
36 return result
39 if __name__ == "__main__":
40 GTEST_PATH = "googletest/include/gtest"
41 GMOCK_PATH = "googlemock/include/gmock"
43 exports = "\n".join(
45 # Normal include paths used by most code
46 gen_includes("EXPORTS.gtest", GTEST_PATH),
47 gen_includes("EXPORTS.gmock", GMOCK_PATH),
48 # webrtc.org unit tests use this include path
49 gen_includes("EXPORTS.testing.gtest.include.gtest", GTEST_PATH),
50 gen_includes("EXPORTS.testing.gmock.include.gmock", GMOCK_PATH),
53 exports = exports.replace("\n", "\n ")
55 mozbuild = f"""\
56 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
57 # vim: set filetype=python:
58 # This Source Code Form is subject to the terms of the Mozilla Public
59 # License, v. 2.0. If a copy of the MPL was not distributed with this
60 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
62 # !!! THIS FILE IS AUTOGENERATED USING gen_moz_build.py DO NOT EDIT !!!
64 with Files("**"):
65 BUG_COMPONENT = ("Testing", "GTest")
66 SCHEDULES.exclusive = ["gtest"]
68 if CONFIG["ENABLE_TESTS"]:
70 {exports}
72 SOURCES += [
73 "googlemock/src/gmock-all.cc",
74 "googletest/src/gtest-all.cc",
77 Library("gtest")
79 LOCAL_INCLUDES += [
80 "googlemock",
81 "googletest",
84 if CONFIG["OS_ARCH"] == "WINNT":
85 DEFINES["UNICODE"] = True
87 FINAL_LIBRARY = "xul-gtest"
88 """
90 with open("moz.build", "w") as f:
91 f.write(mozbuild)