blob: 09baf4ed78ac9943b12306ceb99f5c81c68cb43d [file] [edit]
# Copyright 2019 The Fuchsia 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("//build/dist/resource.gni")
import("//third_party/quickjs/compiled_js.gni")
static_library("lib") {
sources = [
"fdio.cc",
"fdio.h",
"fidl.cc",
"fidl.h",
"fxlog.cc",
"fxlog.h",
"object_converter.cc",
"object_converter.h",
"qjs_util.h",
"runtime.cc",
"runtime.h",
"zx.cc",
"zx.h",
]
public_deps = [
":fidl",
":fxlog",
":js_libs",
":zx",
"//sdk/lib/fdio",
"//sdk/lib/fidl_base",
"//sdk/lib/syslog/cpp",
"//src/lib/fidl_codec",
"//src/lib/line_input",
"//third_party/quickjs:qjs-lib",
"//third_party/rapidjson",
"//zircon/system/ulib/zx",
]
configs += [
# TODO(fxbug.dev/58162): delete the below and fix compiler warnings
#
# Might be hard because these conversions come from quickjs.h.
"//build/config:Wno-conversion",
]
}
compiled_js("fidl") {
source = "js/fidl.js"
module = true
extra_args = [
"-M",
"fidl_internal",
]
}
compiled_js("zx") {
source = "js/zx.js"
module = true
extra_args = [
"-M",
"zx_internal",
]
}
compiled_js("fxlog") {
source = "js/fxlog.js"
module = true
extra_args = [
"-M",
"fxlog_internal",
]
}
resource("js_libs") {
sources = [
"js/ns.js",
"js/pp.js",
"js/util.js",
]
outputs = [ "data/lib/{{source_file_part}}" ]
}
executable("spawn_child_test_util") {
testonly = true
sources = [ "test/spawn_child_test_util.cc" ]
}
source_set("tests_base") {
testonly = true
public_deps = [
":lib",
"//sdk/lib/fdio",
"//sdk/lib/sys/component/cpp",
"//sdk/lib/sys/cpp",
"//sdk/testing/fidl:test",
"//sdk/testing/fidl:test_support",
"//src/developer/shell/josh/console",
"//src/lib/fidl_codec:json_for_test",
"//src/storage/memfs",
"//third_party/googletest:gtest",
"//zircon/system/ulib/async-loop",
"//zircon/system/ulib/async-loop:async-loop-cpp",
"//zircon/system/ulib/async-loop:async-loop-default",
"//zircon/system/ulib/task-utils",
"//zircon/system/ulib/zx",
]
}
config("tests_base_config") {
configs = [
# TODO(fxbug.dev/58162): delete the below and fix compiler warnings
#
# Might be hard because these conversions come from quickjs.h.
"//build/config:Wno-conversion",
]
}
source_set("log_tests") {
testonly = true
sources = [
"test/fxlog_test.cc",
"test/js_testing_utils.h",
]
deps = [
":tests_base",
"//sdk/fidl/fuchsia.logger:fuchsia.logger_hlcpp",
]
configs += [ ":tests_base_config" ]
}
source_set("tests") {
testonly = true
sources = [
"test/fidl_test.cc",
"test/js_testing_utils.h",
"test/ns_test.cc",
"test/pp_test.cc",
"test/zx_test.cc",
]
deps = [
":tests_base",
"test/optional:opt_js_lib_tests",
]
configs += [ ":tests_base_config" ]
}