Skip to content

Commit 5ca8400

Browse files
Adam Cozzettecopybara-github
authored andcommitted
Move utf8_range into the protobuf repo
This makes third_party/utf8_range no longer a Git subtree, but instead the permanent location and source of truth for utf8_range. It is also now incorporated into the @com_google_protobuf Bazel repo. Utf8_range still has its own separate CMake build for now, though. PiperOrigin-RevId: 580682733
1 parent e6f8b9d commit 5ca8400

28 files changed

Lines changed: 47 additions & 188 deletions

.github/workflows/test_cpp.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ jobs:
2727
include:
2828
# Set defaults
2929
- image: us-docker.pkg.dev/protobuf-build/containers/test/linux/sanitize@sha256:04cd765285bc52cbbf51d66c8c66d8603579cf0f19cc42df26b09d2c270541fb
30-
- targets: //pkg/... //src/... @com_google_protobuf_examples//... @utf8_range//...
30+
- targets: //pkg/... //src/... @com_google_protobuf_examples//... //third_party/utf8_range/...
3131

3232
# Override cases with custom images
3333
- config: { name: "TCMalloc" }
3434
image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/tcmalloc@sha256:bd39119d74b8a3fad4ae335d4cf5294e70384676331b7e19949459fc7a8d8328"
35-
targets: "//src/... @utf8_range//..."
35+
targets: "//src/... //third_party/utf8_range/..."
3636
- config: { name: "aarch64" }
37-
targets: "//src/... //src/google/protobuf/compiler:protoc_aarch64_test @utf8_range//..."
37+
targets: "//src/... //src/google/protobuf/compiler:protoc_aarch64_test //third_party/utf8_range/..."
3838
image: "us-docker.pkg.dev/protobuf-build/containers/test/linux/emulation:aarch64-63dd26c0c7a808d92673a3e52e848189d4ab0f17"
3939
name: Linux ${{ matrix.config.name }}
4040
runs-on: ${{ matrix.config.runner || 'ubuntu-latest' }}
@@ -69,7 +69,7 @@ jobs:
6969
image: us-docker.pkg.dev/protobuf-build/containers/test/linux/gcc:${{ matrix.version }}-6.3.0-63dd26c0c7a808d92673a3e52e848189d4ab0f17
7070
credentials: ${{ secrets.GAR_SERVICE_ACCOUNT }}
7171
bazel-cache: cpp_linux/gcc-${{ matrix.version }}
72-
bazel: test //pkg/... //src/... @com_google_protobuf_examples//... @utf8_range//...
72+
bazel: test //pkg/... //src/... @com_google_protobuf_examples//... //third_party/utf8_range/...
7373

7474
linux-release:
7575
strategy:
@@ -316,13 +316,13 @@ jobs:
316316
- name: MacOS
317317
os: macos-12
318318
cache_key: macos-12
319-
bazel: test //src/... @utf8_range//...
319+
bazel: test //src/... //third_party/utf8_range/...
320320
- name: MacOS Apple Silicon (build only)
321321
os: macos-12
322322
cache_key: macos-12-arm
323323
# Current github runners are all Intel based, so just build/compile
324324
# for Apple Silicon to detect issues there.
325-
bazel: build --cpu=darwin_arm64 //src/... @utf8_range//...
325+
bazel: build --cpu=darwin_arm64 //src/... //third_party/utf8_range/...
326326
- name: Windows
327327
os: windows-2022
328328
cache_key: windows-2022

WORKSPACE

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,6 @@ load("@pip_deps//:requirements.bzl", "install_deps")
161161

162162
install_deps()
163163

