blob: 3f6b1f578db074ac65599fd3acd76678e863261f [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" ]
}
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 = [
"config_parser.go",
"config_reader.go",
"expand_defaults.go",
"filter.go",
"populate_privacy_params.go",
"project_config.go",
"project_list.go",
]
# Add test files
sources += [
"config_reader_test.go",
"expand_defaults_test.go",
"filter_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") {
library = ":config_parser"
deps = [ "//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",
"validator_test.go",
]
deps = [ ":config_parser" ]
}
go_test("config_validator_test") {
library = ":config_validator"
deps = [
"//third_party/golibs:github.com/golang/glog",
"//third_party/golibs:github.com/google/go-cmp",
]
}
go_library("privacy") {
name = target_name
source_dir = target_name
sources = [
"accounting.go",
"poisson.go",
"privacy_calculations.go",
"privacy_encoding_params.go",
"refined_privacy_encoding_params.go",
]
# Add test files
sources += [
"accounting_test.go",
"poisson_test.go",
"privacy_calculations_test.go",
"privacy_encoding_params_test.go",
"refined_privacy_encoding_params_test.go",
]
deps = [
"$cobalt_root/src/registry:cobalt_registry_proto_go",
"//third_party/golibs:gonum.org/v1/gonum",
]
}
go_test("privacy_test") {
library = ":privacy"
deps = [
"$cobalt_root/src/registry:cobalt_registry_proto_go",
"//third_party/golibs:github.com/golang/glog",
"//third_party/golibs:github.com/google/go-cmp",
]
}
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") {
library = ":registry_util"
deps = [
"$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_outputter_test.go",
"utils_test.go",
]
# Add test files
sources += []
deps = [
":source_generator_test_files",
"$cobalt_root/src/registry:cobalt_registry_proto_go",
]
}
go_library("source_generator_test_files") {
name = "source_generator/${target_name}"
source_dir = "source_generator/source_generator_test_files"
sources = [
"Golden.java",
"GoldenForTesting.java",
"GoldenWithNameMaps.java",
"GoldenWithNs.java",
"golden.cb.dart",
"golden.cb.go",
"golden.cb.h",
"golden.cb.json",
"golden.cb.rs",
"golden_for_testing.cb.dart",
"golden_for_testing.cb.go",
"golden_for_testing.cb.h",
"golden_for_testing.cb.rs",
"golden_with_name_maps.cb.dart",
"golden_with_name_maps.cb.go",
"golden_with_name_maps.cb.h",
"golden_with_name_maps.cb.rs",
"golden_with_name_maps_filtered.cb.h",
"golden_with_ns.cb.h",
"golden_with_ns.cb.rs",
]
}
go_test("source_generator_test") {
library = ":source_generator"
deps = [
":config_parser",
"//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:google.golang.org/protobuf",
"//third_party/golibs:gopkg.in/yaml.v2",
]
}
go_test("yamlpb_test") {
library = ":yamlpb"
deps = [
":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:google.golang.org/protobuf",
]
}
go_binary("bin") {
library = ":main"
output_name = "config_parser"
}
group("tests") {
testonly = true
deps = [
":config_parser_test",
":config_validator_test",
":privacy_test",
":registry_util_test",
":source_generator_test",
":yamlpb_test",
]
}