Skip to content

Commit

Permalink
Completely remove dependency on https://github.com/google/bazel-common.
Browse files Browse the repository at this point in the history
This CL removes the last few dependencies on bazel-common (mainly the definitions of `jarjar_library` and `javadoc_library` which have now been copied directly into Dagger). This has the following benefits

  * The android sdk is now defined in Dagger's WORKSPACE
  * All maven dependencies should now be defined in Dagger's WORKSPACE

**Background:** We've been in the process of removing bazel-common dependencies for a while due to the confusion of mixing maven dependencies between both Dagger and bazel-common and the hassle of upgrading those dependencies on bazel-common (requires first updating in bazel-common, then updating version of bazel-common in Dagger).

RELNOTES=N/A
PiperOrigin-RevId: 653711935
  • Loading branch information
bcorso authored and Dagger Team committed Jul 18, 2024
1 parent 216a9d2 commit 140e201
Show file tree
Hide file tree
Showing 36 changed files with 914 additions and 84 deletions.
4 changes: 2 additions & 2 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("@google_bazel_common//tools/jarjar:jarjar.bzl", "jarjar_library")
load("@google_bazel_common//tools/javadoc:javadoc.bzl", "javadoc_library")
load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "define_kt_toolchain")
load("@rules_java//java:defs.bzl", "java_library")
load("//tools/jarjar:jarjar.bzl", "jarjar_library")
load("//tools/javadoc:javadoc.bzl", "javadoc_library")

package(default_visibility = ["//visibility:public"])

Expand Down
60 changes: 39 additions & 21 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,16 @@ http_archive(
url = "https://github.com/bazelbuild/rules_java/releases/download/5.3.5/rules_java-5.3.5.tar.gz",
)

#############################
# Load Android Sdk
#############################

android_sdk_repository(
name = "androidsdk",
api_level = 32,
build_tools_version = "32.0.0",
)

####################################################
# Load Protobuf repository (needed by bazel-common)
####################################################
Expand All @@ -78,21 +88,6 @@ rules_proto_dependencies()

rules_proto_toolchains()

#############################
# Load Bazel-Common repository
#############################

http_archive(
name = "google_bazel_common",
sha256 = "82a49fb27c01ad184db948747733159022f9464fc2e62da996fa700594d9ea42",
strip_prefix = "bazel-common-2a6b6406e12208e02b2060df0631fb30919080f3",
urls = ["https://github.com/google/bazel-common/archive/2a6b6406e12208e02b2060df0631fb30919080f3.zip"],
)

load("@google_bazel_common//:workspace_defs.bzl", "google_common_workspace_rules")

google_common_workspace_rules()

#############################
# Load Protobuf dependencies
#############################
Expand Down Expand Up @@ -187,8 +182,20 @@ load("@rules_jvm_external//:defs.bzl", "maven_install")

ANDROID_LINT_VERSION = "30.1.0"

ANT_VERSION = "1.9.6"

ASM_VERSION = "9.6"

AUTO_COMMON_VERSION = "1.2.1"

BYTE_BUDDY_VERSION = "1.9.10"

CHECKER_FRAMEWORK_VERSION = "2.5.3"

ECLIPSE_SISU_VERSION = "0.3.0"

ERROR_PRONE_VERSION = "2.14.0"

# NOTE(bcorso): Even though we set the version here, our Guava version in
# processor code will use whatever version is built into JavaBuilder, which is
# tied to the version of Bazel we're using.
Expand All @@ -198,14 +205,10 @@ GRPC_VERSION = "1.2.0"

INCAP_VERSION = "0.2"

BYTE_BUDDY_VERSION = "1.9.10"

CHECKER_FRAMEWORK_VERSION = "2.5.3"

ERROR_PRONE_VERSION = "2.14.0"

KSP_VERSION = KOTLIN_VERSION + "-1.0.19"

MAVEN_VERSION = "3.3.3"

