Commit 112340ed authored by Alice Boxhall's avatar Alice Boxhall Committed by Commit Bot

Revert "[Fuchsia] Generate more complete GN target names for FIDL packages."

This reverts commit 0ed2b6ca.

Reason for revert: Seems to be causing build breakages on Fuchsia bots https://ci.chromium.org/p/chromium/builders/luci.chromium.ci/Fuchsia%20ARM64/47071 https://ci.chromium.org/p/chromium/builders/luci.chromium.ci/Fuchsia%20x64/25530

Original change's description:
> [Fuchsia] Generate more complete GN target names for FIDL packages.
> 
> FIDL package names consist of multiple dot-delimited segments, to allow
> scoping of packages to avoid clashes. Our GN generator script was using
> only the final segment of each package's name, resulting in clashes,
> e.g. between fuchsia.auth and fuchsia.modular.auth, if both were
> present in the SDK.
> 
> We continue to generate targets under the //third_party/fuchsia-sdk/sdk
> namespace, but use the full name rather than only the final segment,
> e.g. custom.modular.auth would become custom_modular_auth.
> 
> We also special-case the top-level "fuchsia" namespace to be ignored,
> e.g. fuchsia.modular_auth becomes just modular_auth.
> 
> Bug: 910670
> Change-Id: I675d894c72b5d43b6d8b20fb026075573a5a3380
> Reviewed-on: https://chromium-review.googlesource.com/c/1372892
> Commit-Queue: Wez <wez@chromium.org>
> Reviewed-by: Kevin Marshall <kmarshall@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#615763}

TBR=wez@chromium.org,kmarshall@chromium.org

Change-Id: Ibc33ed422c1365b019bf53ca8e4fdb26ee781038
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 910670
Reviewed-on: https://chromium-review.googlesource.com/c/1372111Reviewed-by: default avatarAlice Boxhall <aboxhall@chromium.org>
Commit-Queue: Alice Boxhall <aboxhall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#615784}
parent dc76bd12
......@@ -21,16 +21,6 @@ import("//third_party/fuchsia-sdk/fuchsia_sdk_pkg.gni")
"""
# TODO(910670): Clean up Chromium fidl_deps and remove this.
_PROVIDE_LEGACY_FIDL_TARGET_NAMES = [
"fuchsia.ui.gfx",
"fuchsia.ui.input",
"fuchsia.ui.policy",
"fuchsia.ui.scenic",
"fuchsia.ui.viewsv1",
"fuchsia.ui.viewsv1token",
"zircon.ethernet",
]
def SerializeListOfStrings(strings):
"""Outputs a list of strings in GN-friendly, double-quoted format."""
......@@ -41,13 +31,11 @@ def ReformatTargetName(dep_name):
"""Removes the namespace from |target| and substitutes invalid target
characters with valid ones (e.g. hyphens become underscores)."""
assert not '.' in dep_name, "Invalid target name: %s" % dep_name
reformatted_name = dep_name.replace('-','_')
return reformatted_name
return dep_name.split('.')[-1].replace('-','_')
def ConvertCommonFields(json):
"""Extracts fields from JSON manifest data which are used across all
target types. Note that FIDL packages do their own processing."""
target types."""
return {
'target_name': ReformatTargetName(json['name']),
......@@ -84,19 +72,6 @@ def FormatGNTarget(fields):
return output
def ReformatFidlTargetName(dep_name):
"""Converts a FIDL |dep_name| consisting of dot-delimited namespaces, and
package name, to a single underscore delimited name."""
assert not '-' in dep_name, "Invalid FIDL target name: %s" % dep_name
# For convenience, treat "fuchsia.*" namespace as top-level.
if dep_name[:8] == 'fuchsia.':
dep_name = dep_name[8:]
reformatted_name = dep_name.replace('.','_')
return reformatted_name
def ConvertFidlLibrary(json):
"""Converts a fidl_library manifest entry to a GN target.
......@@ -105,18 +80,14 @@ def ConvertFidlLibrary(json):
Returns:
The GN target definition, represented as a string."""
converted = {
'public_deps': [
':' + ReformatFidlTargetName(dep) for dep in json['deps']],
'sources': json['sources'],
'target_name': ReformatFidlTargetName(json['name']),
'type': 'fuchsia_sdk_fidl_pkg'
}
converted = ConvertCommonFields(json)
converted['type'] = 'fuchsia_sdk_fidl_pkg'
converted['sources'] = json['sources']
# Override the package name & namespace, otherwise the rule will generate
# a top-level package with |target_name| as its directory name.
# FIDL names require special handling, because the namespace needs to be
# extracted and used elsewhere.
name_parts = json['name'].split('.')
converted['package_name'] = name_parts[-1]
converted['target_name'] = name_parts[-1]
converted['namespace'] = '.'.join(name_parts[:-1])
return converted
......@@ -159,7 +130,7 @@ def ConvertCcSourceLibrary(json):
converted['include_dirs'] = [json['root'] + '/include']
converted['public_deps'] += \
[':' + ReformatFidlTargetName(dep) for dep in json['fidl_deps']]
[':' + ReformatTargetName(dep) for dep in json['fidl_deps']]
return converted
......@@ -176,7 +147,6 @@ _CONVERSION_FUNCTION_MAP = {
'cc_prebuilt_library': ConvertCcPrebuiltLibrary,
# No need to build targets for these types yet.
'dart_library': ConvertNoOp,
'host_tool': ConvertNoOp,
'image': ConvertNoOp,
'loadable_module': ConvertNoOp,
......@@ -194,16 +164,6 @@ def ConvertSdkManifests():
with open(build_output_path, 'w') as buildfile:
buildfile.write(_GENERATED_PREAMBLE)
# TODO(910670): Clean up Chromium fidl_deps and remove this.
for fidl_name in _PROVIDE_LEGACY_FIDL_TARGET_NAMES:
new_target_name = ReformatFidlTargetName(fidl_name)
old_target_name = fidl_name.split('.')[-1]
buildfile.write("""
group("%s") {
public_deps = [ ":%s" ]
}
""" % (old_target_name, new_target_name))
for next_part in toplevel_meta['parts']:
parsed = json.load(open(os.path.join(sdk_base_dir, next_part)))
if 'type' not in parsed:
......
......@@ -103,8 +103,8 @@ source_set("webrunner_common") {
deps = [
":web_fidl",
"//base",
"//third_party/fuchsia-sdk/sdk:ui_app",
"//third_party/fuchsia-sdk/sdk:ui_viewsv1",
"//third_party/fuchsia-sdk/sdk:app",
"//third_party/fuchsia-sdk/sdk:viewsv1",
"//url",
]
public_deps = [
......@@ -342,9 +342,9 @@ fidl_library("web_fidl") {
]
public_deps = [
"//third_party/fuchsia-sdk/sdk:gfx",
"//third_party/fuchsia-sdk/sdk:sys",
"//third_party/fuchsia-sdk/sdk:ui_gfx",
"//third_party/fuchsia-sdk/sdk:ui_viewsv1token",
"//third_party/fuchsia-sdk/sdk:viewsv1token",
]
}
......
......@@ -20,7 +20,7 @@ source_set("http_lib") {
public_deps = [
"//base:base",
"//net:net",
"//third_party/fuchsia-sdk/sdk:net_oldhttp",
"//third_party/fuchsia-sdk/sdk:oldhttp",
"//third_party/fuchsia-sdk/sdk:sys",
]
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment