Skip to content

Commit

Permalink
Remove old FIDL tables.c file from build (#821)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
mk12 authored Jan 29, 2024
1 parent 8c56fbb commit 52689fe
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 65 deletions.
12 changes: 0 additions & 12 deletions build/fuchsia/fidl_gen_cpp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand All @@ -54,8 +51,6 @@ def main():

fidlc_command = [
args.fidlc_bin,
'--tables',
args.output_c_tables,
'--json',
args.json
]
Expand All @@ -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:
Expand Down
96 changes: 43 additions & 53 deletions build/fuchsia/sdk.gni
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"),
Expand All @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 52689fe

Please sign in to comment.