Skip to content

Commit

Permalink
Use Bzlmod instead of http_jar in WORKSPACE file
Browse files Browse the repository at this point in the history
Signed-off-by: Sara Adams <[email protected]>
  • Loading branch information
saraadams committed Dec 1, 2023
1 parent dd508bc commit 1ed5f43
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 110 deletions.
38 changes: 38 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,3 +1,41 @@
"""Bazel build and test dependencies."""

# =========================================
# Bazel module dependencies
# =========================================

bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "platforms", version = "0.0.8")
bazel_dep(name = "rules_jvm_external", version = "5.3")
bazel_dep(name = "rules_proto", version = "5.3.0-21.7")

# =========================================
# Java dependencies
# =========================================
maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven")

maven.install(
artifacts = [
"com.google.code.findbugs:jsr305:3.0.2",
"com.google.code.gson:gson:2.10.1",
"com.google.errorprone:error_prone_annotations:2.23.0",
"com.google.googlejavaformat:google-java-format:1.18.1",
"com.google.guava:failureaccess:1.0.2",
"com.google.guava:guava:32.1.3-jre",
"com.google.j2objc:j2objc-annotations:2.8",
"com.google.truth:truth:1.1.5",
"com.google.truth.extensions:truth-java8-extension:1.1.5",
"commons-cli:commons-cli:1.5.0",
"junit:junit:4.13.2",
"net.bytebuddy:byte-buddy-agent:1.12.13",
"net.bytebuddy:byte-buddy:1.12.13",
"org.hamcrest:hamcrest-core:2.2",
"org.mockito:mockito-core:4.6.1",
"org.objenesis:objenesis:3.3",
],
repositories = [
"https://repo1.maven.org/maven2",
],
)

use_repo(maven, "maven")
96 changes: 1 addition & 95 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,91 +2,7 @@ workspace(
name = "com_engflow_bazel_invocation_analyzer",
)

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file", "http_jar")

http_jar(
name = "byte_buddy",
sha256 = "6a688bff5b0da4f4f26a672be6623efef94837f1dd49ef2d1f5f6fe07c06699c",
url = "https://repo1.maven.org/maven2/net/bytebuddy/byte-buddy/1.12.13/byte-buddy-1.12.13.jar",
)

http_jar(
name = "commons_cli",
sha256 = "bc8bb01fc0fad250385706e20f927ddcff6173f6339b387dc879237752567ac6",
url = "https://repo1.maven.org/maven2/commons-cli/commons-cli/1.5.0/commons-cli-1.5.0.jar",
)

http_jar(
name = "error_prone_annotations",
sha256 = "ec6f39f068b6ff9ac323c68e28b9299f8c0a80ca512dccb1d4a70f40ac3ec054",
url = "https://repo1.maven.org/maven2/com/google/errorprone/error_prone_annotations/2.23.0/error_prone_annotations-2.23.0.jar",
)

http_jar(
name = "failureaccess",
sha256 = "8a8f81cf9b359e3f6dfa691a1e776985c061ef2f223c9b2c80753e1b458e8064",
url = "https://repo1.maven.org/maven2/com/google/guava/failureaccess/1.0.2/failureaccess-1.0.2.jar",
)

http_jar(
name = "gson",
sha256 = "4241c14a7727c34feea6507ec801318a3d4a90f070e4525681079fb94ee4c593",
url = "https://repo1.maven.org/maven2/com/google/code/gson/gson/2.10.1/gson-2.10.1.jar",
)

http_jar(
name = "guava",
sha256 = "6d4e2b5a118aab62e6e5e29d185a0224eed82c85c40ac3d33cf04a270c3b3744",
url = "https://repo1.maven.org/maven2/com/google/guava/guava/32.1.3-jre/guava-32.1.3-jre.jar",
)

http_jar(
name = "hamcrest",
sha256 = "094f5d92b4b7d9c8a2bf53cc69d356243ae89c3499457bcb4b92f7ed3bf95879",
url = "https://repo1.maven.org/maven2/org/hamcrest/hamcrest-core/2.2/hamcrest-core-2.2.jar",
)

http_jar(
name = "j2objc_annotations",
sha256 = "f02a95fa1a5e95edb3ed859fd0fb7df709d121a35290eff8b74dce2ab7f4d6ed",
url = "https://repo1.maven.org/maven2/com/google/j2objc/j2objc-annotations/2.8/j2objc-annotations-2.8.jar",
)

http_jar(
name = "jsr305",
sha256 = "766ad2a0783f2687962c8ad74ceecc38a28b9f72a2d085ee438b7813e928d0c7",
url = "https://repo1.maven.org/maven2/com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar",
)

http_jar(
name = "junit",
sha256 = "8e495b634469d64fb8acfa3495a065cbacc8a0fff55ce1e31007be4c16dc57d3",
url = "https://repo1.maven.org/maven2/junit/junit/4.13.2/junit-4.13.2.jar",
)

