Addressing comments

pull/9408/head
Deanna Garcia 3 years ago
parent ab7cf573ab
commit 7924cd6726
  1. 12
      BUILD
  2. 8
      WORKSPACE
  3. 1
      java/BUILD
  4. 2
      java/kotlin/BUILD
  5. 3
      java/kotlin/src/test/kotlin/com/google/protobuf/ByteStringsTest.kt
  6. 9
      protobuf_deps.bzl

12
BUILD

@ -1326,13 +1326,13 @@ cc_binary(
java_proto_library(
name = "java_test_protos",
deps = [":generic_test_protos"],
visibility = ["//visibility:public"],
visibility = ["//java:__subpackages__"],
)
java_lite_proto_library(
name = "java_lite_test_protos",
deps = [":generic_test_protos"],
visibility = ["//visibility:public"],
visibility = ["//java:__subpackages__"],
)
java_proto_library(
@ -1449,7 +1449,7 @@ genrule(
"OptionalGroup_extension_liteKt.kt",
"RepeatedGroup_extension_liteKt.kt",
],
visibility = ["//visibility:public"],
visibility = ["//java:__subpackages__"],
cmd = "$(location //:protoc) " +
"--kotlin_out=lite:$(@D) -Isrc/ " +
"$(locations src/google/protobuf/unittest_lite.proto) && " +
@ -1497,7 +1497,7 @@ genrule(
"OptionalGroup_extensionKt.kt",
"RepeatedGroup_extensionKt.kt",
],
visibility = ["//visibility:public"],
visibility = ["//java:__subpackages__"],
cmd = "$(location //:protoc) " +
"--kotlin_out=shared,immutable:$(@D) -Isrc/ " +
"$(location src/google/protobuf/unittest.proto) && " +
@ -1538,7 +1538,7 @@ genrule(
"TestAllTypesProto3LiteKt.kt",
"TestEmptyMessageProto3LiteKt.kt",
],
visibility = ["//visibility:public"],
visibility = ["//java:__subpackages__"],
cmd = "$(location //:protoc) " +
"--kotlin_out=lite:$(@D) -Isrc/ " +
"$(location src/google/protobuf/unittest_proto3_lite.proto) && " +
@ -1560,7 +1560,7 @@ genrule(
"TestAllTypesProto3Kt.kt",
"TestEmptyMessageProto3Kt.kt",
],
visibility = ["//visibility:public"],
visibility = ["//java:__subpackages__"],
cmd = "$(location //:protoc) " +
"--kotlin_out=shared,immutable:$(@D) -Isrc/ " +
"$(location src/google/protobuf/unittest_proto3.proto) && " +

@ -61,14 +61,6 @@ load("@rules_pkg//:deps.bzl", "rules_pkg_dependencies")
rules_pkg_dependencies()
# For `kt_jvm_library`
rules_kotlin_version = "v1.5.0-beta-4"
rules_kotlin_sha = "6cbd4e5768bdfae1598662e40272729ec9ece8b7bded8f0d2c81c8ff96dc139d"
http_archive(
name = "io_bazel_rules_kotlin",
urls = ["https://github.com/bazelbuild/rules_kotlin/releases/download/%s/rules_kotlin_release.tgz" % rules_kotlin_version],
sha256 = rules_kotlin_sha,
)
load("@io_bazel_rules_kotlin//kotlin:repositories.bzl", "kotlin_repositories")
kotlin_repositories()

@ -13,7 +13,6 @@ filegroup(
name = "release",
srcs = [
"//java/core:release", # contains lite.
"//java/kotlin:release", # contains kotlin lite.
"//java/util:release",
]
)

@ -66,7 +66,7 @@ kt_jvm_test(
proto_library(
name = "example_extensible_message_proto",
srcs = ["src/test/proto/com/google/protobuf/example_extensible_message.proto"],
visibility = ["//visibility:public"],
visibility = ["//java:__subpackages__"],
)
java_proto_library(

@ -33,6 +33,7 @@ package com.google.protobuf.kotlin
import com.google.common.truth.Truth.assertThat
import com.google.protobuf.ByteString
import java.lang.IndexOutOfBoundsException
import java.nio.Buffer
import java.nio.ByteBuffer
import kotlin.test.assertFailsWith
import org.junit.Test
@ -90,7 +91,7 @@ class ByteStringsTest {
@Test
fun byteBufferToByteStringRespectsPositionAndLimit() {
val buffer = ByteBuffer.wrap("abc".toByteArray(Charsets.UTF_8))
buffer.position(1)
(buffer as java.nio.Buffer).position(1)
buffer.limit(2)
assertThat(buffer.toByteString()).isEqualTo(ByteString.copyFromUtf8("b"))
}

@ -74,7 +74,7 @@ def protobuf_deps():
strip_prefix = "rules_jvm_external-4.1",
urls = ["https://github.com/bazelbuild/rules_jvm_external/archive/4.1.zip"],
)
if not native.existing_rule("rules_pkg"):
http_archive(
name = "rules_pkg",
@ -84,3 +84,10 @@ def protobuf_deps():
],
sha256 = "a89e203d3cf264e564fcb96b6e06dd70bc0557356eb48400ce4b5d97c2c3720d",
)
if not native.existing_rule("io_bazel_rules_kotlin"):
http_archive(
name = "io_bazel_rules_kotlin",
urls = ["https://github.com/bazelbuild/rules_kotlin/releases/download/v1.5.0-beta-4/rules_kotlin_release.tgz"],
sha256 = "6cbd4e5768bdfae1598662e40272729ec9ece8b7bded8f0d2c81c8ff96dc139d",
)

Loading…
Cancel
Save