@@ -6,7 +6,8 @@ load("@bazel_skylib//lib:selects.bzl", "selects")
66load ("@bazel_skylib//rules:common_settings.bzl" , "string_flag" )
77load ("@rules_pkg//:mappings.bzl" , "pkg_files" , "strip_prefix" )
88load ("@rules_ruby//ruby:defs.bzl" , "ruby_library" )
9- load ("//:protobuf.bzl" , "internal_ruby_proto_library" )
9+ load ("//python:internal.bzl" , "internal_copy_files" )
10+ load ("//ruby:defs.bzl" , "internal_ruby_proto_library" )
1011load ("//:protobuf_version.bzl" , "PROTOBUF_RUBY_VERSION" )
1112load ("//conformance:defs.bzl" , "conformance_test" )
1213
@@ -85,6 +86,49 @@ selects.config_setting_group(
8586 ],
8687)
8788
89+ internal_copy_files (
90+ name = "copied_wkt_proto_files" ,
91+ srcs = [
92+ "//:well_known_type_protos" ,
93+ "//src/google/protobuf:descriptor_proto_srcs" ,
94+ "//src/google/protobuf/compiler:plugin.proto" ,
95+ ],
96+ strip_prefix = "src" ,
97+ )
98+
99+ internal_ruby_proto_library (
100+ name = "well_known_ruby_protos" ,
101+ srcs = [":copied_wkt_proto_files" ],
102+ default_runtime = "" ,
103+ includes = ["." ],
104+ visibility = [
105+ "//conformance:__pkg__" ,
106+ "//ruby:__subpackages__" ,
107+ ],
108+ )
109+
110+ internal_copy_files (
111+ name = "copied_conformance_test_files" ,
112+ testonly = 1 ,
113+ srcs = [
114+ "//src/google/protobuf:test_messages_proto2.proto" ,
115+ "//src/google/protobuf:test_messages_proto3.proto" ,
116+ ],
117+ strip_prefix = "src" ,
118+ )
119+
120+ internal_ruby_proto_library (
121+ name = "conformance_test_ruby_proto" ,
122+ testonly = 1 ,
123+ srcs = [":copied_conformance_test_files" ],
124+ includes = ["." ],
125+ visibility = [
126+ "//conformance:__pkg__" ,
127+ "//ruby:__subpackages__" ,
128+ ],
129+ deps = [":well_known_ruby_protos" ],
130+ )
131+
88132ruby_library (
89133 name = "protobuf" ,
90134 visibility = [
@@ -104,7 +148,7 @@ genrule(
104148 "//ruby/lib/google:copy_jar" ,
105149 "//ruby/lib/google:dist_files" ,
106150 "//ruby/ext/google/protobuf_c:dist_files" ,
107- "// :well_known_ruby_protos" ,
151+ ":well_known_ruby_protos" ,
108152 "google-protobuf.gemspec" ,
109153 ],
110154 outs = ["google-protobuf-" + PROTOBUF_RUBY_VERSION + "-java.gem" ],
@@ -118,7 +162,7 @@ genrule(
118162 for utf in $(execpaths //third_party/utf8_range:utf8_range_srcs) $(execpath //third_party/utf8_range:LICENSE); do
119163 mv "tmp/$$utf" "tmp/ruby/ext/google/protobuf_c/third_party/utf8_range"
120164 done
121- for wkt in $(execpaths // :well_known_ruby_protos); do
165+ for wkt in $(execpaths :well_known_ruby_protos); do
122166 mv "tmp/$$wkt" "tmp/ruby/lib/google/protobuf/"
123167 done
124168 mv "tmp/$(execpath //ruby/lib/google:copy_jar)" "tmp/ruby/lib/google"
@@ -140,9 +184,9 @@ genrule(
140184 srcs = [
141185 "//third_party/utf8_range:utf8_range_srcs" ,
142186 "//third_party/utf8_range:LICENSE" ,
143- "//:well_known_ruby_protos" ,
144187 "//ruby/ext/google/protobuf_c:dist_files" ,
145188 "//ruby/lib/google:dist_files" ,
189+ ":well_known_ruby_protos" ,
146190 "google-protobuf.gemspec" ,
147191 ],
148192 outs = ["google-protobuf-" + PROTOBUF_RUBY_VERSION + ".gem" ],
@@ -156,7 +200,7 @@ genrule(
156200 for utf in $(execpaths //third_party/utf8_range:utf8_range_srcs) $(execpath //third_party/utf8_range:LICENSE); do
157201 mv "tmp/$$utf" "tmp/ruby/ext/google/protobuf_c/third_party/utf8_range"
158202 done
159- for wkt in $(execpaths // :well_known_ruby_protos); do
203+ for wkt in $(execpaths :well_known_ruby_protos); do
160204 mv "tmp/$$wkt" "tmp/ruby/lib/google/protobuf/"
161205 done
162206 cd tmp/ruby
@@ -197,7 +241,7 @@ internal_ruby_proto_library(
197241 visibility = [
198242 "//ruby:__subpackages__" ,
199243 ],
200- deps = ["// :well_known_ruby_protos" ],
244+ deps = [":well_known_ruby_protos" ],
201245)
202246
203247conformance_test (
0 commit comments