Skip to content

Commit

Permalink
[fuchsia] Generate BUILD.gn from SDK metadata, migrate FIDL targets.
Browse files Browse the repository at this point in the history
This script uses the metadata JSON files in the SDK to generate a
BUILD.gn in //third_party/fuchsia-sdk/sdk. The build file is
regenerated whenever a new SDK is downloaded using "gclient sync".

Only FIDL libraries are migrated for now. Additional metadata types can
be migrated in followup CLs.


Bug: 888753
Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
Change-Id: If87010006cd23e90d970da4cb84e6de35804b7dd
Reviewed-on: https://chromium-review.googlesource.com/1241842
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Sergey Ulanov <sergeyu@chromium.org>
Reviewed-by: Scott Graham <scottmg@chromium.org>
Commit-Queue: Kevin Marshall <kmarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#594360}
  • Loading branch information
Kevin Marshall authored and Commit Bot committed Sep 26, 2018
1 parent 4dcd8ab commit dfd34b9
Show file tree
Hide file tree
Showing 17 changed files with 144 additions and 259 deletions.
13 changes: 9 additions & 4 deletions build/fuchsia/update_sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ def main():
# Previously SDK was unpacked in //third_party/fuchsia-sdk instead of
# //third_party/fuchsia-sdk/sdk . Remove the old files if they are still
# there.
Cleanup(os.path.join(REPOSITORY_ROOT, 'third_party', 'fuchsia-sdk'))
sdk_root = os.path.join(REPOSITORY_ROOT, 'third_party', 'fuchsia-sdk')
Cleanup(sdk_root)

hash_file = GetSdkHashForPlatform()
with open(hash_file, 'r') as f:
Expand All @@ -85,14 +86,15 @@ def main():
print >>sys.stderr, 'No SHA1 found in %s' % hash_file
return 1

output_dir = os.path.join(REPOSITORY_ROOT, 'third_party', 'fuchsia-sdk',
'sdk')
output_dir = os.path.join(sdk_root, 'sdk')

hash_filename = os.path.join(output_dir, '.hash')
if os.path.exists(hash_filename):
with open(hash_filename, 'r') as f:
if f.read().strip() == sdk_hash:
# Nothing to do.
# Nothing to do. Generate sdk/BUILD.gn anyways, in case the conversion
# script changed.
subprocess.check_call([os.path.join(sdk_root, 'gen_build_defs.py')])
return 0

print 'Downloading SDK %s...' % sdk_hash
Expand All @@ -113,6 +115,9 @@ def main():
finally:
os.remove(tmp)

# Generate sdk/BUILD.gn.
subprocess.check_call([os.path.join(sdk_root, 'gen_build_defs.py')])

with open(hash_filename, 'w') as f:
f.write(sdk_hash)

Expand Down
4 changes: 2 additions & 2 deletions content/common/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,8 @@ source_set("common") {

deps += [
"//third_party/fuchsia-sdk:fdio",
"//third_party/fuchsia-sdk:fonts",
"//third_party/fuchsia-sdk:scenic",
"//third_party/fuchsia-sdk/sdk:fonts",
"//third_party/fuchsia-sdk/sdk:scenic",
]
}
}
Expand Down
2 changes: 1 addition & 1 deletion content/shell/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ jumbo_static_library("content_shell_lib") {
"//components/crash/content/app:test_support",
"//components/crash/content/browser",
]
deps += [ "//third_party/fuchsia-sdk:policy" ]
deps += [ "//third_party/fuchsia-sdk/sdk:policy" ]
}

# Annoyingly, this target and layouttest_support have circular includes.
Expand Down
2 changes: 1 addition & 1 deletion media/audio/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ source_set("audio") {
"fuchsia/audio_output_stream_fuchsia.cc",
"fuchsia/audio_output_stream_fuchsia.h",
]
deps += [ "//third_party/fuchsia-sdk:media" ]
deps += [ "//third_party/fuchsia-sdk/sdk:media" ]
}

configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
Expand Down
4 changes: 2 additions & 2 deletions net/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2180,7 +2180,7 @@ source_set("net_deps") {
}

if (is_fuchsia) {
public_deps += [ "//third_party/fuchsia-sdk:netstack" ]
public_deps += [ "//third_party/fuchsia-sdk/sdk:netstack" ]
}

