Skip to content

Commit 6686849

Browse files
erock2112SkCQ
authored andcommitted
[bazel] Move a few more items from WORKSPACE to MODULE.bazel
Bug: b/458681039 Change-Id: I33643b37aa5d1ddd265c74462cd4d6066dad9d5d Reviewed-on: https://skia-review.googlesource.com/c/buildbot/+/1122261 Commit-Queue: Eric Boren <[email protected]> Auto-Submit: Eric Boren <[email protected]> Reviewed-by: Kaylee Lubick <[email protected]> Commit-Queue: Kaylee Lubick <[email protected]>
1 parent 4b1b402 commit 6686849

File tree

7 files changed

+100
-90
lines changed

7 files changed

+100
-90
lines changed

MODULE.bazel

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -570,3 +570,75 @@ cipd.package(
570570
tag = "version:[email protected]",
571571
)
572572
use_repo(cipd, "cpython3_amd64_linux")
573+
574+
####################################################################################################
575+
# protoc.
576+
####################################################################################################
577+
578+
# The following archives were taken from
579+
# https://github.com/protocolbuffers/protobuf/releases/tag/v21.12.
580+
PROTOC_BUILD_FILE_CONTENT = """
581+
exports_files(["bin/protoc"], visibility = ["//visibility:public"])
582+
"""
583+
584+
http_archive(
585+
name = "protoc_linux_x64",
586+
build_file_content = PROTOC_BUILD_FILE_CONTENT,
587+
sha256 = "3a4c1e5f2516c639d3079b1586e703fc7bcfa2136d58bda24d1d54f949c315e8",
588+
url = "https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-linux-x86_64.zip",
589+
)
590+
591+
http_archive(
592+
name = "protoc_mac_x64",
593+
build_file_content = PROTOC_BUILD_FILE_CONTENT,
594+
sha256 = "9448ff40278504a7ae5139bb70c962acc78c32d8fc54b4890a55c14c68b9d10a",
595+
url = "https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-osx-x86_64.zip",
596+
)
597+
598+
####################################################################################################
599+
# pgadapter.
600+
####################################################################################################
601+
http_archive(
602+
name = "pgadapter",
603+
build_file_content = """
604+
filegroup(
605+
name = "all_files",
606+
srcs = glob(["**/*"]),
607+
visibility = ["//visibility:public"]
608+
)
609+
""",
610+
sha256 = "2dbb655dddc113eb14659e121839a9d3a5de34544ce88a1dd4dd88c23d436ae3",
611+
urls = ["https://storage.googleapis.com/pgadapter-jar-releases/pgadapter-v0.47.1.tar.gz"],
612+
)
613+
614+
####################################################################################################
615+
# CockroachDB (used as an "emulator" for tests).
616+
####################################################################################################
617+
618+
http_archive(
619+
name = "cockroachdb_linux",
620+
build_file_content = """
621+
filegroup(
622+
name = "all_files",
623+
srcs = glob(["**/*"]),
624+
visibility = ["//visibility:public"]
625+
)
626+
""",
627+
# https://www.cockroachlabs.com/docs/v21.1/install-cockroachdb-linux does not currently
628+
# provide SHA256 signatures. kjlubick@ downloaded this file and computed this sha256 signature.
629+
sha256 = "05293e76dfb6443790117b6c6c05b1152038b49c83bd4345589e15ced8717be3",
630+
strip_prefix = "cockroach-v21.1.9.linux-amd64",
631+
url = "https://binaries.cockroachdb.com/cockroach-v21.1.9.linux-amd64.tgz",
632+
)
633+
634+
####################################################################################################
635+
# bazel-toolchains rbe_configs_gen (prebuilt).
636+
####################################################################################################
637+
638+
http_file(
639+
name = "rbe_configs_gen_linux_amd64",
640+
downloaded_file_path = "rbe_configs_gen",
641+
executable = True,
642+
sha256 = "1206e8a79b41cb22524f73afa4f4ee648478f46ef6990d78e7cc953665a1db89",
643+
url = "https://github.com/bazelbuild/bazel-toolchains/releases/download/v5.1.2/rbe_configs_gen_linux_amd64",
644+
)

MODULE.bazel.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

WORKSPACE

Lines changed: 1 addition & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@ workspace(
22
name = "skia_infra",
33
)
44

5-
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
6-
load("//bazel:gcs_mirror.bzl", "gcs_mirror_url")
5+
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
76

87
# Read the instructions in //bazel/rbe/generated/README.md before updating this repository.
98
#
@@ -42,45 +41,6 @@ load("//bazel/external:google_cloud_sdk.bzl", "google_cloud_sdk")
4241

4342
google_cloud_sdk(name = "google_cloud_sdk")
4443

