Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for bzlmod #287

Closed
wants to merge 14 commits into from
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ bazel-*
*.pyc
.ijwb
/.bazelrc.user
MODULE.bazel.lock
4 changes: 2 additions & 2 deletions java/com/google/copybara/buildozer/testing/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ licenses(["notice"])
genrule(
name = "normalised_buildozer",
testonly = 1,
srcs = ["@buildtools//buildozer"],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

buildtools isn't in the bcr yet, this repo vendors the downloads directly from that repo's releases

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We currently automatically vendor buildtools from HEAD because we had needs to be pretty close to the edge. I wonder if this can be treated like io_bazel?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the problem is that pulling in buildtools that way would require pulling rules_go and resolving the go.mod transitive dependencies of that repo as well.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. I will look into merging this provided we don't end up with too much version skew for build_tools vs the internal monorepo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sounds good, i don't feel like there are a ton of changes there enough to cause major drift

srcs = ["@buildifier_prebuilt//:buildozer"],
outs = ["buildozer"],
cmd = "cp $(SRCS) $@",
)

genrule(
name = "normalised_buildifier",
testonly = 1,
srcs = ["@buildtools//buildifier"],
srcs = ["@buildifier_prebuilt//:buildifier"],
outs = ["buildifier"],
cmd = "cp $(SRCS) $@",
)
Expand Down
2 changes: 1 addition & 1 deletion javatests/com/google/copybara/format/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ licenses(["notice"])
genrule(
name = "normalised_buildifier",
testonly = 1,
srcs = ["@buildtools//buildifier"],
srcs = ["@buildifier_prebuilt//:buildifier"],
outs = ["buildifier"],
cmd = "cp $(SRCS) $@",
)
Expand Down
2 changes: 1 addition & 1 deletion javatests/com/google/copybara/onboard/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ licenses(["notice"])
genrule(
name = "normalised_buildifier",
testonly = 1,
srcs = ["@buildtools//buildifier"],
srcs = ["@buildifier_prebuilt//:buildifier"],
outs = ["buildifier"],
cmd = "cp $(SRCS) $@",
)
Expand Down
64 changes: 32 additions & 32 deletions third_party/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,39 +15,39 @@ package(
java_library(
name = "guava",
exports = [
"@maven//:com_google_guava_failureaccess",
"@maven//:com_google_guava_guava",
"@copybara_maven//:com_google_guava_failureaccess",
"@copybara_maven//:com_google_guava_guava",
],
)

java_library(
name = "guava_testlib",
testonly = 1,
exports = [
"@maven//:com_google_guava_guava_testlib",
"@copybara_maven//:com_google_guava_guava_testlib",
],
)

java_library(
name = "apache_commons_compress",
exports = [
"@maven//:org_apache_commons_commons_compress",
"@copybara_maven//:org_apache_commons_commons_compress",
],
)

java_library(
name = "autocommon",
exports = [
"@maven//:com_google_auto_auto_common",
"@copybara_maven//:com_google_auto_auto_common",
],
)

java_plugin(
name = "autovalue_plugin",
processor_class = "com.google.auto.value.processor.AutoValueProcessor",
deps = [
"@maven//:com_google_auto_value_auto_value",
"@maven//:com_google_auto_value_auto_value_annotations",
"@copybara_maven//:com_google_auto_value_auto_value",
"@copybara_maven//:com_google_auto_value_auto_value_annotations",
],
)

Expand All @@ -59,8 +59,8 @@ java_library(
# TODO(matvore): What to export to give access to @AutoValue annotation
# without depending on the processor at runtime?
exports = [
"@maven//:com_google_auto_value_auto_value",
"@maven//:com_google_auto_value_auto_value_annotations",
"@copybara_maven//:com_google_auto_value_auto_value",
"@copybara_maven//:com_google_auto_value_auto_value_annotations",
],
)

Expand All @@ -74,30 +74,30 @@ java_library(
java_library(
name = "jimfs",
exports = [
"@maven//:com_google_jimfs_jimfs",
"@copybara_maven//:com_google_jimfs_jimfs",
],
)

java_library(
name = "junit",
testonly = 1,
exports = [
"@maven//:junit_junit",
"@copybara_maven//:junit_junit",
],
)

java_library(
name = "testparameterinjector",
testonly = 1,
exports = [
"@maven//:com_google_testparameterinjector_test_parameter_injector",
"@copybara_maven//:com_google_testparameterinjector_test_parameter_injector",
],
)

java_library(
name = "re2j",
exports = [
"@maven//:com_google_re2j_re2j",
"@copybara_maven//:com_google_re2j_re2j",
],
)

Expand All @@ -112,54 +112,54 @@ java_library(
name = "truth",
testonly = 1,
exports = [
"@maven//:com_google_truth_extensions_truth_java8_extension",
"@maven//:com_google_truth_truth",
"@maven//:com_googlecode_java_diff_utils_diffutils",
"@copybara_maven//:com_google_truth_extensions_truth_java8_extension",
"@copybara_maven//:com_google_truth_truth",
"@copybara_maven//:com_googlecode_java_diff_utils_diffutils",
],
)

java_library(
name = "google_code_gson",
exports = [
"@maven//:com_google_code_gson_gson",
"@copybara_maven//:com_google_code_gson_gson",
],
)

java_library(
name = "google_http_client",
exports = [
":google_code_gson",
"@maven//:com_google_http_client_google_http_client",
"@maven//:com_google_http_client_google_http_client_gson",
"@maven//:commons_codec_commons_codec",
"@copybara_maven//:com_google_http_client_google_http_client",
"@copybara_maven//:com_google_http_client_google_http_client_gson",
"@copybara_maven//:commons_codec_commons_codec",
],
)

java_library(
name = "google_http_client_test",
testonly = 1,
exports = [
"@maven//:com_google_http_client_google_http_client_test",
"@copybara_maven//:com_google_http_client_google_http_client_test",
],
)

java_library(
name = "mockito",
testonly = 1,
exports = [
"@maven//:org_mockito_mockito_core",
"@copybara_maven//:org_mockito_mockito_core",
],
runtime_deps = [
"@maven//:net_bytebuddy_byte_buddy",
"@maven//:net_bytebuddy_byte_buddy_agent",
"@maven//:org_objenesis_objenesis",
"@copybara_maven//:net_bytebuddy_byte_buddy",
"@copybara_maven//:net_bytebuddy_byte_buddy_agent",
"@copybara_maven//:org_objenesis_objenesis",
],
)

java_library(
name = "jsr305",
exports = [
"@maven//:com_google_code_findbugs_jsr305",
"@copybara_maven//:com_google_code_findbugs_jsr305",
],
)

Expand All @@ -176,10 +176,10 @@ java_library(
java_library(
name = "flogger",
exports = [
"@maven//:com_google_flogger_flogger",
"@copybara_maven//:com_google_flogger_flogger",
],
runtime_deps = [
"@maven//:com_google_flogger_flogger_system_backend",
"@copybara_maven//:com_google_flogger_flogger_system_backend",
],
)

Expand All @@ -201,28 +201,28 @@ java_library(
java_library(
name = "tomlj",
exports = [
"@maven//:org_tomlj_tomlj",
"@copybara_maven//:org_tomlj_tomlj",
],
)

java_library(
name = "jsoup",
exports = [
"@maven//:org_jsoup_jsoup",
"@copybara_maven//:org_jsoup_jsoup",
],
)

java_library(
name = "sun_mail",
exports = [
"@maven//:com_sun_mail_javax_mail",
"@copybara_maven//:com_sun_mail_javax_mail",
],
)

java_library(
name = "protobuf_lite",
exports = [
"@maven//:com_google_protobuf_protobuf_lite",
"@copybara_maven//:com_google_protobuf_protobuf_lite",
],
)

Expand Down
2 changes: 1 addition & 1 deletion third_party/bazel/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ package(
java_library(
name = "shell",
srcs = glob(["main/**/*.java"]),
deps = ["@maven//:com_google_guava_guava"],
deps = ["@copybara_maven//:com_google_guava_guava"],
)