Skip to content

Commit 4128b19

Browse files
authored
initial prep for bcr (#26)
1 parent 8cea776 commit 4128b19

File tree

10 files changed

+78
-89
lines changed

10 files changed

+78
-89
lines changed

.bazelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
common --lockfile_mode=off

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.4.0
1+
7.4.1

MODULE.bazel

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright (c) 2025, Salesforce, Inc.
2+
# SPDX-License-Identifier: Apache-2
3+
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
bazel_dep(name = "rules_pkg", version = "0.10.1")
17+
bazel_dep(name = "rules_oci", version = "2.2.0")
18+
bazel_dep(name = "rules_go", version = "0.50.1")

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ You can pass `javacopts` when building the uber junit test binary using `uber_ja
116116
### go_docker_compose_test
117117

118118
```
119-
(cd examples && bazel test --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 go-test-image-test)
119+
(cd examples && bazel test --platforms=@rules_go//go/toolchain:linux_amd64 go-test-image-test)
120120
```
121121
122122
In this example, the test source files, dependencies and test image base are passed into the macro. The macro builds a binary containing the test source files and dependencies which are executed as part of the docker-compose test.

docker_compose_test/docker_compose_test.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515

1616
load("@rules_pkg//:pkg.bzl", "pkg_tar")
1717
load("@repo_absolute_path//:build_root.bzl", "BUILD_WORKSPACE_DIRECTORY")
18-
load("@io_bazel_rules_go//go:def.bzl", "go_test")
18+
load("@rules_go//go:def.bzl", "go_test")
1919
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_load")
2020

2121
common_tags = [

examples/.bazelrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
common --test_output=errors
22
common --verbose_explanations
3+
common --lockfile_mode=off

examples/.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.4.0
1+
7.4.1

examples/MODULE.bazel

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Copyright (c) 2025, Salesforce, Inc.
2+
# SPDX-License-Identifier: Apache-2
3+
4+
# Licensed under the Apache License, Version 2.0 (the "License");
5+
# you may not use this file except in compliance with the License.
6+
# You may obtain a copy of the License at
7+
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
bazel_dep(name = "rules_oci", version = "2.2.0")
17+
bazel_dep(name = "platforms", version = "0.0.10")
18+
bazel_dep(name = "rules_jvm_external", version = "6.2")
19+
bazel_dep(name = "rules_go", version = "0.50.1")
20+
21+
oci = use_extension("@rules_oci//oci:extensions.bzl", "oci")
22+
oci.pull(
23+
name = "openjdk",
24+
digest = "sha256:29c44ad7bb159a29a4458b74e8d37c1995cb8dc32abdd35e6d3e3d493e682d10",
25+
image = "openjdk",
26+
platforms = [
27+
"linux/amd64",
28+
"linux/arm64/v8",
29+
],
30+
)
31+
oci.pull(
32+
name = "ubuntu",
33+
digest = "sha256:278628f08d4979fb9af9ead44277dbc9c92c2465922310916ad0c46ec9999295",
34+
image = "ubuntu",
35+
platforms = [
36+
"linux/amd64",
37+
"linux/arm64/v8",
38+
],
39+
)
40+
use_repo(oci, "openjdk", "openjdk_linux_amd64", "openjdk_linux_arm64_v8", "ubuntu", "ubuntu_linux_amd64", "ubuntu_linux_arm64_v8")
41+
42+
maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")
43+
maven.install(
44+
artifacts = [
45+
"org.junit.jupiter:junit-jupiter-api:5.10.1",
46+
"org.junit.platform:junit-platform-console-standalone:1.10.0",
47+
],
48+
lock_file = "//:maven_install.json",
49+
repositories = [
50+
"https://repo1.maven.org/maven2",
51+
],
52+
)
53+
use_repo(maven, "maven")

examples/WORKSPACE

Lines changed: 0 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -13,89 +13,14 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16-
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
17-
1816
local_repository(
1917
name="rules_docker_compose_test",
2018
path= "..",
2119
)
2220

23-
http_archive(
24-
name = "rules_oci",
25-
sha256 = "1bd16e455278d523f01326e0c3964cd64d7840a7e99cdd6e2617e59f698f3504",
26-
strip_prefix = "rules_oci-2.2.0",
27-
url = "https://github.com/bazel-contrib/rules_oci/releases/download/v2.2.0/rules_oci-v2.2.0.tar.gz",
28-
)
29-
30-
RULES_JVM_EXTERNAL_TAG = "6.0"
31-
RULES_JVM_EXTERNAL_SHA = "85fd6bad58ac76cc3a27c8e051e4255ff9ccd8c92ba879670d195622e7c0a9b7"
32-
33-
http_archive(
34-
name = "rules_jvm_external",
35-
strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG,
36-
sha256 = RULES_JVM_EXTERNAL_SHA,
37-
url = "https://github.com/bazelbuild/rules_jvm_external/releases/download/%s/rules_jvm_external-%s.tar.gz" % (RULES_JVM_EXTERNAL_TAG, RULES_JVM_EXTERNAL_TAG)
38-
)
39-
40-
load("@rules_oci//oci:dependencies.bzl", "rules_oci_dependencies")
41-
rules_oci_dependencies()
42-
43-
load("@rules_oci//oci:repositories.bzl", "oci_register_toolchains")
44-
oci_register_toolchains(name = "oci")
45-
46-
load("@rules_oci//oci:pull.bzl", "oci_pull")
47-
48-
oci_pull(
49-
name = "openjdk",
50-
digest = "sha256:29c44ad7bb159a29a4458b74e8d37c1995cb8dc32abdd35e6d3e3d493e682d10",
51-
image = "openjdk",
52-
platforms = [
53-
"linux/amd64",
54-
"linux/arm64/v8",
55-
],
56-
)
57-
58-
oci_pull(
59-
name = "ubuntu",
60-
digest = "sha256:278628f08d4979fb9af9ead44277dbc9c92c2465922310916ad0c46ec9999295",
61-
image = "ubuntu",
62-
platforms = [
63-
"linux/amd64",
64-
"linux/arm64/v8",
65-
],
66-
)
67-
68-
load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps")
69-
rules_jvm_external_deps()
70-
71-
load("@rules_jvm_external//:setup.bzl", "rules_jvm_external_setup")
72-
rules_jvm_external_setup()
73-
74-
load("@rules_jvm_external//:defs.bzl", "maven_install")
75-
76-
# if the list of dependencies changes run:
77-
# bazel run @unpinned_maven//:pin
78-
maven_install(
79-
artifacts = [
80-
"org.junit.jupiter:junit-jupiter-api:5.10.1",
81-
"org.junit.platform:junit-platform-console-standalone:1.10.0",
82-
],
83-
repositories = [
84-
"https://repo1.maven.org/maven2",
85-
],
86-
maven_install_json = "//:maven_install.json",
87-
)
88-
89-
load("@maven//:defs.bzl", "pinned_maven_install")
90-
pinned_maven_install()
91-
9221
load("@rules_docker_compose_test//:repositories.bzl", "rules_docker_compose_test_repositories")
9322
rules_docker_compose_test_repositories()
9423

9524
load("@rules_docker_compose_test//:setup.bzl", "rules_docker_compose_test_dependencies", "repo_absolute_path")
9625
rules_docker_compose_test_dependencies()
9726
repo_absolute_path(name="repo_absolute_path")
98-
99-
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
100-
go_rules_dependencies()
101-
go_register_toolchains(version = "1.23.0")

repositories.bzl

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,10 @@ def rules_docker_compose_test_repositories():
3636
)
3737

3838
http_archive(
39-
name = "io_bazel_rules_go",
39+
name = "rules_go",
4040
sha256 = "f4a9314518ca6acfa16cc4ab43b0b8ce1e4ea64b81c38d8a3772883f153346b8",
4141
urls = [
4242
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.50.1/rules_go-v0.50.1.zip",
4343
"https://github.com/bazelbuild/rules_go/releases/download/v0.50.1/rules_go-v0.50.1.zip",
4444
],
4545
)
46-
47-
http_archive(
48-
name = "platforms",
49-
urls = [
50-
"https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.10/platforms-0.0.10.tar.gz",
51-
"https://github.com/bazelbuild/platforms/releases/download/0.0.10/platforms-0.0.10.tar.gz",
52-
],
53-
sha256 = "218efe8ee736d26a3572663b374a253c012b716d8af0c07e842e82f238a0a7ee",
54-
)

0 commit comments

Comments
 (0)