gn2bp: Update define to cflag conversion
Test: m with Android.bp.swp
Change-Id: I7245120dcb414d7e45c722fa6393bf13cad6fb6d
diff --git a/tools/gn2bp/Android.bp.swp b/tools/gn2bp/Android.bp.swp
index 24f22b1..9a394e7 100644
--- a/tools/gn2bp/Android.bp.swp
+++ b/tools/gn2bp/Android.bp.swp
@@ -35,6 +35,50 @@
],
}
+// GN: //third_party/libevent:libevent
+cc_library_static {
+ name: "cronet_aml_third_party_libevent_libevent",
+ srcs: [
+ "third_party/libevent/buffer.c",
+ "third_party/libevent/epoll.c",
+ "third_party/libevent/evbuffer.c",
+ "third_party/libevent/evdns.c",
+ "third_party/libevent/event.c",
+ "third_party/libevent/event_tagging.c",
+ "third_party/libevent/evrpc.c",
+ "third_party/libevent/evutil.c",
+ "third_party/libevent/http.c",
+ "third_party/libevent/log.c",
+ "third_party/libevent/poll.c",
+ "third_party/libevent/select.c",
+ "third_party/libevent/signal.c",
+ "third_party/libevent/strlcpy.c",
+ ],
+ defaults: [
+ "cronet_aml_defaults",
+ ],
+ cflags: [
+ "-DANDROID",
+ "-DANDROID_NDK_VERSION_ROLL=r23_1",
+ "-DCR_CLANG_REVISION=\"llvmorg-16-init-8189-g97196a2d-1\"",
+ "-DCR_LIBCXX_REVISION=166132d607a5b33487d523bd9cc2ba9176ddffef",
+ "-DDCHECK_ALWAYS_ON=1",
+ "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
+ "-DHAVE_CONFIG_H",
+ "-DHAVE_SYS_UIO_H",
+ "-D_DEBUG",
+ "-D_GNU_SOURCE",
+ "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ ],
+ local_include_dirs: [
+ "./",
+ "buildtools/third_party/libc++/",
+ "out/test/gen/",
+ "third_party/libevent/android/",
+ ],
+}
+
// GN: //third_party/zlib:zlib
cc_library_static {
name: "cronet_aml_third_party_zlib_zlib",
@@ -61,8 +105,20 @@
"cronet_aml_defaults",
],
cflags: [
+ "-DANDROID",
+ "-DANDROID_NDK_VERSION_ROLL=r23_1",
+ "-DCPU_NO_SIMD",
+ "-DCR_CLANG_REVISION=\"llvmorg-16-init-8189-g97196a2d-1\"",
+ "-DCR_LIBCXX_REVISION=166132d607a5b33487d523bd9cc2ba9176ddffef",
+ "-DDCHECK_ALWAYS_ON=1",
+ "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
+ "-DHAVE_SYS_UIO_H",
"-DZLIB_DEBUG",
"-DZLIB_IMPLEMENTATION",
+ "-D_DEBUG",
+ "-D_GNU_SOURCE",
+ "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
],
local_include_dirs: [
"./",
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index cacb051..b4942e6 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -98,9 +98,6 @@
# Compiler flags which are passed through to the blueprint.
cflag_allowlist = r'^-DPERFETTO.*$'
-# Compiler defines which are passed through to the blueprint.
-define_allowlist = r'^(GOOGLE_PROTO.*)|(ZLIB_.*)|(USE_MMAP)|(HAVE_HIDDEN)$'
-
# Additional arguments to apply to Android.bp rules.
additional_args = {
# TODO: remove if this is not useful for the cronet build.
@@ -673,9 +670,8 @@
def _get_cflags(target):
cflags = {flag for flag in target.cflags if re.match(cflag_allowlist, flag)}
- cflags |= set("-D%s" % define
- for define in target.defines
- if re.match(define_allowlist, define))
+ # Consider proper allowlist or denylist if needed
+ cflags |= set("-D%s" % define.replace("\"", "\\\"") for define in target.defines)
return cflags
diff --git a/tools/gn2bp/update_results.sh b/tools/gn2bp/update_results.sh
index e8583ba..31f6605 100755
--- a/tools/gn2bp/update_results.sh
+++ b/tools/gn2bp/update_results.sh
@@ -13,6 +13,7 @@
TARGETS=(
"//third_party/zlib:zlib"
+ "//third_party/libevent:libevent"
)
BASEDIR=$(dirname "$0")