Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ remote_jdk17_repos()
# For JVM support
http_archive(
name = "rules_jvm_external",
strip_prefix = "rules_jvm_external-6.6",
sha256 = "3afe5195069bd379373528899c03a3072f568d33bd96fe037bd43b1f590535e7",
url = "https://github.com/bazel-contrib/rules_jvm_external/releases/download/6.6/rules_jvm_external-6.6.tar.gz"
strip_prefix = "rules_jvm_external-4.5",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why downgrade?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was originally downgrading so "group:artifact:version" specification works for dependency versions not starting with number but looks like in the new 6.6 package we need to specify using "group:artifact:packaging:version" format. Added a comment with code reference and we no longer need this change.

sha256 = "b17d7388feb9bfa7f2fa09031b32707df529f26c91ab9e5d909eb1676badd9a6",
url = "https://github.com/bazel-contrib/rules_jvm_external/releases/download/4.5/rules_jvm_external-4.5.zip"
)
load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps")
rules_jvm_external_deps()
Expand Down
137 changes: 137 additions & 0 deletions cloud_gcp/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
scala_library(
name = "lib",
srcs = glob(["src/main/**/*.scala"]),
visibility = ["//visibility:public"],
deps = [
"//api:thrift",
"//api:lib",
"//online:lib",
"//spark:lib",
"//tools/build_rules/spark:spark-exec",
scala_artifact("org.scala-lang.modules:scala-java8-compat"),
scala_artifact("org.json4s:json4s-core"),
scala_artifact("org.json4s:json4s-jackson"),
scala_artifact("org.json4s:json4s-ast"),
scala_artifact("org.scala-lang.modules:scala-collection-compat"),
scala_artifact("org.rogach:scallop"),
maven_artifact("com.google.cloud:google-cloud-core"),
maven_artifact("com.google.cloud:google-cloud-bigquery"),
maven_artifact("com.google.cloud:google-cloud-bigtable"),
maven_artifact("com.google.cloud:google-cloud-pubsub"),
maven_artifact("com.google.cloud:google-cloud-dataproc"),
maven_artifact("com.google.cloud.bigdataoss:gcsio"),
maven_artifact("com.google.cloud.bigdataoss:util-hadoop"),
scala_artifact("com.google.cloud.spark:spark-bigquery-with-dependencies"),
maven_artifact("com.google.api:api-common"),
maven_artifact("com.google.api.grpc:proto-google-cloud-dataproc-v1"),
maven_artifact("com.google.api:gax"),
maven_artifact("com.google.guava:guava"),
maven_artifact("com.google.protobuf:protobuf-java"),
maven_artifact("org.yaml:snakeyaml"),
maven_artifact("io.grpc:grpc-netty-shaded"),
maven_artifact("ch.qos.reload4j:reload4j"),
maven_artifact("org.slf4j:slf4j-api"),
maven_artifact("org.apache.logging.log4j:log4j-slf4j-impl"),
maven_artifact("org.threeten:threetenbp"),
],
)

scala_library(
name = "test-lib",
srcs = glob(["src/test/**/*.scala"]),
visibility = ["//visibility:public"],
deps = [
":lib",
"//api:thrift",
"//api:lib",
"//online:lib",
"//spark:lib",
"//tools/build_rules/spark:spark-exec",
# Libraries
scala_artifact("org.scala-lang.modules:scala-java8-compat"),
scala_artifact("org.scala-lang.modules:scala-collection-compat"),
maven_artifact("com.google.cloud:google-cloud-bigtable"),
maven_artifact("com.google.cloud:google-cloud-dataproc"),
maven_artifact("com.google.cloud.bigdataoss:gcs-connector"),
maven_artifact("com.google.cloud.bigdataoss:gcsio"),
maven_artifact("com.google.cloud.bigdataoss:util-hadoop"),
maven_artifact("com.google.cloud:google-cloud-bigtable-emulator"),
maven_artifact("com.google.api:api-common"),
maven_artifact("com.google.api.grpc:proto-google-cloud-dataproc-v1"),
scala_artifact("com.google.cloud.spark:spark-bigquery-with-dependencies"),
maven_artifact("com.google.api:gax"),
maven_artifact("com.google.protobuf:protobuf-java"),
# Testing
scala_artifact("org.scalatest:scalatest-matchers-core"),
scala_artifact("org.scalatest:scalatest-core"),
scala_artifact("org.scalatest:scalatest"),
scala_artifact("org.scalatest:scalatest-flatspec"),
scala_artifact("org.scalatest:scalatest-funsuite"),
scala_artifact("org.scalatest:scalatest-shouldmatchers"),
scala_artifact("org.scalactic:scalactic"),
scala_artifact("org.scalatestplus:mockito-3-4"),
scala_artifact("org.mockito:mockito-scala"),
maven_artifact("org.mockito:mockito-core"),
maven_artifact("org.scalatest:scalatest-compatible"),
maven_artifact("junit:junit"),
maven_artifact("com.novocode:junit-interface"),
],
)

