From 52689fe8955a9a4916a38f0b8ae5ea3e217037f4 Mon Sep 17 00:00:00 2001 From: Mitchell Kember Date: Mon, 29 Jan 2024 14:25:49 -0800 Subject: [PATCH] Remove old FIDL tables.c file from build (#821) Now that #798 added the new tables.c file, and https://fxrev.dev/946309 moved the content from the old file to the new file, we can stop generating the old file (i.e. stop passing --tables to fidlc). See https://fxbug.dev/42115242 for context. --- build/fuchsia/fidl_gen_cpp.py | 12 ----- build/fuchsia/sdk.gni | 96 ++++++++++++++++------------------- 2 files changed, 43 insertions(+), 65 deletions(-) diff --git a/build/fuchsia/fidl_gen_cpp.py b/build/fuchsia/fidl_gen_cpp.py index 0a59cd4057..add4d9fc81 100755 --- a/build/fuchsia/fidl_gen_cpp.py +++ b/build/fuchsia/fidl_gen_cpp.py @@ -41,10 +41,7 @@ def main(): parser.add_argument('--root', dest='root', action='store', required=True) parser.add_argument('--json', dest='json', action='store', required=True) parser.add_argument('--fidlgen-output-root', dest='fidlgen_output_root', action='store', required=False) - parser.add_argument('--output-c-tables', dest='output_c_tables', action='store', required=True) parser.add_argument('--target-api-level', dest='target_api_level', action='store', required=False) - # TODO(fxbug.dev/39388): Remove after https://fxrev.dev/953989 rolls into flutter. - parser.add_argument('--new-tables-path', dest='new_tables_path', action='store', required=False) args = parser.parse_args() @@ -54,8 +51,6 @@ def main(): fidlc_command = [ args.fidlc_bin, - '--tables', - args.output_c_tables, '--json', args.json ] @@ -80,13 +75,6 @@ def main(): subprocess.check_call(fidlc_command) - # TODO(fxbug.dev/39388): Remove after https://fxrev.dev/953989 rolls into flutter. - if args.fidlgen_bin: - # Write tables.c so that GN doesn't complain about a missing output before the roll. - assert args.new_tables_path - with open(args.new_tables_path, "w") as f: - print("// This will contain coding tables once https://fxbug.dev/39388 is done.", file=f) - if args.fidlgen_output_root: assert os.path.exists(args.json) for fidlgen_bin in args.fidlgen_bin: diff --git a/build/fuchsia/sdk.gni b/build/fuchsia/sdk.gni index faff9286bf..ef6f3d94de 100644 --- a/build/fuchsia/sdk.gni +++ b/build/fuchsia/sdk.gni @@ -90,7 +90,10 @@ template("fuchsia_fidl_library") { library_name_json = "${meta_json.name}.json" foreach(dep, meta_json.deps) { - _deps += [ ":$dep" ] + # TODO(https://fxbug.dev/42172334): Make zx less special. + if (dep != "zx") { + _deps += [ ":$dep" ] + } } config_name = "config_$target_name" @@ -106,10 +109,6 @@ template("fuchsia_fidl_library") { inputs = [ invoker.meta ] - # TODO(fxbug.dev/39388): These are the old coding tables generated by fidlc. - # Switch to the fidlgen_hlcpp coding tables. - outputs = [ "$target_gen_dir/$library_name_slashes/cpp/old_tables.c" ] - args = [ "--fidlc-bin", rebase_path("${_fuchsia_tools_path}/fidlc"), @@ -119,8 +118,6 @@ template("fuchsia_fidl_library") { rebase_path(invoker.meta), "--json", rebase_path("$target_gen_dir/$library_name_json"), - "--output-c-tables", - rebase_path("$target_gen_dir/$library_name_slashes/cpp/old_tables.c"), ] if (fuchsia_target_api_level != -1) { @@ -130,47 +127,41 @@ template("fuchsia_fidl_library") { ] } - if (!defined(invoker.only_generate_tables) || - !invoker.only_generate_tables) { - outputs += [ - "$target_gen_dir/$library_name_slashes/cpp/fidl.cc", - "$target_gen_dir/$library_name_slashes/cpp/fidl.h", - "$target_gen_dir/$library_name_slashes/cpp/fidl_test_base.h", - "$target_gen_dir/$library_name_slashes/cpp/tables.c", - - "$target_gen_dir/fidl/$library_name/cpp/common_types.cc", - "$target_gen_dir/fidl/$library_name/cpp/common_types.h", - "$target_gen_dir/fidl/$library_name/cpp/fidl.h", - "$target_gen_dir/fidl/$library_name/cpp/hlcpp_conversion.h", - "$target_gen_dir/fidl/$library_name/cpp/markers.h", - "$target_gen_dir/fidl/$library_name/cpp/natural_messaging.cc", - "$target_gen_dir/fidl/$library_name/cpp/natural_messaging.h", - "$target_gen_dir/fidl/$library_name/cpp/natural_ostream.cc", - "$target_gen_dir/fidl/$library_name/cpp/natural_ostream.h", - "$target_gen_dir/fidl/$library_name/cpp/natural_types.cc", - "$target_gen_dir/fidl/$library_name/cpp/natural_types.h", - "$target_gen_dir/fidl/$library_name/cpp/type_conversions.cc", - "$target_gen_dir/fidl/$library_name/cpp/type_conversions.h", - "$target_gen_dir/fidl/$library_name/cpp/wire.h", - "$target_gen_dir/fidl/$library_name/cpp/wire_messaging.cc", - "$target_gen_dir/fidl/$library_name/cpp/wire_messaging.h", - "$target_gen_dir/fidl/$library_name/cpp/wire_test_base.h", - "$target_gen_dir/fidl/$library_name/cpp/wire_types.cc", - "$target_gen_dir/fidl/$library_name/cpp/wire_types.h", - ] + outputs = [ + "$target_gen_dir/$library_name_slashes/cpp/fidl.cc", + "$target_gen_dir/$library_name_slashes/cpp/fidl.h", + "$target_gen_dir/$library_name_slashes/cpp/fidl_test_base.h", + "$target_gen_dir/$library_name_slashes/cpp/tables.c", + + "$target_gen_dir/fidl/$library_name/cpp/common_types.cc", + "$target_gen_dir/fidl/$library_name/cpp/common_types.h", + "$target_gen_dir/fidl/$library_name/cpp/fidl.h", + "$target_gen_dir/fidl/$library_name/cpp/hlcpp_conversion.h", + "$target_gen_dir/fidl/$library_name/cpp/markers.h", + "$target_gen_dir/fidl/$library_name/cpp/natural_messaging.cc", + "$target_gen_dir/fidl/$library_name/cpp/natural_messaging.h", + "$target_gen_dir/fidl/$library_name/cpp/natural_ostream.cc", + "$target_gen_dir/fidl/$library_name/cpp/natural_ostream.h", + "$target_gen_dir/fidl/$library_name/cpp/natural_types.cc", + "$target_gen_dir/fidl/$library_name/cpp/natural_types.h", + "$target_gen_dir/fidl/$library_name/cpp/type_conversions.cc", + "$target_gen_dir/fidl/$library_name/cpp/type_conversions.h", + "$target_gen_dir/fidl/$library_name/cpp/wire.h", + "$target_gen_dir/fidl/$library_name/cpp/wire_messaging.cc", + "$target_gen_dir/fidl/$library_name/cpp/wire_messaging.h", + "$target_gen_dir/fidl/$library_name/cpp/wire_test_base.h", + "$target_gen_dir/fidl/$library_name/cpp/wire_types.cc", + "$target_gen_dir/fidl/$library_name/cpp/wire_types.h", + ] - args += [ - "--fidlgen-bin", - rebase_path("${_fuchsia_tools_path}/fidlgen_cpp"), - "--fidlgen-bin", - rebase_path("${_fuchsia_tools_path}/fidlgen_hlcpp"), - "--fidlgen-output-root", - rebase_path("$target_gen_dir"), - # TODO(fxbug.dev/39388): Remove after https://fxrev.dev/953989 rolls into flutter. - "--new-tables-path", - rebase_path("$target_gen_dir/$library_name_slashes/cpp/tables.c"), - ] - } + args += [ + "--fidlgen-bin", + rebase_path("${_fuchsia_tools_path}/fidlgen_cpp"), + "--fidlgen-bin", + rebase_path("${_fuchsia_tools_path}/fidlgen_hlcpp"), + "--fidlgen-output-root", + rebase_path("$target_gen_dir"), + ] } source_set(target_name) { @@ -313,12 +304,11 @@ template("fuchsia_sdk") { meta = part_meta_rebased } } else if (part_type == "fidl_library") { - fuchsia_fidl_library(subtarget_name) { - meta = part_meta_rebased - - # TODO(fxbug.dev/90838): Remove the zx special-case when generic - # option is available. - only_generate_tables = subtarget_name == "zx" + # TODO(https://fxbug.dev/42172334): Make zx less special. + if (subtarget_name != "zx") { + fuchsia_fidl_library(subtarget_name) { + meta = part_meta_rebased + } } } else if (part_type == "cc_prebuilt_library") { _fuchsia_cc_prebuilt_library(subtarget_name) {