Skip to content

Commit

Permalink
Make gn check //mojo/public/* pass
Browse files Browse the repository at this point in the history
This adds a few header-only targets which are useful for explicitly
tracking our dependencies and propagating configs.

R=viettrungluu@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#296900}
  • Loading branch information
jamesr authored and Commit bot committed Sep 26, 2014
1 parent 5643db8 commit 2225a85
Show file tree
Hide file tree
Showing 19 changed files with 204 additions and 82 deletions.
4 changes: 4 additions & 0 deletions mojo/public/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ group("public") {
deps = [
":libmojo_sdk",
":sdk",
"//mojo/public/cpp/application:standalone",
"//mojo/public/cpp/bindings",
"//mojo/public/cpp/environment:standalone",
"//mojo/public/cpp/utility",
"//mojo/public/interfaces/bindings/tests:test_interfaces",
]

Expand Down
12 changes: 12 additions & 0 deletions mojo/public/c/environment/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 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("environment") {
sources = [
"async_waiter.h",
"logger.h",
]

deps = [ "//mojo/public/c/system" ]
}
21 changes: 21 additions & 0 deletions mojo/public/c/gles2/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# 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.

config("gles2_config") {
defines = [ "GLES2_USE_MOJO" ]
}

source_set("gles2") {
sources = [
"gles2.h",
"gles2_export.h",
]

public_configs = [ ":gles2_config" ]

public_deps = [
"//mojo/public/c/environment",
"//mojo/public/c/system",
]
}
20 changes: 7 additions & 13 deletions mojo/public/c/system/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

# Depend on this target to use the types etc defined in the system without
# linking against a specific implementation of the system. To link against a
# particular implementation, use the :for_component or
# :for_shared_library targets, depending on the type of target you are.
source_set("system") {
sources = [
"../../platform/native/system_thunks.cc",
"../../platform/native/system_thunks.h",
"buffer.h",
"core.h",
"data_pipe.h",
Expand All @@ -15,16 +17,6 @@ source_set("system") {
"system_export.h",
"types.h",
]
defines = [ "MOJO_SYSTEM_IMPLEMENTATION" ]

# The GYP target analogous to this one builds this code into a
# static library. When building for Android, both the GYP and GN
# builds add --exclude-libs=ALL globally, which means that all
# symbols in static libraries are excluded from export. That's a
# problem, as code outside this target needs to be able to call
# MojoSetSystemThunks(). Therefore, the GYP target needs to specifiy
# that all dependent targets remove that link flag. Since GN uses a
# source_set here, this flag change is not needed.
}

# In an is_component_build build, everything can link against //mojo/system
Expand All @@ -40,14 +32,16 @@ source_set("system") {
# //mojo/public/c/system:for_shared_library to your deps

group("for_shared_library") {
public_deps = [ ":system" ]
if (is_component_build) {
deps = [ "//mojo/system" ]
} else {
deps = [ ":system" ]
deps = [ "//mojo/public/platform/native:system_thunks" ]
}
}

group("for_component") {
public_deps = [ ":system" ]
if (is_component_build) {
deps = [ "//mojo/system" ]
}
Expand Down
4 changes: 4 additions & 0 deletions mojo/public/c/system/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ source_set("tests") {
visibility = [ "//mojo/public/cpp/system/tests:mojo_public_system_unittests" ]

deps = [
"//mojo/public/c/environment",
"//mojo/public/c/system",
"//testing/gtest",
]

Expand All @@ -29,6 +31,8 @@ executable("perftests") {
deps = [
"//base",
"//mojo/common/test:run_all_perftests",
"//mojo/public/c/environment",
"//mojo/public/cpp/system",
"//mojo/public/cpp/test_support:test_utils",
"//mojo/public/cpp/utility",
"//testing/gtest",
Expand Down
6 changes: 5 additions & 1 deletion mojo/public/cpp/application/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ source_set("application") {

deps = [
"//mojo/public/cpp/bindings",
"//mojo/public/cpp/environment",
"//mojo/public/cpp/system",
"//mojo/public/interfaces/application",
]
}
Expand All @@ -36,8 +38,10 @@ source_set("standalone") {
"lib/application_runner.cc"
]

public_deps = [ ":application" ]

deps = [
":application",
"//mojo/public/cpp/environment:standalone",
"//mojo/public/cpp/utility",
]
}
23 changes: 18 additions & 5 deletions mojo/public/cpp/bindings/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
source_set("bindings") {
sources = [
"array.h",
"callback.h",
"error_handler.h",
"interface_ptr.h",
"message.h",
Expand All @@ -23,7 +22,6 @@ source_set("bindings") {
"lib/bounds_checker.cc",
"lib/bounds_checker.h",
"lib/buffer.h",
"lib/callback_internal.h",
"lib/connector.cc",
"lib/connector.h",
"lib/filter_chain.cc",
Expand All @@ -42,12 +40,27 @@ source_set("bindings") {
"lib/no_interface.cc",
"lib/router.cc",
"lib/router.h",
"lib/shared_data.h",
"lib/shared_ptr.h",
"lib/string_serialization.cc",
"lib/string_serialization.h",
"lib/template_util.h",
"lib/validation_errors.cc",
"lib/validation_errors.h",
]

deps = [
":callback",
"//mojo/public/cpp/environment",
"//mojo/public/cpp/system",
]
}

source_set("callback") {
sources = [
"callback.h",
"lib/callback_internal.h",
"lib/template_util.h",
"lib/shared_data.h",
"lib/shared_ptr.h",
]

deps = [ "//mojo/public/cpp/system" ]
}
27 changes: 16 additions & 11 deletions mojo/public/cpp/bindings/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,6 @@

# GYP version: mojo/mojo_public_tests.gypi:mojo_public_bindings_unittests
test("mojo_public_bindings_unittests") {
deps = [
"//mojo/common/test:run_all_unittests",
"//mojo/public/cpp/bindings",
"//mojo/public/cpp/environment:standalone",
"//mojo/public/cpp/test_support:test_utils",
"//mojo/public/cpp/utility",
"//mojo/public/interfaces/bindings/tests:test_interfaces",
"//testing/gtest",
":mojo_public_bindings_test_utils",
]

sources = [
"array_unittest.cc",
"bounds_checker_unittest.cc",
Expand All @@ -31,11 +20,27 @@ test("mojo_public_bindings_unittests") {
"type_conversion_unittest.cc",
"validation_unittest.cc",
]

deps = [
"//mojo/common/test:run_all_unittests",
"//mojo/public/cpp/bindings",
"//mojo/public/cpp/environment:standalone",
"//mojo/public/cpp/system",
"//mojo/public/cpp/test_support:test_utils",
"//mojo/public/cpp/utility",
"//mojo/public/interfaces/bindings/tests:test_interfaces",
"//testing/gtest",
":mojo_public_bindings_test_utils",
]
}

source_set("mojo_public_bindings_test_utils") {
sources = [
"validation_test_input_parser.cc",
"validation_test_input_parser.h",
]

deps = [
"//mojo/public/c/system",
]
}
22 changes: 18 additions & 4 deletions mojo/public/cpp/environment/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,31 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

source_set("standalone") {
source_set("environment") {
sources = [
"../c/environment/async_waiter.h",
"../c/environment/logger.h",
"logging.h",
"environment.h",
]

public_deps = [ "//mojo/public/c/environment" ]

deps = [ "//mojo/public/cpp/system" ]
}

source_set("standalone") {
sources = [
"lib/default_async_waiter.cc",
"lib/default_async_waiter.h",
"lib/default_logger.cc",
"lib/default_logger.h",
"lib/environment.cc",
"lib/logging.cc",
"logging.h",
]

public_deps = [ ":environment" ]

deps = [
"//mojo/public/c/environment",
"//mojo/public/cpp/utility",
]
}
14 changes: 8 additions & 6 deletions mojo/public/cpp/environment/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,19 @@

# GYP version: mojo/mojo_public_tests.gypi:mojo_public_environment_unittests
test("mojo_public_environment_unittests") {
sources = [
"async_waiter_unittest.cc",
"logger_unittest.cc",
"logging_unittest.cc",
]

deps = [
"//mojo/common/test:run_all_unittests",
"//mojo/public/c/environment",
"//mojo/public/cpp/environment:standalone",
"//mojo/public/cpp/system",
"//mojo/public/cpp/test_support:test_utils",
"//mojo/public/cpp/utility",
"//testing/gtest",
]

sources = [
"async_waiter_unittest.cc",
"logger_unittest.cc",
"logging_unittest.cc",
]
}
17 changes: 17 additions & 0 deletions mojo/public/cpp/system/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# 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("system") {
sources = [
"buffer.h",
"core.h",
"data_pipe.h",
"functions.h",
"handle.h",
"macros.h",
"message_pipe.h"
]

public_deps = [ "//mojo/public/c/system" ]
}
1 change: 1 addition & 0 deletions mojo/public/cpp/system/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ test("mojo_public_system_unittests") {
deps = [
"//mojo/common/test:run_all_unittests",
"//mojo/public/c/system/tests",
"//mojo/public/cpp/system",
"//mojo/public/cpp/test_support:test_utils",
"//testing/gtest",
]
Expand Down
3 changes: 2 additions & 1 deletion mojo/public/cpp/test_support/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@ source_set("test_utils") {
testonly = true
deps = [
"//base",
"//testing/gtest",
"//mojo/public/c/test_support",
"//mojo/public/cpp/system",
"//testing/gtest",
]

sources = [
Expand Down
5 changes: 5 additions & 0 deletions mojo/public/cpp/utility/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ source_set("utility") {
"lib/thread_local_win.cc",
]

deps = [
"//mojo/public/cpp/bindings:callback",
"//mojo/public/cpp/system",
]

if (is_win) {
# See crbug.com/342893:
sources -= [
Expand Down
1 change: 1 addition & 0 deletions mojo/public/cpp/utility/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
test("mojo_public_utility_unittests") {
deps = [
"//mojo/common/test:run_all_unittests",
"//mojo/public/cpp/system",
"//mojo/public/cpp/test_support:test_utils",
"//mojo/public/cpp/utility",
"//testing/gtest",
Expand Down
Loading

0 comments on commit 2225a85

Please sign in to comment.