COMMON_SOURCES = ["common/**/*.java"]

CONFIG_SOURCES = ["config/**/*.java"]

TOOLS_SOURCES = ["tools/**/*.java"]

INDEX_SOURCES = ["index/facets/**/*.java"]

SEGMENT_BUILDER_SOURCES = ["archive/segmentbuilder/**/*.java"]

java_library(
    name = "earlybird-lib",
    sources = ["**/*.java"] + exclude_globs(COMMON_SOURCES + CONFIG_SOURCES + TOOLS_SOURCES + SEGMENT_BUILDER_SOURCES + INDEX_SOURCES),
    platform = "java8",
    tags = ["bazel-compatible"],
    dependencies = [
        "3rdparty/jvm/com/google/code/gson",
        "3rdparty/jvm/com/google/guava",
        "3rdparty/jvm/com/twitter/distributedlog:distributedlog-core",
        "3rdparty/jvm/com/twitter/elephantbird:core",
        "3rdparty/jvm/commons-codec",
        "3rdparty/jvm/commons-httpclient",
        "3rdparty/jvm/commons-io",
        "3rdparty/jvm/commons-lang",
        "3rdparty/jvm/geo/google:geoGoogle",
        "3rdparty/jvm/io/netty:netty4-tcnative-boringssl-static",
        "3rdparty/jvm/it/unimi/dsi:fastutil",
        "3rdparty/jvm/javax/servlet:servlet-api",
        "3rdparty/jvm/net/java/dev/jets3t",
        "3rdparty/jvm/org/apache/bookkeeper:bookkeeper-server",
        "3rdparty/jvm/org/apache/bookkeeper:bookkeeper-twitter-science-provider",
        "3rdparty/jvm/org/apache/commons:commons-lang3",
        "3rdparty/jvm/org/apache/hadoop:hadoop-client-default",
        "3rdparty/jvm/org/apache/httpcomponents:httpclient",
        "3rdparty/jvm/org/apache/kafka:kafka-clients",
        "3rdparty/jvm/org/apache/lucene:lucene-analyzers-common",
        "3rdparty/jvm/org/apache/lucene:lucene-analyzers-smartcn",
        "3rdparty/jvm/org/apache/lucene:lucene-core",
        "3rdparty/jvm/org/apache/lucene:lucene-facet",
        "3rdparty/jvm/org/apache/lucene:lucene-queries",
        "3rdparty/jvm/org/apache/lucene:lucene-queryparser",
        "3rdparty/jvm/org/apache/lucene:lucene-spatial-extras",
        "3rdparty/jvm/org/apache/lucene:lucene-test-framework",
        "3rdparty/jvm/org/apache/thrift",
        "3rdparty/jvm/org/apache/zookeeper:zookeeper-client",
        "3rdparty/jvm/org/json",
        "3rdparty/jvm/org/slf4j:slf4j-api",
        "3rdparty/jvm/org/tensorflow",
        "3rdparty/jvm/org/tensorflow:tensorflow-hadoop",
        "3rdparty/jvm/org/yaml:snakeyaml",
        "cuad/projects/ner/thrift/src/main/thrift:thrift-java",
        "decider/src/main/scala",
        "finagle-internal/mtls/src/main/scala/com/twitter/finagle/mtls/authentication",
        "finagle-internal/mtls/src/main/scala/com/twitter/finagle/mtls/client",
        "finagle-internal/mtls/src/main/scala/com/twitter/finagle/mtls/server",
        "finagle-internal/slo/src/main/scala/com/twitter/finagle/slo",
        "finagle/finagle-base-http",
        "finagle/finagle-core/src/main",
        "finagle/finagle-http",
        "finagle/finagle-serversets/src/main/scala",
        "finagle/finagle-stats/src/main/scala",
        "finagle/finagle-thrift/src/main/java",
        "finagle/finagle-thrift/src/main/scala",
        "finagle/finagle-thriftmux/src/main/scala",
        "finagle/finagle-zipkin-core/src/main/scala",
        "finagle/finagle-zipkin-scribe/src/main/scala",
        "kafka/finagle-kafka/finatra-kafka/src/main/scala",
        "periscope/api-proxy-thrift/thrift/src/main/thrift:thrift-java",
        "servo/decider",
        "snowflake/src/main/scala/com/twitter/snowflake/id",
        "src/antlr/com/twitter/search/queryparser/antlr:queryparser-antlr",
        "src/java/com/twitter/common/base",
        "src/java/com/twitter/common/collections",
        "src/java/com/twitter/common/net:dynamic-host-set",
        "src/java/com/twitter/common/quantity",
        "src/java/com/twitter/common/text/language:locale-util",
        "src/java/com/twitter/common/text/token",
        "src/java/com/twitter/common/text/util:token-util",
        "src/java/com/twitter/common/util",
        "src/java/com/twitter/common/util:system-mocks",
        "src/java/com/twitter/common/zookeeper:client",
        "src/java/com/twitter/common/zookeeper:group",
        "src/java/com/twitter/common/zookeeper:server-set",
        "src/java/com/twitter/common_internal/bloomfilter",
        "src/java/com/twitter/common_internal/collections",
        "src/java/com/twitter/common_internal/text:text-penguin7",
        "src/java/com/twitter/common_internal/text/version",
        "src/java/com/twitter/common_internal/zookeeper",
        "src/java/com/twitter/ml/api:api-base",
        "src/java/com/twitter/search/common/aurora",
        "src/java/com/twitter/search/common/concurrent",
        "src/java/com/twitter/search/common/config",
        "src/java/com/twitter/search/common/constants",
        "src/java/com/twitter/search/common/dark",
        "src/java/com/twitter/search/common/database",
        "src/java/com/twitter/search/common/decider",
        "src/java/com/twitter/search/common/encoding/docvalues",
        "src/java/com/twitter/search/common/encoding/features",
        "src/java/com/twitter/search/common/features",
        "src/java/com/twitter/search/common/file",
        "src/java/com/twitter/search/common/logging",
        "src/java/com/twitter/search/common/metrics",
        "src/java/com/twitter/search/common/partitioning/base",
        "src/java/com/twitter/search/common/partitioning/snowflakeparser",
        "src/java/com/twitter/search/common/partitioning/zookeeper",
        "src/java/com/twitter/search/common/query",
        "src/java/com/twitter/search/common/relevance:feature-update-reader",
        "src/java/com/twitter/search/common/relevance:scorers",
        "src/java/com/twitter/search/common/relevance:text",
        "src/java/com/twitter/search/common/relevance/features",
        "src/java/com/twitter/search/common/schema",
        "src/java/com/twitter/search/common/schema/base",
        "src/java/com/twitter/search/common/schema/earlybird",
        "src/java/com/twitter/search/common/search",
        "src/java/com/twitter/search/common/search/termination",
        "src/java/com/twitter/search/common/util:closeresourceutil",
        "src/java/com/twitter/search/common/util:finagleutil",
        "src/java/com/twitter/search/common/util:gcutil",
        "src/java/com/twitter/search/common/util:kerberos",
        "src/java/com/twitter/search/common/util:log_format_util",
        "src/java/com/twitter/search/common/util:longintconverter",
        "src/java/com/twitter/search/common/util:platform_stats_exporter",
        "src/java/com/twitter/search/common/util:rule_based_converter",
        "src/java/com/twitter/search/common/util/analysis",
        "src/java/com/twitter/search/common/util/date",
        "src/java/com/twitter/search/common/util/earlybird",
        "src/java/com/twitter/search/common/util/hash",
        "src/java/com/twitter/search/common/util/io",
        "src/java/com/twitter/search/common/util/io:dl-reader-writer",
        "src/java/com/twitter/search/common/util/io:flushable",
        "src/java/com/twitter/search/common/util/io:record-reader-api",
        "src/java/com/twitter/search/common/util/io/kafka",
        "src/java/com/twitter/search/common/util/lang",
        "src/java/com/twitter/search/common/util/ml/models_manager",
        "src/java/com/twitter/search/common/util/ml/prediction_engine",
        "src/java/com/twitter/search/common/util/ml/tensorflow_engine",
        "src/java/com/twitter/search/common/util/spatial",
        "src/java/com/twitter/search/common/util/text",
        "src/java/com/twitter/search/common/util/text/regex",
        "src/java/com/twitter/search/common/util/thrift:text-protocol",
        "src/java/com/twitter/search/common/util/thrift:thrift-utils",
        "src/java/com/twitter/search/common/util/url",
        "src/java/com/twitter/search/common/util/zktrylock",
        "src/java/com/twitter/search/common/util/zookeeper",
        "src/java/com/twitter/search/core/earlybird",
        "src/java/com/twitter/search/earlybird/common",
        "src/java/com/twitter/search/earlybird/common/config",
        "src/java/com/twitter/search/earlybird/common/userupdates",
        "src/java/com/twitter/search/earlybird/config",
        "src/java/com/twitter/search/earlybird/index/facets",
        "src/java/com/twitter/search/ingester/pipeline/strato_fetchers",
        "src/java/com/twitter/search/modeling/common",
        "src/java/com/twitter/search/modeling/tweet_ranking",
        "src/java/com/twitter/search/queryparser",
        "src/java/com/twitter/search/queryparser/query:core-query-nodes",
        "src/java/com/twitter/search/queryparser/query/search:search-query-nodes",
        "src/resources/com/twitter/search/earlybird/com/twitter",
        "src/resources/com/twitter/search/earlybird/ml",
        "src/thrift/com/twitter/search:common",
        "src/thrift/com/twitter/search:earlybird-java",
        "src/thrift/com/twitter/search/common:features-java",
        "src/thrift/com/twitter/search/common:indexing-java",
        "src/thrift/com/twitter/search/common:query-java",
        "src/thrift/com/twitter/service/spiderduck/gen:metadata-store-java",
        "src/thrift/com/twitter/tweetypie:events-java",
        "src/thrift/org/apache/aurora/gen:api",
        "stitch/stitch-core/src/main/scala/com/twitter/stitch",
        "strato/src/main/scala/com/twitter/strato/catalog",
        "strato/src/main/scala/com/twitter/strato/client",
        "strato/src/main/scala/com/twitter/strato/data",
        "strato/src/main/scala/com/twitter/strato/thrift",
        "tensorflow/tfcompute-java/src/main/java/com/twitter/tfcompute_java",
        "thrift-web-forms/src/main/java/com/twitter/thriftwebforms",
        "thrift-web-forms/src/main/scala/com/twitter/thriftwebforms",
        "twitter-server-internal",
        "twitter-server/server/src/main/scala",
        "ubs/common/src/main/thrift/com/twitter/ubs:broadcast-thrift-java",
        "ubs/common/src/main/thrift/com/twitter/ubs:events-java",
        "util-internal/util-eval/src/main/scala",
        "util/util-app",
        "util/util-core:scala",
        "util/util-function",
        "util/util-lint",
        "util/util-slf4j-api/src/main/scala",
        "util/util-stats/src/main/scala",
    ],
)

jvm_binary(
    name = "earlybird-binary",
    basename = "earlybird",
    main = "com.twitter.search.earlybird.EarlybirdMain",
    platform = "java8",
    tags = ["bazel-compatible"],
    dependencies = [
        ":earlybird-lib",
        "loglens/loglens-log4j",
    ],
)

java_library(
    name = "tools",
    sources = TOOLS_SOURCES,
    tags = [
        "bazel-compatible",
        "bazel-only",
    ],
    dependencies = [
        ":earlybird-lib",
        "3rdparty/jvm/com/google/guava",
        "3rdparty/jvm/com/google/guava:guava-testlib",
        "3rdparty/jvm/commons-codec",
        "3rdparty/jvm/commons-httpclient",
        "3rdparty/jvm/geo/google:geoGoogle",
        "3rdparty/jvm/junit",
        "3rdparty/jvm/net/java/dev/jets3t",
        "3rdparty/jvm/org/apache/bookkeeper:bookkeeper-server",
        "3rdparty/jvm/org/apache/hadoop:hadoop-client-default",
        "3rdparty/jvm/org/apache/thrift:libthrift",
        "src/thrift/com/twitter/search:earlybird-java",
    ],
)
