-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bazel builds enabled along with sbt #893
Open
krisnaru
wants to merge
19
commits into
airbnb:main
Choose a base branch
from
krisnaru:bazel-phase1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,995
−117
Open
Changes from 15 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
d89ef49
first commit
knarukulla e357725
api build
knarukulla 4608d2b
building sources tests and quick start completed
knarukulla 36c89d4
Merge branch 'airbnb:main' into bazel-phase1
krisnaru 0ebd1ce
cleanup
knarukulla 44529e3
fixing online to work with scala 2.13
knarukulla 513984e
spark 3.5 builds enabled, some refactor and cleanup
knarukulla 0db49c4
some refactor
knarukulla 9aa98f2
2.11 cleanup and spark 3.5 support
knarukulla 11797c8
cleanup
knarukulla f0a0004
sbt support for 3_5
nikhil-zlai ceef637
thrift rule generation
knarukulla 9bb179c
platform agnostic thrift lib
knarukulla ac96222
cr feedback
knarukulla bc58b6f
Future compat issue for scala_2.13
nikhil-zlai 9107216
python builds enabled
knarukulla 0c31cf2
import fix
nikhil-zlai 27ad169
fixing imports
knarukulla efbffc4
fixing python tests
knarukulla File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
USE_BAZEL_VERSION=6.4.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
## Disable remote cache completely when --config=local is passed | ||
build:local --remote_cache= | ||
|
||
# Scala version config flags: | ||
# To build with Scala 2.12, pass "--config scala_2.12" to "bazel build" | ||
# To set a different default Scala version, add the following to | ||
# user.bazelrc: | ||
# common --config scala_2.12 | ||
common:scala_2.12 --repo_env=SCALA_VERSION=2.12.18 | ||
common:scala_2.13 --repo_env=SCALA_VERSION=2.13.12 | ||
# Default scala version to 2.12 | ||
common --repo_env=SCALA_VERSION=2.12.18 | ||
# Default to Spark 3.2 if no value is specified | ||
build --define=spark_version=3.2 | ||
|
||
build --javacopt=-Xep:DoubleBraceInitialization:OFF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,3 +43,6 @@ mvn_settings.xml | |
# Release folder | ||
releases | ||
|
||
# bazel | ||
/bazel-* | ||
/user.bazelrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
directories: | ||
# Add the directories you want added as source here | ||
# By default, we've added your entire workspace ('.') | ||
. | ||
|
||
# Automatically includes all relevant targets under the 'directories' above | ||
derive_targets_from_directories: true | ||
|
||
targets: | ||
# If source code isn't resolving, add additional targets that compile it here | ||
|
||
additional_languages: | ||
# Uncomment any additional languages you want supported | ||
python | ||
scala | ||
java |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
workspace(name = "chronon") | ||
|
||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
||
# Remove all the remote_java_tools above when upgrading to rules_java 7.5.0 or greater | ||
http_archive( | ||
name = "rules_java", | ||
sha256 = "e81e9deaae0d9d99ef3dd5f6c1b32338447fe16d5564155531ea4eb7ef38854b", | ||
urls = [ | ||
"https://github.com/bazelbuild/rules_java/releases/download/7.0.6/rules_java-7.0.6.tar.gz", | ||
], | ||
) | ||
|
||
load("@rules_java//java:repositories.bzl", "rules_java_dependencies", "rules_java_toolchains") | ||
|
||
rules_java_dependencies() | ||
|
||
rules_java_toolchains() | ||
|
||
load("@rules_java//java:repositories.bzl", "remote_jdk8_repos") | ||
|
||
remote_jdk8_repos() | ||
|
||
############################# | ||
# Protobuf # | ||
############################# | ||
http_archive( | ||
name = "rules_proto", | ||
krisnaru marked this conversation as resolved.
Show resolved
Hide resolved
|
||
sha256 = "dc3fb206a2cb3441b485eb1e423165b231235a1ea9b031b4433cf7bc1fa460dd", | ||
strip_prefix = "rules_proto-5.3.0-21.7", | ||
urls = [ | ||
"https://github.com/bazelbuild/rules_proto/archive/refs/tags/5.3.0-21.7.tar.gz", | ||
], | ||
) | ||
|
||
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains") | ||
|
||
rules_proto_dependencies() | ||
|
||
rules_proto_toolchains() | ||
|
||
# Scala support | ||
http_archive( | ||
name = "io_bazel_rules_scala", | ||
sha256 = "e734eef95cf26c0171566bdc24d83bd82bdaf8ca7873bec6ce9b0d524bdaf05d", | ||
strip_prefix = "rules_scala-6.6.0", | ||
url = "https://github.com/bazelbuild/rules_scala/releases/download/v6.6.0/rules_scala-v6.6.0.tar.gz", | ||
) | ||
|
||
# Maven rules | ||
RULES_JVM_EXTERNAL_TAG = "4.5" | ||
|
||
RULES_JVM_EXTERNAL_SHA = "b17d7388feb9bfa7f2fa09031b32707df529f26c91ab9e5d909eb1676badd9a6" | ||
|
||
http_archive( | ||
name = "rules_jvm_external", | ||
sha256 = RULES_JVM_EXTERNAL_SHA, | ||
strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG, | ||
url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % RULES_JVM_EXTERNAL_TAG, | ||
) | ||
|
||
load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps") | ||
|
||
rules_jvm_external_deps() | ||
|
||
load("@rules_jvm_external//:setup.bzl", "rules_jvm_external_setup") | ||
|
||
rules_jvm_external_setup() | ||
|
||
load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config") | ||
|
||
scala_config(scala_version = "2.12.12") | ||
|
||
load("@io_bazel_rules_scala//scala:scala.bzl", "scala_repositories") | ||
|
||
scala_repositories() | ||
|
||
load("@io_bazel_rules_scala//scala:toolchains.bzl", "scala_register_toolchains") | ||
|
||
scala_register_toolchains() | ||
|
||
load("@io_bazel_rules_scala//testing:scalatest.bzl", "scalatest_repositories", "scalatest_toolchain") | ||
|
||
scalatest_repositories() | ||
|
||
scalatest_toolchain() | ||
|
||
load("//jvm:mirrors.bzl", "load_deps") | ||
|
||
load_deps() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
load("@io_bazel_rules_scala//scala:scala_cross_version_select.bzl", "select_for_scala_version") | ||
|
||
scala_library( | ||
name = "aggregator", | ||
srcs = glob(["src/main/scala/ai/chronon/aggregator/**/*.scala"]), | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//api:api-lib", | ||
"//api:api-models", | ||
maven_artifact("com.fasterxml.jackson.core:jackson-core"), | ||
maven_artifact("com.fasterxml.jackson.core:jackson-databind"), | ||
maven_artifact("com.google.code.gson:gson"), | ||
maven_artifact("com.yahoo.datasketches:sketches-core"), | ||
maven_artifact("com.yahoo.datasketches:memory"), | ||
maven_artifact("org.apache.commons:commons-lang3"), | ||
maven_artifact("org.apache.thrift:libthrift"), | ||
maven_artifact("org.slf4j:slf4j-api"), | ||
maven_artifact("org.slf4j:slf4j-log4j12"), | ||
] + select_for_scala_version( | ||
before_2_13 = [ | ||
scala_artifact("org.scala-lang.modules:scala-collection-compat"), | ||
scala_artifact("com.fasterxml.jackson.module:jackson-module-scala"), | ||
], | ||
since_2_13 = [ | ||
scala_artifact("org.scala-lang.modules:scala-parallel-collections"), | ||
], | ||
), | ||
) | ||
|
||
scala_library( | ||
name = "test-lib", | ||
srcs = glob(["src/test/scala/ai/chronon/aggregator/test/*.scala"]), | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
":aggregator", | ||
"//api:api-lib", | ||
"//api:api-models", | ||
maven_artifact("junit:junit"), | ||
maven_artifact("com.novocode:junit-interface"), | ||
maven_artifact("org.slf4j:slf4j-api"), | ||
maven_artifact("org.slf4j:slf4j-log4j12"), | ||
maven_artifact("com.google.code.gson:gson"), | ||
maven_artifact("org.apache.thrift:libthrift"), | ||
maven_artifact("org.apache.commons:commons-lang3"), | ||
maven_artifact("org.apache.commons:commons-math3"), | ||
maven_artifact("com.yahoo.datasketches:sketches-core"), | ||
maven_artifact("com.yahoo.datasketches:memory"), | ||
] + select_for_scala_version( | ||
before_2_12 = [], | ||
) + select_for_scala_version(before_2_13 = [ | ||
maven_artifact("org.scala-lang.modules:scala-collection-compat_2.12"), | ||
maven_artifact("com.fasterxml.jackson.module:jackson-module-scala_2.12"), | ||
]) + | ||
select_for_scala_version(after_2_12 = [ | ||
maven_artifact("org.scala-lang.modules:scala-parallel-collections_2.13"), | ||
]), | ||
) | ||
|
||
scala_test_suite( | ||
name = "test", | ||
srcs = glob(["src/test/scala/ai/chronon/aggregator/test/*.scala"]), | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
":aggregator", | ||
":test-lib", | ||
"//api:api-lib", | ||
"//api:api-models", | ||
maven_artifact("junit:junit"), | ||
maven_artifact("com.novocode:junit-interface"), | ||
maven_artifact("org.slf4j:slf4j-api"), | ||
maven_artifact("org.slf4j:slf4j-log4j12"), | ||
maven_artifact("org.apache.thrift:libthrift"), | ||
maven_artifact("com.yahoo.datasketches:sketches-core"), | ||
maven_artifact("com.google.code.gson:gson"), | ||
maven_artifact("com.yahoo.datasketches:memory"), | ||
maven_artifact("org.apache.commons:commons-lang3"), | ||
maven_artifact("org.apache.commons:commons-math3"), | ||
] + select_for_scala_version( | ||
before_2_12 = [], | ||
) + select_for_scala_version(before_2_13 = [ | ||
maven_artifact("org.scala-lang.modules:scala-collection-compat_2.12"), | ||
maven_artifact("com.fasterxml.jackson.module:jackson-module-scala_2.12"), | ||
]) + | ||
select_for_scala_version(after_2_12 = [ | ||
maven_artifact("org.scala-lang.modules:scala-parallel-collections_2.13"), | ||
]), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
load("@io_bazel_rules_scala//scala:scala_cross_version_select.bzl", "select_for_scala_version") | ||
load("//tools/build_rules/thrift:thrift.bzl", "thrift_java_library") | ||
|
||
scala_library( | ||
name = "api-lib", | ||
srcs = glob(["src/main/scala/ai/chronon/api/*.scala"]) + | ||
select_for_scala_version( | ||
between_2_12_and_2_13 = [ | ||
"//api/src/main/scala-2.12/scala/util:ScalaVersionSpecificCollectionsConverter.scala", | ||
], | ||
since_2_13 = [ | ||
"//api/src/main/scala-2.13/scala/util:ScalaVersionSpecificCollectionsConverter.scala", | ||
], | ||
), | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
":api-models", | ||
"//third_party/java/spark:spark-exec", | ||
maven_artifact("com.fasterxml.jackson.core:jackson-core"), | ||
maven_artifact("com.fasterxml.jackson.core:jackson-databind"), | ||
maven_artifact("org.apache.thrift:libthrift"), | ||
maven_artifact("org.slf4j:slf4j-api"), | ||
maven_artifact("org.slf4j:slf4j-log4j12"), | ||
] + select_for_scala_version( | ||
before_2_13 = [ | ||
scala_artifact("org.scala-lang.modules:scala-collection-compat"), | ||
], | ||
since_2_13 = [ | ||
scala_artifact("org.scala-lang.modules:scala-parallel-collections"), | ||
], | ||
), | ||
) | ||
|
||
scala_test_suite( | ||
name = "test", | ||
srcs = glob(["src/test/scala/ai/chronon/api/test/*.scala"]), | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
":api-models", | ||
":api-lib", | ||
"//third_party/java/spark:spark-exec", | ||
maven_artifact("com.fasterxml.jackson.core:jackson-core"), | ||
maven_artifact("com.fasterxml.jackson.core:jackson-databind"), | ||
maven_artifact("org.apache.thrift:libthrift"), | ||
maven_artifact("org.slf4j:slf4j-api"), | ||
maven_artifact("org.slf4j:slf4j-log4j12"), | ||
maven_artifact("junit:junit"), | ||
maven_artifact("com.novocode:junit-interface"), | ||
scala_artifact("org.scalatestplus:mockito-3-4"), | ||
maven_artifact("org.mockito:mockito-core"), | ||
scala_artifact( | ||
"org.scala-lang.modules:scala-collection-compat", | ||
), | ||
] + select_for_scala_version( | ||
since_2_13 = [ | ||
maven_artifact("org.scala-lang.modules:scala-parallel-collections_2.13"), | ||
], | ||
), | ||
) | ||
|
||
thrift_java_library( | ||
name = "api-models-java", | ||
srcs = ["thrift/api.thrift"], | ||
) | ||
|
||
java_library( | ||
name = "api-models", | ||
srcs = [":api-models-java"], | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
maven_artifact("javax.annotation:javax.annotation.api"), | ||
maven_artifact("org.apache.thrift:libthrift"), | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
py_library( | ||
name = "chronon_lib", | ||
srcs = glob(["*.py"]), | ||
srcs_version = "PY3", | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
exports_files( | ||
[ | ||
"ScalaVersionSpecificCollectionsConverter.scala", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
exports_files( | ||
[ | ||
"ScalaVersionSpecificCollectionsConverter.scala", | ||
], | ||
) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wdyt about moving this to devnotes?