http_jar(
name = "mockito",
sha256 = "ee3b91cdf4c23cff92960c32364371c683ee6415f1ec4678317bcea79c9f9819",
url = "https://repo1.maven.org/maven2/org/mockito/mockito-core/4.6.1/mockito-core-4.6.1.jar",
)

http_jar(
name = "objenesis",
sha256 = "02dfd0b0439a5591e35b708ed2f5474eb0948f53abf74637e959b8e4ef69bfeb",
url = "https://repo1.maven.org/maven2/org/objenesis/objenesis/3.3/objenesis-3.3.jar",
)

http_jar(
name = "truth",
sha256 = "7f6d50d6f43a102942ef2c5a05f37a84f77788bb448cf33cceebf86d34e575c0",
url = "https://repo1.maven.org/maven2/com/google/truth/truth/1.1.5/truth-1.1.5.jar",
)

http_jar(
name = "truth_java8_extension",
sha256 = "9e3c437ef76c0028d1c87d9f81d599301459333cfb3b50e5bf815ed712745140",
url = "https://repo1.maven.org/maven2/com/google/truth/extensions/truth-java8-extension/1.1.5/truth-java8-extension-1.1.5.jar",
)
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_file")

# Dependencies required for linting

Expand Down Expand Up @@ -140,13 +56,3 @@ http_file(
"https://github.com/bazelbuild/buildtools/releases/download/5.1.0/buildifier-windows-amd64.exe",
],
)

## Java files
http_jar(
name = "google_java_format",
sha256 = "bed3bad433f7df427700648f24b798db3c338d6dcb2cc5c08bc542b55610f910",
urls = [
"https://storage.googleapis.com/engflow-tools-public/github.com/google/google-java-format/releases/download/v1.18.1/google-java-format-1.18.1-all-deps.jar",
"https://github.com/google/google-java-format/releases/download/v1.18.1/google-java-format-1.18.1-all-deps.jar",
],
)
2 changes: 1 addition & 1 deletion third_party/commons-cli/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ java_library(
name = "commons_cli",
visibility = ["//visibility:public"],
exports = [
"@commons_cli//jar",
"@maven//:commons_cli_commons_cli",
],
)
2 changes: 1 addition & 1 deletion third_party/google-java-format/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ java_binary(
"--add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
],
main_class = "com.google.googlejavaformat.java.Main",
runtime_deps = ["@google_java_format//jar"],
runtime_deps = ["@maven//:com_google_googlejavaformat_google_java_format"],
)
2 changes: 1 addition & 1 deletion third_party/gson/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ java_library(
name = "gson",
visibility = ["//visibility:public"],
exports = [
"@gson//jar",
"@maven//:com_google_code_gson_gson",
],
)
8 changes: 4 additions & 4 deletions third_party/guava/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ java_library(
name = "guava",
visibility = ["//visibility:public"],
exports = [
"@error_prone_annotations//jar",
"@failureaccess//jar",
"@guava//jar",
"@j2objc_annotations//jar",
"@maven//:com_google_errorprone_error_prone_annotations",
"@maven//:com_google_guava_failureaccess",
"@maven//:com_google_guava_guava",
"@maven//:com_google_j2objc_j2objc_annotations",
],
runtime_deps = [
"//third_party/jsr305",
Expand Down
2 changes: 1 addition & 1 deletion third_party/jsr305/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ java_library(
name = "jsr305",
visibility = ["//visibility:public"],
exports = [
"@jsr305//jar",
"@maven//:com_google_code_findbugs_jsr305",
],
)
4 changes: 2 additions & 2 deletions third_party/junit/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ java_library(
testonly = 1,
visibility = ["//visibility:public"],
exports = [
"@hamcrest//jar",
"@junit//jar",
"@maven//:junit_junit",
"@maven//:org_hamcrest_hamcrest_core",
],
)
7 changes: 4 additions & 3 deletions third_party/mockito/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ java_library(
testonly = 1,
visibility = ["//visibility:public"],
exports = [
"@byte_buddy//jar",
"@mockito//jar",
"@objenesis//jar",
"@maven//:net_bytebuddy_byte_buddy",
"@maven//:net_bytebuddy_byte_buddy_agent",
"@maven//:org_mockito_mockito_core",
"@maven//:org_objenesis_objenesis",
],
)
4 changes: 2 additions & 2 deletions third_party/truth/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ java_library(
testonly = 1,
visibility = ["//visibility:public"],
exports = [
"@truth//jar",
"@truth_java8_extension//jar",
"@maven//:com_google_truth_extensions_truth_java8_extension",
"@maven//:com_google_truth_truth",
],
runtime_deps = [
"//third_party/guava",
Expand Down

0 comments on commit 1ed5f43

Please sign in to comment.