164-
load("@utf8_range//:workspace_deps.bzl", "utf8_range_deps")
165-
166-
utf8_range_deps()
167-
168164
http_archive(
169165
name = "rules_fuzzing",
170166
sha256 = "ff52ef4845ab00e95d29c02a9e32e9eff4e0a4c9c8a6bcf8407a2f19eb3f9190",

php/BUILD.bazel

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
load("@rules_pkg//:mappings.bzl", "pkg_filegroup", "pkg_files", "strip_prefix")
66
load("@rules_pkg//:pkg.bzl", "pkg_tar")
7-
load("//upb/cmake:build_defs.bzl", "staleness_test")
7+
load("//:protobuf_version.bzl", "PROTOBUF_PHP_VERSION", "PROTOC_VERSION")
88
load("//build_defs:internal_shell.bzl", "inline_sh_binary")
99
load("//conformance:defs.bzl", "conformance_test")
10-
load("//:protobuf_version.bzl", "PROTOBUF_PHP_VERSION", "PROTOC_VERSION")
10+
load("//upb/cmake:build_defs.bzl", "staleness_test")
1111

1212
filegroup(
1313
name = "source_files",
@@ -32,7 +32,7 @@ inline_sh_binary(
3232
name = "build_extension",
3333
cmd = """
3434
mkdir -p php/ext/google/protobuf/third_party/utf8_range
35-
cp external/utf8_range/* php/ext/google/protobuf/third_party/utf8_range
35+
cp third_party/utf8_range/* php/ext/google/protobuf/third_party/utf8_range
3636
3737
pushd php/ext/google/protobuf
3838
phpize
@@ -46,7 +46,7 @@ genrule(
4646
name = "extension",
4747
srcs = [
4848
":source_files",
49-
"@utf8_range//:utf8_range_srcs",
49+
"//third_party/utf8_range:utf8_range_srcs",
5050
],
5151
outs = ["protobuf.so"],
5252
cmd = """
@@ -157,8 +157,8 @@ pkg_files(
157157
pkg_files(
158158
name = "utf8_range_files",
159159
srcs = [
160-
"@utf8_range//:LICENSE",
161-
"@utf8_range//:utf8_range_srcs",
160+
"//third_party/utf8_range:LICENSE",
161+
"//third_party/utf8_range:utf8_range_srcs",
162162
],
163163
prefix = "third_party/utf8_range",
164164
)

pkg/cc_dist_library.bzl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,11 @@ def _flatten_target_files(targets):
137137
return depset(transitive = [
138138
target.files
139139
for target in targets
140-
# Filter out targets from external workspaces
141-
if target.label.workspace_name == "" or
142-
target.label.workspace_name == "com_google_protobuf"
140+
# Filter out targets from external workspaces. We also filter out
141+
# utf8_range since that has a separate CMake build for now.
142+
if (target.label.workspace_name == "" or
143+
target.label.workspace_name == "com_google_protobuf") and
144+
not target.label.package.startswith("third_party/utf8_range")
143145
])
144146

145147
def _get_transitive_sources(targets, attr, deps):

protobuf_deps.bzl

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,6 @@ def protobuf_deps():
6868
build_file = Label("//:third_party/jsoncpp.BUILD"),
6969
)
7070

71-
if not native.existing_rule("utf8_range"):
72-
_github_archive(
73-
name = "utf8_range",
74-
repo = "https://github.com/protocolbuffers/utf8_range",
75-
commit = "0e378bdb224cc8d4653b0db963b474839c2bb43c",
76-
sha256 = "9b8db33325e5b6105c04369cd04dbbd9186e0577141543714243e66b8f045664",
77-
)
78-
7971
if not native.existing_rule("rules_cc"):
8072
_github_archive(
8173
name = "rules_cc",

python/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,6 @@ py_extension(
203203
"//upb/util:compare",
204204
"//upb/util:def_to_proto",
205205
"//upb/util:required_fields",
206-
"@utf8_range",
206+
"//third_party/utf8_range",
207207
],
208208
)

python/dist/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ pkg_files(
217217

218218
pkg_files(
219219
name = "utf8_range_source_files",
220-
srcs = ["@utf8_range//:utf8_range_srcs"],
220+
srcs = ["//third_party/utf8_range:utf8_range_srcs"],
221221
prefix = "utf8_range",
222222
)
223223

ruby/BUILD.bazel

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ load("@bazel_skylib//lib:selects.bzl", "selects")
66
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
77
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
88
load("@rules_ruby//ruby:defs.bzl", "ruby_library")
9-
load("//build_defs:internal_shell.bzl", "inline_sh_binary")
109
load("//:protobuf.bzl", "internal_ruby_proto_library")
11-
load("//conformance:defs.bzl", "conformance_test")
1210
load("//:protobuf_version.bzl", "PROTOBUF_RUBY_VERSION")
11+
load("//conformance:defs.bzl", "conformance_test")
1312

1413
################################################################################
1514
# Ruby Runtime
@@ -100,8 +99,8 @@ ruby_library(
10099
genrule(
101100
name = "jruby_release",
102101
srcs = [
103-
"@utf8_range//:utf8_range_srcs",
104-
"@utf8_range//:LICENSE",
102+
"//third_party/utf8_range:utf8_range_srcs",
103+
"//third_party/utf8_range:LICENSE",
105104
"//ruby/lib/google:copy_jar",
106105
"//ruby/lib/google:dist_files",
107106
"//ruby/ext/google/protobuf_c:dist_files",
@@ -116,7 +115,7 @@ genrule(
116115
cp --parents -L "$$src" tmp
117116
done
118117
mkdir -p "tmp/ruby/ext/google/protobuf_c/third_party/utf8_range"
119-
for utf in $(execpaths @utf8_range//:utf8_range_srcs) $(execpath @utf8_range//:LICENSE); do
118+
for utf in $(execpaths //third_party/utf8_range:utf8_range_srcs) $(execpath //third_party/utf8_range:LICENSE); do
120119
mv "tmp/$$utf" "tmp/ruby/ext/google/protobuf_c/third_party/utf8_range"
121120
done
122121
for wkt in $(execpaths //:well_known_ruby_protos); do
@@ -139,8 +138,8 @@ genrule(
139138
genrule(
140139
name = "ruby_release",
141140
srcs = [
142-
"@utf8_range//:utf8_range_srcs",
143-
"@utf8_range//:LICENSE",
141+
"//third_party/utf8_range:utf8_range_srcs",
142+
"//third_party/utf8_range:LICENSE",
144143
"//:well_known_ruby_protos",
145144
"//ruby/ext/google/protobuf_c:dist_files",
146145
"//ruby/lib/google:dist_files",
@@ -154,7 +153,7 @@ genrule(
154153
cp --parents -L "$$src" "tmp"
155154
done
156155
mkdir -p "tmp/ruby/ext/google/protobuf_c/third_party/utf8_range"
157-
for utf in $(execpaths @utf8_range//:utf8_range_srcs) $(execpath @utf8_range//:LICENSE); do
156+
for utf in $(execpaths //third_party/utf8_range:utf8_range_srcs) $(execpath //third_party/utf8_range:LICENSE); do
158157
mv "tmp/$$utf" "tmp/ruby/ext/google/protobuf_c/third_party/utf8_range"
159158
done
160159
for wkt in $(execpaths //:well_known_ruby_protos); do

ruby/Rakefile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,7 @@ task :copy_third_party do
7373
unless File.exist? 'ext/google/protobuf_c/third_party/utf8_range'
7474
FileUtils.mkdir_p 'ext/google/protobuf_c/third_party/utf8_range'
7575
# We need utf8_range in-tree.
76-
if ENV['BAZEL'] == 'true'
77-
utf8_root = '../external/utf8_range'
78-
else
79-
utf8_root = '../third_party/utf8_range'
80-
end
76+
utf8_root = '../third_party/utf8_range'
8177
%w[
8278
utf8_range.h naive.c range2-neon.c range2-neon.c range2-sse.c LICENSE
8379
].each do |file|

ruby/ext/google/protobuf_c/BUILD.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ cc_library(
5353
"//conditions:default": [],
5454
}),
5555
deps = [
56+
"//third_party/utf8_range",
5657
"@rules_ruby//ruby/runtime:headers",
57-
"@utf8_range",
5858
],
5959
alwayslink = True,
6060
)
@@ -79,7 +79,7 @@ cc_library(
7979
"//conditions:default": [],
8080
}),
8181
deps = [
82-
"@utf8_range",
82+
"//third_party/utf8_range",
8383
],
8484
)
8585

0 commit comments

Comments
 (0)