maven_install(
artifacts = [
"androidx.annotation:annotation:1.1.0",
Expand Down Expand Up @@ -264,16 +267,27 @@ maven_install(
"io.grpc:grpc-protobuf:%s" % GRPC_VERSION,
"jakarta.inject:jakarta.inject-api:2.0.1",
"javax.annotation:javax.annotation-api:1.3.2",
"javax.enterprise:cdi-api:1.0",
"javax.inject:javax.inject:1",
"javax.inject:javax.inject-tck:1",
"junit:junit:4.13",
"net.bytebuddy:byte-buddy:%s" % BYTE_BUDDY_VERSION,
"net.bytebuddy:byte-buddy-agent:%s" % BYTE_BUDDY_VERSION,
"net.ltgt.gradle.incap:incap:%s" % INCAP_VERSION,
"net.ltgt.gradle.incap:incap-processor:%s" % INCAP_VERSION,
"org.apache.ant:ant:%s" % ANT_VERSION,
"org.apache.ant:ant-launcher:%s" % ANT_VERSION,
"org.apache.maven:maven-artifact:%s" % MAVEN_VERSION,
"org.apache.maven:maven-model:%s" % MAVEN_VERSION,
"org.apache.maven:maven-plugin-api:%s" % MAVEN_VERSION,
"org.checkerframework:checker-compat-qual:%s" % CHECKER_FRAMEWORK_VERSION,
"org.checkerframework:dataflow:%s" % CHECKER_FRAMEWORK_VERSION,
"org.checkerframework:javacutil:%s" % CHECKER_FRAMEWORK_VERSION,
"org.codehaus.plexus:plexus-utils:3.0.20",
"org.codehaus.plexus:plexus-classworlds:2.5.2",
"org.codehaus.plexus:plexus-component-annotations:1.5.5",
"org.eclipse.sisu:org.eclipse.sisu.plexus:%s" % ECLIPSE_SISU_VERSION,
"org.eclipse.sisu:org.eclipse.sisu.inject:%s" % ECLIPSE_SISU_VERSION,
"org.hamcrest:hamcrest-core:1.3",
"org.jetbrains.kotlin:kotlin-annotation-processing-embeddable:%s" % KOTLIN_VERSION,
"org.jetbrains.kotlin:kotlin-compiler-embeddable:%s" % KOTLIN_VERSION,
Expand All @@ -282,7 +296,11 @@ maven_install(
"org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.6.2",
"org.jspecify:jspecify:0.3.0",
"org.mockito:mockito-core:2.28.2",
"org.pantsbuild:jarjar:1.7.2",
"org.objenesis:objenesis:1.0",
"org.ow2.asm:asm:%s" % ASM_VERSION,
"org.ow2.asm:asm-tree:%s" % ASM_VERSION,
"org.ow2.asm:asm-commons:%s" % ASM_VERSION,
"org.robolectric:robolectric:4.4",
"org.robolectric:shadows-framework:4.4", # For ActivityController
],
Expand Down
4 changes: 2 additions & 2 deletions gwt/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

load("@rules_java//java:defs.bzl", "java_library")
load("//:build_defs.bzl", "POM_VERSION")
load("//tools:maven.bzl", "pom_file")
load("//tools/maven:maven.bzl", "dagger_pom_file")

package(default_visibility = ["//:src"])

Expand All @@ -41,7 +41,7 @@ java_library(
visibility = ["//visibility:private"],
)

pom_file(
dagger_pom_file(
name = "pom",
artifact_id = "dagger-gwt",
artifact_name = "Dagger GWT",
Expand Down
2 changes: 1 addition & 1 deletion java/dagger/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ load(
"JAVA_RELEASE_MIN",
"POM_VERSION",
)
load("//tools:maven.bzl", "gen_maven_artifact")
load("//tools/maven:maven.bzl", "gen_maven_artifact")

package(default_visibility = ["//:src"])

Expand Down
6 changes: 3 additions & 3 deletions java/dagger/android/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ load(
)
load("//tools:dejetify.bzl", "dejetified_library")
load(
"//tools:maven.bzl",
"//tools/maven:maven.bzl",
"dagger_pom_file",
"gen_maven_artifact",
"pom_file",
)

package(default_visibility = ["//:src"])
Expand Down Expand Up @@ -94,7 +94,7 @@ android_library(
],
)

pom_file(
dagger_pom_file(
name = "legacy-pom",
artifact_id = "dagger-android-legacy",
artifact_name = "Dagger Android Legacy",
Expand Down
2 changes: 1 addition & 1 deletion java/dagger/android/processor/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ load(
"DOCLINT_REFERENCES",
"POM_VERSION",
)
load("//tools:maven.bzl", "gen_maven_artifact")
load("//tools/maven:maven.bzl", "gen_maven_artifact")

package(default_visibility = ["//:src"])

Expand Down
6 changes: 3 additions & 3 deletions java/dagger/android/support/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ load(
)
load("//tools:dejetify.bzl", "dejetified_library")
load(
"//tools:maven.bzl",
"//tools/maven:maven.bzl",
"dagger_pom_file",
"gen_maven_artifact",
"pom_file",
)

package(default_visibility = ["//:src"])
Expand Down Expand Up @@ -95,7 +95,7 @@ android_library(
],
)

pom_file(
dagger_pom_file(
name = "legacy-pom",
artifact_id = "dagger-android-support-legacy",
artifact_name = "Dagger Android Legacy Support",
Expand Down
8 changes: 4 additions & 4 deletions java/dagger/grpc/server/BUILD
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# A framework supporting Dagger-injected gRPC servers.

load("@google_bazel_common//tools/javadoc:javadoc.bzl", "javadoc_library")
load("@rules_java//java:defs.bzl", "java_library")
load(
"//:build_defs.bzl",
"DOCLINT_HTML_AND_SYNTAX",
"DOCLINT_REFERENCES",
"POM_VERSION",
)
load("//tools:maven.bzl", "pom_file")
load("//tools/javadoc:javadoc.bzl", "javadoc_library")
load("//tools/maven:maven.bzl", "dagger_pom_file")

package(default_visibility = ["//:src"])

Expand Down Expand Up @@ -53,14 +53,14 @@ java_library(
],
)

pom_file(
dagger_pom_file(
name = "annotations-pom",
artifact_id = "dagger-grpc-server-annotations",
artifact_name = "Dagger gRPC Server Annotations",
targets = [":annotations"],
)

pom_file(
dagger_pom_file(
name = "server-pom",
artifact_id = "dagger-grpc-server",
artifact_name = "Dagger gRPC Server",
Expand Down
6 changes: 3 additions & 3 deletions java/dagger/grpc/server/processor/BUILD
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
load("@google_bazel_common//tools/javadoc:javadoc.bzl", "javadoc_library")
load("@rules_java//java:defs.bzl", "java_library", "java_plugin")
load(
"//:build_defs.bzl",
"DOCLINT_HTML_AND_SYNTAX",
"POM_VERSION",
)
load("//tools:maven.bzl", "pom_file")
load("//tools/javadoc:javadoc.bzl", "javadoc_library")
load("//tools/maven:maven.bzl", "dagger_pom_file")

package(default_visibility = ["//:src"])

Expand All @@ -28,7 +28,7 @@ java_library(
],
)

pom_file(
dagger_pom_file(
name = "pom",
artifact_id = "dagger-grpc-server-processor",
artifact_name = "Dagger gRPC Server Processor",
Expand Down
2 changes: 1 addition & 1 deletion java/dagger/hilt/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# limitations under the License.

load("//:build_defs.bzl", "POM_VERSION")
load("//tools:maven.bzl", "gen_maven_artifact")
load("//tools/maven:maven.bzl", "gen_maven_artifact")

# Description:
# A library that wraps the Dagger API to make DI usage and testing easier.
Expand Down
2 changes: 1 addition & 1 deletion java/dagger/hilt/android/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# A library based on Hilt that provides standard components and automated injection for Android.
load("//:build_defs.bzl", "POM_VERSION")
load("//tools:bazel_compat.bzl", "compat_kt_android_library")
load("//tools:maven.bzl", "gen_maven_artifact")
load("//tools/maven:maven.bzl", "gen_maven_artifact")

package(default_visibility = ["//:src"])

Expand Down
2 changes: 1 addition & 1 deletion java/dagger/hilt/android/processor/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# Hilt android processors.

load("//:build_defs.bzl", "POM_VERSION")
load("//tools:maven.bzl", "gen_maven_artifact")
load("//tools/maven:maven.bzl", "gen_maven_artifact")

package(default_visibility = ["//:src"])

Expand Down
2 changes: 1 addition & 1 deletion java/dagger/hilt/android/testing/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# Testing libraries for Hilt Android.

load("//:build_defs.bzl", "POM_VERSION")
load("//tools:maven.bzl", "gen_maven_artifact")
load("//tools/maven:maven.bzl", "gen_maven_artifact")

package(default_visibility = ["//:src"])

Expand Down
2 changes: 1 addition & 1 deletion java/dagger/hilt/processor/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# Hilt android processors.

load("//:build_defs.bzl", "POM_VERSION")
load("//tools:maven.bzl", "gen_maven_artifact")
load("//tools/maven:maven.bzl", "gen_maven_artifact")

package(default_visibility = ["//:src"])

Expand Down
2 changes: 1 addition & 1 deletion java/dagger/internal/codegen/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ load(
"//:build_defs.bzl",
"POM_VERSION",
)
load("//tools:maven.bzl", "gen_maven_artifact")
load("//tools/maven:maven.bzl", "gen_maven_artifact")

package(default_visibility = ["//:src"])

Expand Down
2 changes: 1 addition & 1 deletion java/dagger/lint/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

load("@io_bazel_rules_kotlin//kotlin:kotlin.bzl", "kt_jvm_library")
load("//:build_defs.bzl", "POM_VERSION")
load("//tools:maven.bzl", "gen_maven_artifact")
load("//tools/maven:maven.bzl", "gen_maven_artifact")

package(default_visibility = ["//:src"])

Expand Down
2 changes: 1 addition & 1 deletion java/dagger/producers/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ load(
"JAVA_RELEASE_MIN",
"POM_VERSION",
)
load("//tools:maven.bzl", "gen_maven_artifact")
load("//tools/maven:maven.bzl", "gen_maven_artifact")

package(default_visibility = ["//:src"])

Expand Down
2 changes: 1 addition & 1 deletion java/dagger/spi/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ load(
"DOCLINT_REFERENCES",
"POM_VERSION",
)
load("//tools:maven.bzl", "gen_maven_artifact")
load("//tools/maven:maven.bzl", "gen_maven_artifact")

package(default_visibility = ["//:src"])

Expand Down
4 changes: 2 additions & 2 deletions javatests/dagger/internal/codegen/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ java_library(
"//third_party/java/guava/collect",
"//third_party/java/javapoet",
"//third_party/java/truth",
"@com_google_auto_value_auto_value//jar",
"@maven//:com_google_auto_value_auto_value",
],
)

Expand Down Expand Up @@ -110,7 +110,7 @@ DEPS = [
"//third_party/java/guava/collect",
"//third_party/java/guava/util/concurrent",
"//third_party/java/auto:value",
"@com_google_auto_value_auto_value//jar",
"@maven//:com_google_auto_value_auto_value",
"//third_party/java/auto:common",
"//third_party/java/compile_testing",
"//third_party/java/javapoet",
Expand Down
1 change: 0 additions & 1 deletion third_party/java/auto/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ alias(
java_plugin(
name = "auto_value_processor",
processor_class = "com.google.auto.value.processor.AutoValueProcessor",
visibility = ["//visibility:private"],
deps = [
":common",
":service",
Expand Down
Loading

0 comments on commit 140e201

Please sign in to comment.