Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
82 changes: 82 additions & 0 deletions alts/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
load("//:java_grpc_library.bzl", "java_grpc_library")

java_library(
name = "alts_tsi",
srcs = glob([
"src/main/java/io/grpc/alts/transportsecurity/*.java",
]),
visibility = ["//visibility:public"],
deps = [
"//core",
"//core:internal",
"//stub",
"@com_google_code_findbugs_jsr305//jar",
"@com_google_guava_guava//jar",
"@com_google_protobuf//:protobuf_java",
"@com_google_protobuf//:protobuf_java_util",
"@io_netty_netty_buffer//jar",
"@io_netty_netty_common//jar",
":handshaker_java_proto",
":handshaker_java_grpc",
],
)

java_library(
name = "alts",
srcs = glob([
"src/main/java/io/grpc/alts/*.java",
]),
visibility = ["//visibility:public"],
deps = [
"//core",
"//core:internal",
"//netty",
"//stub",
"@com_google_code_findbugs_jsr305//jar",
"@com_google_guava_guava//jar",
"@com_google_protobuf//:protobuf_java",
"@com_google_protobuf//:protobuf_java_util",
"@io_netty_netty_buffer//jar",
"@io_netty_netty_codec//jar",
"@io_netty_netty_common//jar",
"@io_netty_netty_transport//jar",
"@org_apache_commons_commons_lang3//jar",
":alts_tsi",
":handshaker_java_proto",
":handshaker_java_grpc",
],
)

# bazel only accepts proto import with absolute path.
genrule(
name = "protobuf_imports",
srcs = glob(["src/main/proto/*.proto"]),
outs = [
"protobuf_out/altscontext.proto",
"protobuf_out/handshaker.proto",
"protobuf_out/transport_security_common.proto",
],
cmd = "for fname in $(SRCS); do " +
"sed 's,import \",import \"alts/protobuf_out/,g' $$fname > " +
"$(@D)/protobuf_out/$$(basename $$fname); done",
Copy link
Member

@jyane jyane Feb 13, 2018

Choose a reason for hiding this comment

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

Just a question: Does it work with Windows? Or grpc-java does not support Windows with Bazel?

Same problems will appear other projects (e.g. grpc-services).
Previous discussions are available at here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

For windows, you could either use gradle or compile in linux then copy .jar to windows.

Once bazel team has a fix on this problem bazelbuild/bazel#4544, I will remove this genrule.

Copy link
Member

@jyane jyane Feb 13, 2018

Choose a reason for hiding this comment

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

Thanks.

)

proto_library(
name = "handshaker_proto",
srcs = [
"protobuf_out/altscontext.proto",
"protobuf_out/handshaker.proto",
"protobuf_out/transport_security_common.proto",
],
)

java_proto_library(
name = "handshaker_java_proto",
deps = [":handshaker_proto"],
)

java_grpc_library(
name = "handshaker_java_grpc",
srcs = [":handshaker_proto"],
deps = [":handshaker_java_proto"],
)
41 changes: 41 additions & 0 deletions alts/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
description = "gRPC: ALTS"

sourceCompatibility = 1.8
targetCompatibility = 1.8

buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath libraries.protobuf_plugin
}
}

dependencies {
compile project(':grpc-core'),
project(':grpc-netty'),
project(':grpc-protobuf'),
project(':grpc-stub'),
libraries.lang,
libraries.protobuf
testCompile libraries.guava_testlib,
libraries.junit,
libraries.mockito,
libraries.truth
}

configureProtoCompilation()

[compileJava, compileTestJava].each() {
// ALTS retuns a lot of futures that we mostly don't care about.
// protobuf calls valueof. Will be fixed in next release (google/protobuf#4046)
it.options.compilerArgs += ["-Xlint:-deprecation", "-Xep:FutureReturnValueIgnored:OFF"]
}

idea {
module {
sourceDirs += file("${projectDir}/src/generated/main/grpc");
sourceDirs += file("${projectDir}/src/generated/main/java");
}
}
Loading