| licenses(["notice"]) # Apache 2.0 |
| |
| package(default_visibility = ["//tools/build_defs:internal_pkg"]) |
| |
| load("//tools/build_defs:javac.bzl", "JAVACOPTS_OSS") |
| load("//:tink_version.bzl", "TINK_VERSION_LABEL") |
| load("//tools:common.bzl", "template_rule") |
| |
| full_protos = [ |
| "//proto:common_java_proto", |
| "//proto:config_java_proto", |
| "//proto:tink_java_proto", |
| ] |
| |
| lite_protos = [ |
| "//proto:common_java_proto_lite", |
| "//proto:config_java_proto_lite", |
| "//proto:tink_java_proto_lite", |
| ] |
| |
| # public interfaces |
| |
| java_library( |
| name = "primitives", |
| srcs = [ |
| "Aead.java", |
| "DeterministicAead.java", |
| "HybridDecrypt.java", |
| "HybridEncrypt.java", |
| "KeyWrap.java", |
| "Mac.java", |
| "PublicKeySign.java", |
| "PublicKeyVerify.java", |
| "StreamingAead.java", |
| ], |
| javacopts = JAVACOPTS_OSS, |
| ) |
| |
| # restricted APIs |
| |
| CLEARTEXT_KEYSET_HANDLE_SRCS = [ |
| # Storing keyset in cleartext usually leads to security incidents. |
| # To discourage users from doing that, the visibility of |
| # CleartextKeysetHandle, which allows loading cleartext keyset, |
| # is restricted. |
| "CleartextKeysetHandle.java", |
| ] |
| |
| filegroup( |
| name = "cleartext_keyset_handle_srcs", |
| srcs = CLEARTEXT_KEYSET_HANDLE_SRCS, |
| ) |
| |
| # core, without restricted APIs |
| |
| filegroup( |
| name = "srcs", |
| srcs = glob( |
| ["*.java"], |
| exclude = CLEARTEXT_KEYSET_HANDLE_SRCS, |
| ) + [":version_java"], |
| ) |
| |
| template_rule( |
| name = "version_java", |
| src = "Version.java.templ", |
| out = "Version.java", |
| substitutions = { |
| "TINK_VERSION_LABEL": "%s" % TINK_VERSION_LABEL, |
| }, |
| ) |
| |
| java_library( |
| name = "tink", |
| srcs = [":srcs"], |
| javacopts = JAVACOPTS_OSS, |
| deps = full_protos + [ |
| "//java/src/main/java/com/google/crypto/tink/annotations", |
| "//java/src/main/java/com/google/crypto/tink/subtle", |
| "@com_google_code_findbugs_jsr305", |
| "@com_google_protobuf//:protobuf_java", |
| "@org_json", |
| ], |
| ) |
| |
| filegroup( |
| name = "android_srcs", |
| srcs = glob( |
| ["*.java"], |
| exclude = CLEARTEXT_KEYSET_HANDLE_SRCS + [ |
| # TextFormat doesn't work with lite protos |
| "TextFormatKeysetReaders.java", |
| "TextFormatKeysetWriters.java", |
| ], |
| ) + [":version_java"], |
| ) |
| |
| java_library( |
| name = "android", |
| srcs = [":android_srcs"], |
| javacopts = JAVACOPTS_OSS, |
| deps = lite_protos + [ |
| "//java/src/main/java/com/google/crypto/tink/annotations", |
| "//java/src/main/java/com/google/crypto/tink/subtle", |
| "@com_google_code_findbugs_jsr305", |
| "@com_google_protobuf_javalite//:protobuf_java_lite", |
| "@org_json", |
| ], |
| ) |
| |
| java_library( |
| name = "cleartext_keyset_handle", |
| srcs = [ |
| ":cleartext_keyset_handle_srcs", |
| ], |
| javacopts = JAVACOPTS_OSS, |
| deps = full_protos + [ |
| ":tink", |
| "@com_google_protobuf_javalite//:protobuf_java_lite", |
| ], |
| ) |
| |
| java_library( |
| name = "cleartext_keyset_handle_android", |
| srcs = [ |
| ":cleartext_keyset_handle_srcs", |
| ], |
| javacopts = JAVACOPTS_OSS, |
| deps = lite_protos + [ |
| ":android", |
| "@com_google_protobuf_javalite//:protobuf_java_lite", |
| ], |
| ) |