Commit df3ecfde authored by brettw@chromium.org's avatar brettw@chromium.org

Start work on GN build for content/common

Add a skeleton build file for content/common that lists the basic deps, and processes the sources. This can keep track of the deps that have been converted and allows easy testing of the .gypi reading.

Changes content_common.gypi to separate out the public and private sources. The .gypi combines them both into the 'sources' so current users of this file should not be affected. This allows the GN build to declare the public API.

Enhance the gypi-to-gn script to strip conditions and collapse variables to allow the content .gypis to be read in.

Adds some simple BUILD.gn files for dependencies of content/common

Fix typo in accessibility.gyp that I discovered when writing the GN build.

R=jam@chromium.org

Review URL: https://codereview.chromium.org/287233002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@271767 0039d316-1c4b-4281-b951-d872f2087c98
parent 6e48a97d
......@@ -26,6 +26,7 @@ group("root") {
"//components/os_crypt",
"//components/startup_metric_utils",
"//components/resources:components_resources",
"//components/tracing",
"//components/translate:translate_core_browser",
"//components/translate:translate_core_common",
"//components/url_matcher",
......@@ -59,6 +60,7 @@ group("root") {
"//third_party/zlib",
"//third_party:jpeg",
"//tools/gn",
"//ui/accessibility",
"//ui/base:ui_base",
"//ui/events",
"//ui/gfx",
......@@ -84,11 +86,13 @@ group("root") {
#"//third_party/WebKit/Source/platform",
"//third_party/WebKit/Source/wtf", # TODO(brettw) re-enable for Android.
"//tools/gn",
# This UI stuff is blocked on Skia.
"//ui/accessibility",
"//ui/base:ui_base",
"//ui/events",
"//ui/gfx",
"//ui/surface", # TODO(brettw): Skia does not build on Android yet.
# Re-enable this when skia is fixed.
"//ui/surface",
]
}
}
......@@ -7,9 +7,12 @@
It is assumed that the file contains a toplevel dictionary, and this script
will return that dictionary as a GN "scope" (see example below). This script
does not know anything about GYP and it will not expand variables or execute
conditions (it will check for the presence of a "conditions" value in the
dictionary and will abort if it is present). It also does not support nested
dictionaries.
conditions.
It will strip conditions blocks.
A variables block at the top level will be flattened so that the variables
appear in the root dictionary. This way they can be returned to the GN code.
Say your_file.gypi looked like this:
{
......@@ -81,8 +84,17 @@ def LoadPythonDictionary(path):
raise Exception("Unexpected error while reading %s: %s" % (path, str(e)))
assert isinstance(file_data, dict), "%s does not eval to a dictionary" % path
assert 'conditions' not in file_data, \
"The file %s has conditions in it, these aren't supported." % path
# Strip any conditions.
if 'conditions' in file_data:
del file_data['conditions']
if 'target_conditions' in file_data:
del file_data['target_conditions']
# Flatten any varaiables to the top level.
if 'variables' in file_data:
file_data.update(file_data['variables'])
del file_data['variables']
# If the contents of the root is a dictionary with exactly one kee
# "variables", promote the contents of that to the top level. Some .gypi
......
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
source_set("tracing") {
sources = [
"child_trace_message_filter.cc",
"child_trace_message_filter.h",
"tracing_messages.cc",
"tracing_messages.h",
]
deps = [
"//base",
"//ipc",
]
}
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# TODO(brettw) this file is a work in progress, it is not currently hooked up
# to the build, but currently represents the state of content/common's deps.
import("//content/common/common.gni")
source_set("common") {
# Only targets in the content tree can depend directly on this target.
visibility = [ "//content/*" ]
sources = rebase_path(content_common_gypi_values.private_common_sources,
".", "//content")
forward_dependent_configs_from = [
# TODO(GYP) convert these dependencies.
#'../third_party/WebKit/public/blink_headers.gyp:blink_headers',
]
deps = [
"//base",
"//components/tracing",
"//gpu/command_buffer/common",
"//net",
"//skia",
"//third_party/icu",
"//ui/accessibility",
"//ui/base:ui_base",
"//ui/gfx",
"//ui/gfx/geometry",
"//url",
# TODO(GYP) convert these dependencies.
#'../third_party/WebKit/public/blink_headers.gyp:blink_headers',
#'../third_party/libjingle/libjingle.gyp:libjingle',
#'../ui/shell_dialogs/shell_dialogs.gyp:shell_dialogs',
]
}
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# This file defines the content common gypi values. This file is read once and
# cached, which is a performance optimization that allows us to share the
# results of parsing the .gypi file between the public and private BUILD.gn
# files. It also saves us from duplicating this exec_script call.
content_common_gypi_values = exec_script(
"//build/gypi_to_gn.py",
[ rebase_path("../content_common.gypi") ],
"scope",
[ "../content_common.gypi" ])
......@@ -29,7 +29,8 @@
# headers resolve correctly.
'../third_party/WebKit/public/blink_headers.gyp:blink_headers',
],
'sources': [
'variables': {
'public_common_sources': [
'public/common/assert_matching_enums.cc',
'public/common/bindings_policy.h',
'public/common/child_process_host.h',
......@@ -122,6 +123,8 @@
'public/common/window_container_type.cc',
'public/common/window_container_type.h',
'public/common/zygote_fork_delegate_linux.h',
],
'private_common_sources': [
'common/accessibility_messages.h',
'common/all_messages.h',
'common/android/address_parser.cc',
......@@ -455,6 +458,11 @@
'common/worker_messages.h',
'common/zygote_commands_linux.h',
],
},
'sources': [
'<@(public_common_sources)',
'<@(private_common_sources)',
],
'target_conditions': [
['OS=="android" and <(use_seccomp_bpf)==1', {
'sources/': [
......
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//content/common/common.gni")
source_set("common") {
sources = rebase_path(content_common_gypi_values.public_common_sources,
".", "//content")
deps = [
"//content/common",
]
}
......@@ -693,7 +693,7 @@ const char kPublic_Help[] =
" visibility list, the include will be rejected.\n"
"\n"
" GN only knows about files declared in the \"sources\" and \"public\"\n"
" sections of targets. If a file is included that is now known to the\n"
" sections of targets. If a file is included that is not known to the\n"
" build, it will be allowed.\n"
"\n"
"Examples:\n"
......
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//extensions/generated_extensions_api.gni")
component("accessibility") {
sources = [
"ax_node.cc",
"ax_node.h",
"ax_node_data.cc",
"ax_node_data.h",
"ax_serializable_tree.cc",
"ax_serializable_tree.h",
"ax_text_utils.cc",
"ax_text_utils.h",
"ax_tree.cc",
"ax_tree.h",
"ax_tree_serializer.cc",
"ax_tree_serializer.h",
"ax_tree_source.h",
"ax_tree_update.cc",
"ax_tree_update.h",
"ax_view_state.cc",
"ax_view_state.h",
]
defines = [ "ACCESSIBILITY_IMPLEMENTATION" ]
forward_dependent_configs_from = [ ":ax_gen" ]
deps = [
":ax_gen",
"//base",
"//ui/gfx",
"//ui/gfx/geometry",
]
}
test("accessibility_unittests") {
sources = [
"ax_generated_tree_unittest.cc",
"ax_tree_serializer_unittest.cc",
"ax_tree_unittest.cc",
]
deps = [
":accessibility",
"//base",
"//base/test:run_all_unittests",
"//testing/gtest",
"//ui/gfx",
"//ui/gfx/geometry",
]
}
generated_extensions_api("ax_gen") {
sources = [ "ax_enums.idl" ]
root_namespace = ""
impl_dir = "."
}
......@@ -42,7 +42,7 @@
'ax_tree_update.cc',
'ax_tree_update.h',
'ax_view_state.cc',
'ax_view_state.cc',
'ax_view_state.h',
]
},
{
......
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