mirror of
https://github.com/protocolbuffers/protobuf
synced 2026-08-26 02:23:14 -04:00
Internal change
PiperOrigin-RevId: 970944472
This commit is contained in:
parent
b6ca8b9fb1
commit
279eb6fe5a
6 changed files with 57 additions and 3 deletions
|
|
@ -7,6 +7,11 @@
|
|||
|
||||
"""java_lite_proto_library rule"""
|
||||
|
||||
load("//bazel/private:java_lite_proto_library.bzl", _java_lite_proto_library = "java_lite_proto_library")
|
||||
load(
|
||||
"//bazel/private:java_lite_proto_library.bzl",
|
||||
_java_lite_proto_aspect = "java_lite_proto_aspect",
|
||||
_java_lite_proto_library = "java_lite_proto_library",
|
||||
)
|
||||
|
||||
java_lite_proto_library = _java_lite_proto_library
|
||||
java_lite_proto_aspect = _java_lite_proto_aspect
|
||||
|
|
|
|||
|
|
@ -7,6 +7,11 @@
|
|||
|
||||
"""java_proto_library rule."""
|
||||
|
||||
load("//bazel/private:java_proto_library.bzl", _java_proto_library = "java_proto_library")
|
||||
load(
|
||||
"//bazel/private:java_proto_library.bzl",
|
||||
_bazel_java_proto_aspect = "bazel_java_proto_aspect",
|
||||
_java_proto_library = "java_proto_library",
|
||||
)
|
||||
|
||||
java_proto_library = _java_proto_library
|
||||
bazel_java_proto_aspect = _bazel_java_proto_aspect
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ def _aspect_impl(target, ctx):
|
|||
transitive_jars = [dep[JavaProtoAspectInfo].jars for dep in ctx.rule.attr.deps]
|
||||
|
||||
return [
|
||||
java_info,
|
||||
add_constraints(java_info, constraints = ["android"]),
|
||||
JavaProtoAspectInfo(jars = depset(jars, transitive = transitive_jars)),
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
package com.google.protobuf.kotlin.diamond
|
||||
|
||||
import kotlin.test.assertEquals
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.junit.runners.JUnit4
|
||||
|
||||
/**
|
||||
* Regression test for Bazel Java One-Version classpath collisions in Kotlin proto generation.
|
||||
*
|
||||
* Verifies that when a test depends simultaneously on a leaf Kotlin proto library
|
||||
* (`:leaf_kt_proto`) and an exporter Kotlin proto library (`:exporter_kt_proto`, which re-exports
|
||||
* `:leaf_proto`), the Kotlin proto code generation does not duplicate class definitions with
|
||||
* differing Cyclic Redundancy Checks (CRCs) across multiple jars on the runtime classpath.
|
||||
*/
|
||||
@RunWith(JUnit4::class)
|
||||
class DiamondDependencyTest {
|
||||
@Test
|
||||
fun testDiamondDependencyClasspath() {
|
||||
val leaf = leafMessage { value = "leaf" }
|
||||
assertEquals("leaf", leaf.value)
|
||||
|
||||
val exporter = exporterMessage { value = "exporter" }
|
||||
assertEquals("exporter", exporter.value)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
edition = "2024";
|
||||
|
||||
package protobuf.kotlin.test.diamond;
|
||||
|
||||
option java_package = "com.google.protobuf.kotlin.diamond";
|
||||
|
||||
message ExporterMessage {
|
||||
string value = 1;
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
edition = "2024";
|
||||
|
||||
package protobuf.kotlin.test.diamond;
|
||||
|
||||
option java_package = "com.google.protobuf.kotlin.diamond";
|
||||
|
||||
message LeafMessage {
|
||||
string value = 1;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue