Merge changes Ieacf0d47,I28e0758f,Ia92c4190,I0ae2d70e
* changes:
gn2bp: Add rule to replace arg by $(out)
gn2bp: Add pre_create_action_module
gn2bp: Replace arg by $(out) if possible
gn2bp: Add desc.json to generate .bp for targets
diff --git a/tools/gn2bp/Android.bp.swp b/tools/gn2bp/Android.bp.swp
index 9a394e7..938d492 100644
--- a/tools/gn2bp/Android.bp.swp
+++ b/tools/gn2bp/Android.bp.swp
@@ -14,6 +14,74 @@
//
// This file is automatically generated by gen_android_bp. Do not edit.
+// GN: //base:base_static
+cc_library_static {
+ name: "cronet_aml_base_base_static",
+ srcs: [
+ "base/base_switches.cc",
+ ],
+ generated_headers: [
+ "cronet_aml_build_chromeos_buildflags",
+ ],
+ export_generated_headers: [
+ "cronet_aml_build_chromeos_buildflags",
+ ],
+ defaults: [
+ "cronet_aml_defaults",
+ ],
+ cflags: [
+ "-DANDROID",
+ "-DANDROID_NDK_VERSION_ROLL=r23_1",
+ "-DCR_CLANG_REVISION=\"llvmorg-16-init-8697-g60809cd2-1\"",
+ "-DCR_LIBCXX_REVISION=47b31179d10646029c260702650a25d24f555acc",
+ "-DDCHECK_ALWAYS_ON=1",
+ "-DDYNAMIC_ANNOTATIONS_ENABLED=1",
+ "-DHAVE_SYS_UIO_H",
+ "-D_DEBUG",
+ "-D_GNU_SOURCE",
+ "-D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED=1",
+ "-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
+ "-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-D__STDC_CONSTANT_MACROS",
+ "-D__STDC_FORMAT_MACROS",
+ ],
+ local_include_dirs: [
+ "./",
+ "buildtools/third_party/libc++/",
+ "out/test/gen/",
+ ],
+}
+
+// GN: //base:build_date
+genrule {
+ name: "cronet_aml_base_build_date",
+ cmd: "$(location build/write_build_date_header.py) $(out) 1664686800",
+ out: [
+ "base/generated_build_date.h",
+ ],
+ tool_files: [
+ "build/write_build_date_header.py",
+ ],
+}
+
+// GN: //build:buildflag_header_h
+filegroup {
+ name: "cronet_aml_build_buildflag_header_h",
+}
+
+// GN: //build:chromeos_buildflags
+genrule {
+ name: "cronet_aml_build_chromeos_buildflags",
+ cmd: "echo '--flags IS_CHROMEOS_DEVICE=false IS_CHROMEOS_LACROS=false IS_CHROMEOS_ASH=false IS_CHROMEOS_WITH_HW_DETAILS=false IS_REVEN=false' | $(location build/write_buildflag_header.py) --output $(out) --rulename //build:chromeos_buildflags --gen-dir . --definitions /dev/stdin",
+ out: [
+ "build/chromeos_buildflags.h",
+ ],
+ tool_files: [
+ "build/write_buildflag_header.py",
+ ],
+}
+
// GN: //gn:default_deps
cc_defaults {
name: "cronet_aml_defaults",
@@ -60,15 +128,17 @@
cflags: [
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
- "-DCR_CLANG_REVISION=\"llvmorg-16-init-8189-g97196a2d-1\"",
- "-DCR_LIBCXX_REVISION=166132d607a5b33487d523bd9cc2ba9176ddffef",
+ "-DCR_CLANG_REVISION=\"llvmorg-16-init-8697-g60809cd2-1\"",
+ "-DCR_LIBCXX_REVISION=47b31179d10646029c260702650a25d24f555acc",
"-DDCHECK_ALWAYS_ON=1",
"-DDYNAMIC_ANNOTATIONS_ENABLED=1",
"-DHAVE_CONFIG_H",
"-DHAVE_SYS_UIO_H",
"-D_DEBUG",
"-D_GNU_SOURCE",
+ "-D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED=1",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
],
local_include_dirs: [
@@ -108,8 +178,8 @@
"-DANDROID",
"-DANDROID_NDK_VERSION_ROLL=r23_1",
"-DCPU_NO_SIMD",
- "-DCR_CLANG_REVISION=\"llvmorg-16-init-8189-g97196a2d-1\"",
- "-DCR_LIBCXX_REVISION=166132d607a5b33487d523bd9cc2ba9176ddffef",
+ "-DCR_CLANG_REVISION=\"llvmorg-16-init-8697-g60809cd2-1\"",
+ "-DCR_LIBCXX_REVISION=47b31179d10646029c260702650a25d24f555acc",
"-DDCHECK_ALWAYS_ON=1",
"-DDYNAMIC_ANNOTATIONS_ENABLED=1",
"-DHAVE_SYS_UIO_H",
@@ -117,7 +187,9 @@
"-DZLIB_IMPLEMENTATION",
"-D_DEBUG",
"-D_GNU_SOURCE",
+ "-D_LIBCPP_AVAILABILITY_CUSTOM_VERBOSE_ABORT_PROVIDED=1",
"-D_LIBCPP_DISABLE_VISIBILITY_ANNOTATIONS",
+ "-D_LIBCPP_ENABLE_ASSERTIONS_DEFAULT=1",
"-D_LIBCXXABI_DISABLE_VISIBILITY_ANNOTATIONS",
],
local_include_dirs: [
diff --git a/tools/gn2bp/desc.json b/tools/gn2bp/desc.json
new file mode 100644
index 0000000..3e97db5
--- /dev/null
+++ b/tools/gn2bp/desc.json
Binary files differ
diff --git a/tools/gn2bp/gen_android_bp b/tools/gn2bp/gen_android_bp
index ee092db..dd9adee 100755
--- a/tools/gn2bp/gen_android_bp
+++ b/tools/gn2bp/gen_android_bp
@@ -664,6 +664,16 @@
blueprint.add_module(module)
+# There may be a better way to do target specific modification
+# Target specific modification before create_action_module
+def pre_create_action_module(target):
+ if target.script == "//build/write_buildflag_header.py":
+ # write_buildflag_header.py writes result to args.genDir/args.output
+ # So, override args.genDir by '.' so that args.output=$(out) works
+ for i in range(len(target.args)-1):
+ if target.args[i] == '--gen-dir':
+ target.args[i+1] = '.'
+ break
def create_action_module(blueprint, target):
bp_module_name = label_to_module_name(target.name)
@@ -671,6 +681,11 @@
script = gn_utils.label_to_path(target.script)
module.tool_files.add(script)
+ # Replace arg by {$out} if possible
+ if len(target.outputs) == 1:
+ out = list(target.outputs)[0]
+ target.args = ['$(out)' if arg == out or arg == 'gen/' + out else arg for arg in target.args]
+
# Handle passing parameters via response file by piping them into the script
# and reading them from /dev/stdin.
response_file = '{{response_file_name}}'
@@ -765,6 +780,7 @@
name_without_toolchain == gn_utils.GEN_VERSION_TARGET:
module = create_gen_version_module(blueprint, target, bp_module_name)
else:
+ pre_create_action_module(target)
module = create_action_module(blueprint, target)
elif target.type == 'copy':
# TODO: careful now! copy targets are not supported yet, but this will stop
diff --git a/tools/gn2bp/update_results.sh b/tools/gn2bp/update_results.sh
index 31f6605..6b46ea2 100755
--- a/tools/gn2bp/update_results.sh
+++ b/tools/gn2bp/update_results.sh
@@ -2,7 +2,7 @@
# This script is expected to run after gen_android_bp is modified.
#
-# ./update_result.sh desc.json
+# ./update_result.sh
#
# TARGETS contains targets which are supported by gen_android_bp and
# this script generates Android.bp.swp from TARGETS.
@@ -14,7 +14,9 @@
TARGETS=(
"//third_party/zlib:zlib"
"//third_party/libevent:libevent"
+ "//base:base_static"
+ "//base:build_date"
)
BASEDIR=$(dirname "$0")
-$BASEDIR/gen_android_bp --desc $1 --out $BASEDIR/Android.bp ${TARGETS[@]}
+$BASEDIR/gen_android_bp --desc $BASEDIR/desc.json --out $BASEDIR/Android.bp ${TARGETS[@]}