45-
##################################################
46-
# CockroachDB (used as an "emulator" for tests). #
47-
##################################################
48-
49-
http_archive(
50-
name = "cockroachdb_linux",
51-
build_file_content = """
52-
filegroup(
53-
name = "all_files",
54-
srcs = glob(["**/*"]),
55-
visibility = ["//visibility:public"]
56-
)
57-
""",
58-
# https://www.cockroachlabs.com/docs/v21.1/install-cockroachdb-linux does not currently
59-
# provide SHA256 signatures. kjlubick@ downloaded this file and computed this sha256 signature.
60-
sha256 = "05293e76dfb6443790117b6c6c05b1152038b49c83bd4345589e15ced8717be3",
61-
strip_prefix = "cockroach-v21.1.9.linux-amd64",
62-
urls = gcs_mirror_url(
63-
sha256 = "05293e76dfb6443790117b6c6c05b1152038b49c83bd4345589e15ced8717be3",
64-
url = "https://binaries.cockroachdb.com/cockroach-v21.1.9.linux-amd64.tgz",
65-
),
66-
)
67-
68-
##################################################
69-
# PGAdaptor #
70-
##################################################
71-
http_archive(
72-
name = "pgadapter",
73-
build_file_content = """
74-
filegroup(
75-
name = "all_files",
76-
srcs = glob(["**/*"]),
77-
visibility = ["//visibility:public"]
78-
)
79-
""",
80-
sha256 = "2dbb655dddc113eb14659e121839a9d3a5de34544ce88a1dd4dd88c23d436ae3",
81-
urls = ["https://storage.googleapis.com/pgadapter-jar-releases/pgadapter-v0.47.1.tar.gz"],
82-
)
83-
8444
# #################################################################################
8545
# # Google Chrome and Fonts (needed for Karma and Puppeteer tests, respectively). #
8646
# #################################################################################
@@ -89,49 +49,3 @@ filegroup(
8949
load("//bazel/external:google_chrome.bzl", "google_chrome")
9050

9151
google_chrome(name = "google_chrome")
92-
93-
################################################
94-
# bazel-toolchains rbe_configs_gen (prebuilt). #
95-
################################################
96-
97-
http_file(
98-
name = "rbe_configs_gen_linux_amd64",
99-
downloaded_file_path = "rbe_configs_gen",
100-
executable = True,
101-
sha256 = "1206e8a79b41cb22524f73afa4f4ee648478f46ef6990d78e7cc953665a1db89",
102-
urls = gcs_mirror_url(
103-
ext = "",
104-
sha256 = "1206e8a79b41cb22524f73afa4f4ee648478f46ef6990d78e7cc953665a1db89",
105-
url = "https://github.com/bazelbuild/bazel-toolchains/releases/download/v5.1.2/rbe_configs_gen_linux_amd64",
106-
),
107-
)
108-
109-
###########
110-
# protoc. #
111-
###########
112-
113-
# The following archives were taken from
114-
# https://github.com/protocolbuffers/protobuf/releases/tag/v21.12.
115-
PROTOC_BUILD_FILE_CONTENT = """
116-
exports_files(["bin/protoc"], visibility = ["//visibility:public"])
117-
"""
118-
119-
http_archive(
120-
name = "protoc_linux_x64",
121-
build_file_content = PROTOC_BUILD_FILE_CONTENT,
122-
sha256 = "3a4c1e5f2516c639d3079b1586e703fc7bcfa2136d58bda24d1d54f949c315e8",
123-
urls = gcs_mirror_url(
124-
sha256 = "3a4c1e5f2516c639d3079b1586e703fc7bcfa2136d58bda24d1d54f949c315e8",
125-
url = "https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-linux-x86_64.zip",
126-
),
127-
)
128-
129-
http_archive(
130-
name = "protoc_mac_x64",
131-
build_file_content = PROTOC_BUILD_FILE_CONTENT,
132-
sha256 = "9448ff40278504a7ae5139bb70c962acc78c32d8fc54b4890a55c14c68b9d10a",
133-
urls = gcs_mirror_url(
134-
sha256 = "9448ff40278504a7ae5139bb70c962acc78c32d8fc54b4890a55c14c68b9d10a",
135-
url = "https://github.com/protocolbuffers/protobuf/releases/download/v21.12/protoc-21.12-osx-x86_64.zip",
136-
),
137-
)

bazel/external/cockroachdb/cockroachdb.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ func FindCockroach() (string, error) {
1818
return exec.LookPath("cockroach")
1919
}
2020
if runtime.GOOS == "linux" {
21-
return filepath.Join(bazel.RunfilesDir(), "external", "cockroachdb_linux", "cockroach"), nil
21+
return filepath.Join(bazel.RunfilesDir(), "external", "_main~_repo_rules~cockroachdb_linux", "cockroach"), nil
2222
}
2323
return "", skerr.Fmt("unsupported runtime.GOOS: %q", runtime.GOOS)
2424
}

bazel/external/pgadapter_jar/BUILD.bazel

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
load("@rules_go//go:def.bzl", "go_library")
2+
load("//bazel/go:go_test.bzl", "go_test")
23

34
go_library(
45
name = "pgadapter_jar",
@@ -8,3 +9,10 @@ go_library(
89
visibility = ["//visibility:public"],
910
deps = ["//bazel/go/bazel"],
1011
)
12+
13+
go_test(
14+
name = "pgadapter_jar_test",
15+
srcs = ["pgadapter_test.go"],
16+
embed = [":pgadapter_jar"],
17+
deps = ["@com_github_stretchr_testify//require"],
18+
)

bazel/external/pgadapter_jar/pgadapter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ import (
88

99
// FindPGAdapterJar returns the path to the pgadapter jar from the bazel runtime directory.
1010
func FindPGAdapterJar() string {
11-
return filepath.Join(bazel.RunfilesDir(), "external", "pgadapter", "pgadapter.jar")
11+
return filepath.Join(bazel.RunfilesDir(), "external", "_main~_repo_rules~pgadapter", "pgadapter.jar")
1212
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package pgadapter_jar
2+
3+
import (
4+
"os"
5+
"testing"
6+
7+
"github.com/stretchr/testify/require"
8+
)
9+
10+
func TestFindPGAdapterJar(t *testing.T) {
11+
path := FindPGAdapterJar()
12+
fileInfo, err := os.Stat(path)
13+
require.NoError(t, err)
14+
require.False(t, fileInfo.IsDir())
15+
require.NotZero(t, fileInfo.Size())
16+
}

0 commit comments

Comments
 (0)