scala_test_suite(
name = "test",
srcs = glob(["src/test/**/*.scala"]),
visibility = ["//visibility:public"],
jvm_flags = [
"--add-opens=java.base/java.lang=ALL-UNNAMED",
"--add-opens=java.base/java.lang.invoke=ALL-UNNAMED",
"--add-opens=java.base/java.lang.reflect=ALL-UNNAMED",
"--add-opens=java.base/java.io=ALL-UNNAMED",
"--add-opens=java.base/java.net=ALL-UNNAMED",
"--add-opens=java.base/java.nio=ALL-UNNAMED",
"--add-opens=java.base/java.util=ALL-UNNAMED",
"--add-opens=java.base/java.util.concurrent=ALL-UNNAMED",
"--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED",
"--add-opens=java.base/sun.nio.ch=ALL-UNNAMED",
"--add-opens=java.base/sun.nio.cs=ALL-UNNAMED",
"--add-opens=java.base/sun.security.action=ALL-UNNAMED",
"--add-opens=java.base/sun.util.calendar=ALL-UNNAMED",
],
deps = [
":lib",
":test-lib",
"//api:thrift",
"//api:lib",
"//online:lib",
"//spark:lib",
"//tools/build_rules/spark:spark-exec",
# Libraries
scala_artifact("org.scala-lang.modules:scala-java8-compat"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

factor out shared deps into a common array and re-use.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

scala_artifact("org.scala-lang.modules:scala-collection-compat"),
maven_artifact("com.google.cloud:google-cloud-bigtable"),
maven_artifact("com.google.cloud:google-cloud-dataproc"),
maven_artifact("com.google.cloud.bigdataoss:gcs-connector"),
maven_artifact("com.google.cloud.bigdataoss:gcsio"),
maven_artifact("com.google.cloud.bigdataoss:util-hadoop"),
maven_artifact("com.google.cloud:google-cloud-bigtable-emulator"),
maven_artifact("com.google.api:api-common"),
maven_artifact("com.google.api.grpc:proto-google-cloud-dataproc-v1"),
scala_artifact("com.google.cloud.spark:spark-bigquery-with-dependencies"),
maven_artifact("com.google.api:gax"),
maven_artifact("com.google.protobuf:protobuf-java"),
# Testing
scala_artifact("org.scalatest:scalatest-matchers-core"),
scala_artifact("org.scalatest:scalatest-core"),
scala_artifact("org.scalatest:scalatest"),
scala_artifact("org.scalatest:scalatest-flatspec"),
scala_artifact("org.scalatest:scalatest-funsuite"),
scala_artifact("org.scalatest:scalatest-shouldmatchers"),
scala_artifact("org.scalactic:scalactic"),
scala_artifact("org.scalatestplus:mockito-3-4"),
scala_artifact("org.mockito:mockito-scala"),
maven_artifact("org.mockito:mockito-core"),
maven_artifact("org.scalatest:scalatest-compatible"),
maven_artifact("junit:junit"),
maven_artifact("com.novocode:junit-interface"),
],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Remove duplicated dependencies.

Dependencies already exist in test-lib. Just depend on ":test-lib".

     deps = [
         ":lib",
         ":test-lib",
-        "//api:thrift",
-        "//api:lib",
-        # ... remove all other deps
     ],
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
deps = [
":lib",
":test-lib",
"//api:thrift",
"//api:lib",
"//online:lib",
"//spark:lib",
"//tools/build_rules/spark:spark-exec",
# Libraries
scala_artifact("org.scala-lang.modules:scala-java8-compat"),
scala_artifact("org.scala-lang.modules:scala-collection-compat"),
maven_artifact("com.google.cloud:google-cloud-bigtable"),
maven_artifact("com.google.cloud:google-cloud-dataproc"),
maven_artifact("com.google.cloud.bigdataoss:gcs-connector"),
maven_artifact("com.google.cloud.bigdataoss:gcsio"),
maven_artifact("com.google.cloud.bigdataoss:util-hadoop"),
maven_artifact("com.google.cloud:google-cloud-bigtable-emulator"),
maven_artifact("com.google.api:api-common"),
maven_artifact("com.google.api.grpc:proto-google-cloud-dataproc-v1"),
scala_artifact("com.google.cloud.spark:spark-bigquery-with-dependencies"),
maven_artifact("com.google.api:gax"),
maven_artifact("com.google.protobuf:protobuf-java"),
# Testing
scala_artifact("org.scalatest:scalatest-matchers-core"),
scala_artifact("org.scalatest:scalatest-core"),
scala_artifact("org.scalatest:scalatest"),
scala_artifact("org.scalatest:scalatest-flatspec"),
scala_artifact("org.scalatest:scalatest-funsuite"),
scala_artifact("org.scalatest:scalatest-shouldmatchers"),
scala_artifact("org.scalactic:scalactic"),
scala_artifact("org.scalatestplus:mockito-3-4"),
scala_artifact("org.mockito:mockito-scala"),
maven_artifact("org.mockito:mockito-core"),
maven_artifact("org.scalatest:scalatest-compatible"),
maven_artifact("junit:junit"),
maven_artifact("com.novocode:junit-interface"),
],
deps = [
":lib",
":test-lib",
],

)
6 changes: 3 additions & 3 deletions spark/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
scala_library(
name = "lib",
srcs = glob(["src/main/**/*.scala"]),
resources = [
"src/main/resources/log4j2.properties",
],
visibility = ["//visibility:public"],
deps = [
"//aggregator:lib",
"//api:lib",
Expand All @@ -23,6 +21,8 @@ scala_library(
scala_artifact("org.scala-lang.modules:scala-collection-compat"),
scala_artifact("org.scala-lang.modules:scala-parser-combinators"),
maven_artifact("org.slf4j:slf4j-api"),
maven_artifact("org.apache.logging.log4j:log4j-api"),
maven_artifact("org.apache.logging.log4j:log4j-core"),
maven_artifact("org.apache.logging.log4j:log4j-slf4j-impl"),
maven_artifact("com.google.code.gson:gson"),
maven_artifact("jakarta.servlet:jakarta.servlet-api"),
Expand Down
15 changes: 14 additions & 1 deletion tools/build_rules/dependencies/maven_repository.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ maven_repository = repository(
"org.junit.platform:junit-platform-reporting:1.10.5",
"com.novocode:junit-interface:0.11",
"org.scalatestplus:mockito-3-4_2.12:3.2.10.0",
"org.mockito:mockito-core:4.6.1",
"org.mockito:mockito-core:5.12.0",
"org.mockito:mockito-scala_2.12:1.17.0",
"org.scalatest:scalatest_2.12:3.2.15",
"org.scalatest:scalatest-shouldmatchers_2.12:3.2.15",
Expand Down Expand Up @@ -50,13 +50,26 @@ maven_repository = repository(
"commons-lang:commons-lang:2.6",
"io.netty:netty-all:4.1.111.Final",
"io.delta:delta-spark_2.12:3.2.0",
"io.grpc:grpc-netty-shaded:1.62.2",
"ch.qos.reload4j:reload4j:1.2.25",
"ch.qos.logback:logback-classic:1.5.6",
"com.typesafe:config:1.4.3",
"io.micrometer:micrometer-registry-statsd:1.13.6",

# Kafka
"org.apache.kafka:kafka-clients:3.9.0",

# Google Cloud
"com.google.cloud:google-cloud-bigquery:2.42.0",
"com.google.cloud:google-cloud-bigtable:2.41.0",
"com.google.cloud:google-cloud-pubsub:1.131.0",
"com.google.cloud:google-cloud-dataproc:4.52.0",
"com.google.cloud.bigdataoss:gcs-connector:hadoop3-2.2.6",
"com.google.cloud.bigdataoss:gcsio:3.0.3",
"com.google.cloud.bigdataoss:util-hadoop:3.0.0",
"com.google.cloud.spark:spark-bigquery-with-dependencies_2.12:0.41.0",
"com.google.cloud:google-cloud-bigtable-emulator:0.178.0",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codebase verification

Update gcs-connector version in maven_repository.bzl

Version mismatch found: gcs-connector is defined as hadoop3-2.2.6 in maven_repository.bzl but hadoop3-2.2.26 is used in build.sbt. Update maven_repository.bzl to use version hadoop3-2.2.26 for consistency.

🔗 Analysis chain

Verify Google Cloud dependencies compatibility.

Comprehensive set of Google Cloud dependencies added. Ensure version compatibility across the stack.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for existing Google Cloud API usage
rg "com\.google\.cloud\." --type scala

Length of output: 7932


Script:

#!/bin/bash
# Check build.sbt for version declarations
cat build.sbt

Length of output: 21640


# Vertx
"io.vertx:vertx-core:4.5.10",
"io.vertx:vertx-web:4.5.10",
Expand Down
2 changes: 2 additions & 0 deletions tools/build_rules/dependencies/spark_repository.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ spark_repository = repository(
# Hive dependencies
"org.apache.hive:hive-metastore:2.3.9",
"org.apache.hive:hive-exec:2.3.9",

"org.apache.curator:apache-curator:5.5.0",
],
excluded_artifacts = [
"org.pentaho:pentaho-aggdesigner-algorithm",
Expand Down
Loading