diff --git a/build/fidl/fidl.gni b/build/fidl/fidl.gni index 9156b32e04ee990b88c3b0636edee276aacf48d4..668ae6bfe20f8218d98423bd64049653fabaf4a7 100644 --- a/build/fidl/fidl.gni +++ b/build/fidl/fidl.gni @@ -45,7 +45,73 @@ template("fidl") { not_needed(invoker, [ "api" ]) } - if (current_toolchain == dart_toolchain) { + # TODO(ZX-3365): Hack for - compat names during soft transition. + # Remove whole conditional block when final conversion to . names is done. + if (get_label_info("..", "dir") == "//zircon/public/fidl" && + string_replace(target_name, ".", "-") != target_name) { + not_needed(invoker, "*") + compat_name = string_replace(target_name, ".", "-") + if (current_toolchain == dart_toolchain) { + foreach(suffix, [ "" ]) { + group(target_name + suffix) { + forward_variables_from(invoker, [ "testonly" ]) + public_deps = [ + "//zircon/public/fidl/$compat_name:$compat_name$suffix", + ] + } + } + copy("${target_name}_dot_packages") { + forward_variables_from(invoker, [ "testonly" ]) + deps = [ + "//zircon/public/fidl/$compat_name:${compat_name}_dot_packages", + ] + sources = [ + get_label_info(deps[0], "target_gen_dir") + "/$compat_name.packages", + ] + outputs = [ + "$target_gen_dir/$target_name.packages", + ] + } + if (defined(invoker.sdk_category) && invoker.sdk_category != "excluded") { + import("//build/sdk/sdk_atom_alias.gni") + sdk_atom_alias("${target_name}_sdk") { + atom = "//zircon/public/fidl/$compat_name:${compat_name}_sdk($fidl_toolchain)" + } + } + } else if (current_toolchain == fidl_toolchain) { + copy(target_name) { + forward_variables_from(invoker, [ "testonly" ]) + deps = [ + "//zircon/public/fidl/$compat_name:${compat_name}", + ] + sources = [ + get_label_info(deps[0], "target_gen_dir") + "/$compat_name.libraries", + ] + outputs = [ + "$target_gen_dir/$target_name.libraries", + ] + } + } else { + foreach(suffix, + [ + "", + "-rustc", + "_c", + "_c_client", + "_c_server", + "_llcpp", + "_overnet_embedded", + "_overnet_internal", + ]) { + group(target_name + suffix) { + forward_variables_from(invoker, [ "testonly" ]) + public_deps = [ + "//zircon/public/fidl/$compat_name:$compat_name$suffix", + ] + } + } + } + } else if (current_toolchain == dart_toolchain) { import("//build/dart/fidl_dart.gni") fidl_dart(target_name) { diff --git a/zircon/public/gn/fidl.gni b/zircon/public/gn/fidl.gni index 4dc434489a89ff9c8a2c1244c730802be1090f1c..9e1d1c33f99941fd932b577206471eb9d3c80716 100644 --- a/zircon/public/gn/fidl.gni +++ b/zircon/public/gn/fidl.gni @@ -280,6 +280,42 @@ template("fidl_library") { } }, ] + + # TODO(ZX-3365): During soft transition, export both proper + # . names and legacy - names. + legacy_dirs += [ "fidl/$fidl_name" ] + legacy_targets += [ + { + import = "//build/fidl/fidl.gni" + target_type = "fidl" + target_name = fidl_name + + # These all become the parameters to fidl(). + name = fidl_name + if (defined(invoker.sdk) && invoker.sdk) { + sdk_category = "partner" + api = "//sdk/fidl/$fidl_name/$fidl_name.api" + } + sources = [] + foreach(file, invoker.sources) { + # Make file names source-absolute in the Fuchsia GN. + file = rebase_path(file, "$zx/") + sources += [ "//zircon/$file" ] + } + public_deps = [] + if (defined(invoker.public_deps)) { + foreach(label, invoker.public_deps) { + assert( + get_label_info(label, "name") == + get_path_info(get_label_info(label, "dir"), "name"), + "fidl_library(\"$fidl_target\") deps " + + get_label_info(label, "label_no_toolchain")) + public_deps += [ "//zircon/public/fidl/" + + get_label_info(label, "name") ] + } + } + }, + ] } } }