if (use_platform_icu_alternatives) {
Expand Down Expand Up @@ -5372,7 +5372,7 @@ test("net_unittests") {
use_test_server = true
deps += [
"//third_party/fuchsia-sdk:fidl_cpp",
"//third_party/fuchsia-sdk:netstack",
"//third_party/fuchsia-sdk/sdk:netstack",
]
sources += [ "base/network_change_notifier_fuchsia_unittest.cc" ]
}
Expand Down
4 changes: 2 additions & 2 deletions skia/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ component("skia") {
"ext/fontmgr_fuchsia.h",
]
deps += [
"//third_party/fuchsia-sdk:fonts",
"//third_party/fuchsia-sdk/sdk:fonts",
"//third_party/icu:icuuc",
]
}
Expand Down Expand Up @@ -823,7 +823,7 @@ test("skia_unittests") {
if (is_fuchsia) {
sources += [ "ext/fontmgr_fuchsia_unittest.cc" ]
deps += [
"//third_party/fuchsia-sdk:fonts",
"//third_party/fuchsia-sdk/sdk:fonts",
"//third_party/test_fonts",
]
data_deps = [
Expand Down
224 changes: 0 additions & 224 deletions third_party/fuchsia-sdk/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -153,157 +153,6 @@ fuchsia_sdk_pkg("fit") {
]
}

fuchsia_sdk_fidl_pkg("fonts") {
namespace = "fuchsia"
namespace_path = "fuchsia"
sources = [
"font_provider.fidl",
]
deps = [
":mem",
]
}

fuchsia_sdk_fidl_pkg("gfx") {
namespace = "fuchsia.ui"
namespace_path = "fuchsia/ui"
sources = [
"commands.fidl",
"display_info.fidl",
"events.fidl",
"hit.fidl",
"nodes.fidl",
"renderer.fidl",
"resources.fidl",
"shapes.fidl",
"types.fidl",
]
deps = [
":images",
":mem",
":vectorial",
]
}

fuchsia_sdk_fidl_pkg("images") {
namespace = "fuchsia"
namespace_path = "fuchsia"
sources = [
"encoded_image.fidl",
"image_info.fidl",
"image_pipe.fidl",
"memory_type.fidl",
"presentation_info.fidl",
]
}

fuchsia_sdk_fidl_pkg("input") {
namespace = "fuchsia.ui"
namespace_path = "fuchsia/ui"
sources = [
"commands.fidl",
"ime_service.fidl",
"input_connection.fidl",
"input_device_registry.fidl",
"input_dispatcher.fidl",
"input_event_constants.fidl",
"input_events.fidl",
"input_reports.fidl",
"text_editing.fidl",
"text_input.fidl",
"usages.fidl",
]
}

fuchsia_sdk_fidl_pkg("math") {
namespace = "fuchsia"
namespace_path = "fuchsia"
sources = [
"math.fidl",
]
}

fuchsia_sdk_fidl_pkg("media") {
namespace = "fuchsia"
namespace_path = "fuchsia"

sources = [
"audio.fidl",
"audio_device_enumerator.fidl",
"audio_in.fidl",
"audio_out.fidl",
"gain_control.fidl",
"stream.fidl",
"stream_type.fidl",
]
}

fuchsia_sdk_fidl_pkg("mem") {
namespace = "fuchsia"
namespace_path = "fuchsia"

sources = [
"buffer.fidl",
]
}

fuchsia_sdk_fidl_pkg("netstack") {
namespace = "fuchsia"
namespace_path = "fuchsia"

sources = [
"net_address.fidl",
"netstack.fidl",
]
}

fuchsia_sdk_fidl_pkg("oldhttp") {
namespace = "fuchsia.net"
namespace_path = "fuchsia/net"
sources = [
"http_error.fidl",
"http_header.fidl",
"http_service.fidl",
"url_body.fidl",
"url_loader.fidl",
"url_request.fidl",
"url_response.fidl",
]
deps = [
":mem",
]
}

fuchsia_sdk_fidl_pkg("policy") {
namespace = "fuchsia.ui"
namespace_path = "fuchsia/ui"
sources = [
"display_usage.fidl",
"presentation.fidl",
"presenter.fidl",
]
deps = [
":viewsv1",
]
}

fuchsia_sdk_fidl_pkg("scenic") {
namespace = "fuchsia.ui"
namespace_path = "fuchsia/ui"
sources = [
"commands.fidl",
"events.fidl",
"scenic.fidl",
"session.fidl",
]
deps = [
":gfx",
":input",
":sys",
":views",
]
}

fuchsia_sdk_pkg("svc") {
sources = [
"include/lib/svc/dir.h",
Expand All @@ -312,79 +161,6 @@ fuchsia_sdk_pkg("svc") {
libs = [ "svc" ]
}

fuchsia_sdk_fidl_pkg("sys") {
namespace = "fuchsia"
namespace_path = "fuchsia"

sources = [
"component_controller.fidl",
"environment.fidl",
"environment_controller.fidl",
"flat_namespace.fidl",
"launcher.fidl",
"loader.fidl",
"runner.fidl",
"service_provider.fidl",
]
deps = [
":mem",
]
}

fuchsia_sdk_fidl_pkg("vectorial") {
namespace = "fuchsia.ui"
namespace_path = "fuchsia/ui"
sources = [
"commands.fidl",
"events.fidl",
]
}

fuchsia_sdk_fidl_pkg("views") {
namespace = "fuchsia.ui"
namespace_path = "fuchsia/ui"

sources = [
"commands.fidl",
"events.fidl",
]
deps = [
":gfx",
":images",
]
}

fuchsia_sdk_fidl_pkg("viewsv1") {
namespace = "fuchsia.ui"
namespace_path = "fuchsia/ui"

sources = [
"view_containers.fidl",
"view_manager.fidl",
"view_properties.fidl",
"view_provider.fidl",
"view_tree_token.fidl",
"view_trees.fidl",
"views.fidl",
]
deps = [
":gfx",
":images",
":math",
":scenic",
":viewsv1token",
]
}

fuchsia_sdk_fidl_pkg("viewsv1token") {
namespace = "fuchsia.ui"
namespace_path = "fuchsia/ui"

sources = [
"view_token.fidl",
]
}

fuchsia_sdk_pkg("zx") {
sources = [
"channel.cpp",
Expand Down
9 changes: 1 addition & 8 deletions third_party/fuchsia-sdk/fuchsia_sdk_pkg.gni
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,9 @@ template("fuchsia_sdk_fidl_pkg") {
"SDK packages with namespace must specify namespace_path")
namespace = invoker.namespace
namespace_path = invoker.namespace_path

_library_name = "${namespace}.${_package_name}"
} else {
_library_name = _package_name
}

sources = []
foreach(file, invoker.sources) {
sources += [ "sdk/fidl/${_library_name}/${file}" ]
}
sources = invoker.sources
}
}

Expand Down
Loading

0 comments on commit dfd34b9

Please sign in to comment.