blob: b2be71a78e0bfb9fd4c0a043ae2b34fe98d076ae [file] [log] [blame]
# Copyright 2017 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.
visibility = [ "$cobalt_root/*" ]
import("//build/go/go_binary.gni")
import("//build/go/go_library.gni")
import("//build/go/go_test.gni")
import("//third_party/protobuf/proto_library.gni")
proto_library("yamlpb_test_proto") {
generate_cc = false
generate_go = true
generate_python = false
sources = [ "yamlpb/yamlpb_test.proto" ]
extra_configs = [
"$cobalt_root:cobalt_config",
"$cobalt_root/src/registry:proto_config",
]
}
go_library("yamlpb_test_lib") {
name = "config/config_parser/src/yamlpb"
source_dir = "$root_gen_dir/go-proto-gen/src/$cobalt_root/src/bin/config_parser/src/yamlpb"
non_go_deps = [ ":yamlpb_test_proto" ]
sources = [ "yamlpb_test.pb.go" ]
}
go_library("config_parser") {
name = target_name
source_dir = target_name
sources = [
"cobalt11_types.go",
"config_parser.go",
"config_reader.go",
"filter.go",
"git.go",
"populate_privacy_params.go",
"project_config.go",
"project_list.go",
]
# Add test files
sources += [
"config_reader_test.go",
"filter_test.go",
"populate_privacy_params_test.go",
"project_config_test.go",
"project_list_test.go",
]
deps = [
":privacy",
":yamlpb",
"$cobalt_root/src/registry:cobalt_registry_proto_go",
"//third_party/golibs:github.com/golang/glog",
]
}
go_test("config_parser_test") {
gopackages = [ "config_parser" ]
deps = [
":config_parser",
"//third_party/golibs:github.com/google/go-cmp",
]
}
go_library("config_validator") {
name = target_name
source_dir = target_name
sources = [
"int_buckets.go",
"metric_definitions.go",
"report_definitions.go",
"validator.go",
]
# Add test files
sources += [
"int_buckets_test.go",
"metric_definitions_test.go",
"report_definitions_test.go",
]
deps = [ ":config_parser" ]
}
go_test("config_validator_test") {
gopackages = [ "config_validator" ]
deps = [
":config_validator",
"//third_party/golibs:github.com/golang/glog",
]
}
go_library("privacy") {
name = target_name
source_dir = target_name
sources = [
"error_calculator.go",
"privacy_encoding_params.go",
]
# Add test files
sources += [
"error_calculator_test.go",
"privacy_encoding_params_test.go",
]
deps = [
"$cobalt_root/src/registry:cobalt_registry_proto_go",
"//third_party/golibs:github.com/golang/glog",
]
}
go_test("privacy_test") {
gopackages = [ "privacy" ]
deps = [
":privacy",
"$cobalt_root/src/registry:cobalt_registry_proto_go",
"//third_party/golibs:github.com/golang/glog",
]
}
go_library("registry_util") {
name = target_name
source_dir = target_name
sources = [ "registry_util.go" ]
# Add test files
sources += [ "registry_util_test.go" ]
deps = [
"$cobalt_root/src/registry:cobalt_registry_proto_go",
"//third_party/golibs:github.com/golang/glog",
]
}
go_test("registry_util_test") {
gopackages = [ "registry_util" ]
deps = [
":registry_util",
"$cobalt_root/src/registry:cobalt_registry_proto_go",
"//third_party/golibs:github.com/golang/glog",
]
}
go_library("source_generator") {
name = target_name
source_dir = target_name
sources = [
"cpp.go",
"dart.go",
"dep.go",
"go.go",
"ident.go",
"java.go",
"json.go",
"rust.go",
"simple.go",
"source_outputter.go",
"utils.go",
"writer.go",
]
# Add test go files
sources += [
"dep_test.go",
"ident_test.go",
"json_test.go",
"source_generator_test.go",
"source_generator_test_files",
"source_outputter_test.go",
"utils_test.go",
]
deps = [ "$cobalt_root/src/registry:cobalt_registry_proto_go" ]
}
go_test("source_generator_test") {
gopackages = [ "source_generator" ]
deps = [
":config_parser",
":source_generator",
"//third_party/golibs:github.com/golang/glog",
"//third_party/golibs:github.com/google/go-cmp",
]
}
go_library("yamlpb") {
name = target_name
source_dir = target_name
sources = [
"yamlpb.go",
"yamlpb_test.go",
]
deps = [
"//third_party/golibs:github.com/go-yaml/yaml",
"//third_party/golibs:github.com/golang/protobuf",
]
}
go_test("yamlpb_test") {
gopackages = [ "yamlpb" ]
deps = [
":yamlpb",
":yamlpb_test_lib",
"//third_party/golibs:github.com/golang/glog",
]
}
# This duplicates some source paths, but main needs to be relocated into a
# package path for our go_build rules.
go_library("main") {
name = target_name
source_dir = "."
sources = [ "config_parser_main.go" ]
deps = [
":config_parser",
":config_validator",
":privacy",
":source_generator",
"$cobalt_root/src/registry:cobalt_registry_proto_go",
"//third_party/golibs:github.com/golang/glog",
"//third_party/golibs:github.com/golang/protobuf",
]
}
go_binary("bin") {
gopackage = "main"
output_name = "config_parser"
deps = [ ":main" ]
}
group("tests") {
testonly = true
deps = [
":config_parser_test",
":config_validator_test",
":privacy_test",
":registry_util_test",
":source_generator_test",
":yamlpb_test",
]
}