Skip to content

Commit

Permalink
reorganize Dagger Android jars with gen_maven_artifact rule.
Browse files Browse the repository at this point in the history
RELNOTES=n/a
PiperOrigin-RevId: 600579650
  • Loading branch information
wanyingd1996 authored and Dagger Team committed Jan 22, 2024
1 parent 813ffce commit 1503f1f
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 61 deletions.
42 changes: 21 additions & 21 deletions java/dagger/android/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@

load(
"//:build_defs.bzl",
"DOCLINT_HTML_AND_SYNTAX",
"DOCLINT_REFERENCES",
"JAVA_RELEASE_MIN",
"POM_VERSION",
)
load("//tools:dejetify.bzl", "dejetified_library")
load("//tools:maven.bzl", "pom_file")
load("@google_bazel_common//tools/javadoc:javadoc.bzl", "javadoc_library")
load(
"//tools:maven.bzl",
"gen_maven_artifact",
"pom_file",
)

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

Expand All @@ -43,8 +43,6 @@ filegroup(
android_library(
name = "android",
srcs = SRCS,
javacopts = JAVA_RELEASE_MIN + DOCLINT_HTML_AND_SYNTAX + DOCLINT_REFERENCES,
manifest = "AndroidManifest.xml",
plugins = [
"//java/dagger/android/internal/proguard:plugin",
],
Expand All @@ -60,17 +58,28 @@ android_library(
],
)

pom_file(
name = "pom",
artifact_id = "dagger-android",
gen_maven_artifact(
name = "artifact",
artifact_coordinates = "com.google.dagger:dagger-android:" + POM_VERSION,
artifact_name = "Dagger Android",
artifact_target = ":android",
artifact_target_maven_deps = [
"androidx.annotation:annotation",
"com.google.dagger:dagger",
"com.google.dagger:dagger-lint-aar",
],
javadoc_android_api_level = 32,
javadoc_root_packages = [
"dagger.android",
],
javadoc_srcs = [":android-srcs"],
manifest = "AndroidManifest.xml",
packaging = "aar",
targets = [":android"],
)

dejetified_library(
name = "dejetified-android",
input = ":android.aar",
input = ":artifact.aar",
output = "android-legacy.aar",
)

Expand All @@ -92,12 +101,3 @@ pom_file(
packaging = "aar",
targets = [":legacy-deps"],
)

javadoc_library(
name = "android-javadoc",
srcs = [":android-srcs"],
android_api_level = 31,
exclude_packages = ["dagger.android.internal"],
root_packages = ["dagger.android"],
deps = [":android"],
)
37 changes: 24 additions & 13 deletions java/dagger/android/processor/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,14 @@
# Description:
# Public Dagger API for Android

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",
"DOCLINT_REFERENCES",
"POM_VERSION",
)
load("//tools:maven.bzl", "pom_file")
load("//tools:maven.bzl", "gen_maven_artifact")

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

Expand Down Expand Up @@ -52,11 +51,30 @@ java_library(
],
)

pom_file(
name = "pom",
artifact_id = "dagger-android-processor",
gen_maven_artifact(
name = "artifact",
artifact_coordinates = "com.google.dagger:dagger-android-processor:" + POM_VERSION,
artifact_name = "Dagger Android Processor",
targets = [":processor"],
artifact_target = ":processor",
artifact_target_libs = [
"//java/dagger/internal/codegen/xprocessing",
],
artifact_target_maven_deps = [
"com.google.dagger:dagger",
"com.google.devtools.ksp:symbol-processing-api",
"com.google.guava:guava",
"com.squareup:javapoet",
"com.google.code.findbugs:jsr305",
"com.google.dagger:dagger-spi",
"com.google.guava:failureaccess",
"com.squareup:kotlinpoet",
"net.ltgt.gradle.incap:incap",
"org.jetbrains.kotlin:kotlin-stdlib",
],
javadoc_root_packages = [
"dagger.android.processor",
],
javadoc_srcs = [":srcs"],
)

java_plugin(
Expand All @@ -65,10 +83,3 @@ java_plugin(
processor_class = "dagger.android.processor.AndroidProcessor",
deps = [":processor"],
)

javadoc_library(
name = "processor-javadoc",
srcs = [":srcs"],
root_packages = ["dagger.android.processor"],
deps = [":processor"],
)
45 changes: 27 additions & 18 deletions java/dagger/android/support/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,14 @@

load(
"//:build_defs.bzl",
"JAVA_RELEASE_MIN",
"POM_VERSION",
)
load("//tools:dejetify.bzl", "dejetified_library")
load("//tools:maven.bzl", "pom_file")
load("@google_bazel_common//tools/javadoc:javadoc.bzl", "javadoc_library")
load(
"//tools:maven.bzl",
"gen_maven_artifact",
"pom_file",
)

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

Expand All @@ -34,8 +36,6 @@ filegroup(
android_library(
name = "support",
srcs = glob(["*.java"]),
javacopts = JAVA_RELEASE_MIN,
manifest = "AndroidManifest.xml",
tags = ["maven_coordinates=com.google.dagger:dagger-android-support:" + POM_VERSION],
deps = [
"//:dagger_with_compiler",
Expand All @@ -51,17 +51,34 @@ android_library(
],
)

pom_file(
name = "pom",
artifact_id = "dagger-android-support",
gen_maven_artifact(
name = "artifact",
artifact_coordinates = "com.google.dagger:dagger-android-support:" + POM_VERSION,
artifact_name = "Dagger Android Support",
artifact_target = ":support",
artifact_target_maven_deps = [
"androidx.activity:activity",
"androidx.annotation:annotation",
"androidx.appcompat:appcompat",
"androidx.fragment:fragment",
"androidx.lifecycle:lifecycle-common",
"androidx.lifecycle:lifecycle-viewmodel",
"androidx.lifecycle:lifecycle-viewmodel-savedstate",
"com.google.dagger:dagger",
"com.google.dagger:dagger-android",
],
javadoc_android_api_level = 32,
javadoc_root_packages = [
"dagger.android.support",
],
javadoc_srcs = [":support-srcs"],
manifest = "AndroidManifest.xml",
packaging = "aar",
targets = [":support"],
)

dejetified_library(
name = "dejetified-support",
input = ":support.aar",
input = ":artifact.aar",
output = "support-legacy.aar",
)

Expand All @@ -85,11 +102,3 @@ pom_file(
packaging = "aar",
targets = [":legacy-deps"],
)

javadoc_library(
name = "support-javadoc",
srcs = [":support-srcs"],
android_api_level = 32,
root_packages = ["dagger.android.support"],
deps = [":support"],
)
18 changes: 9 additions & 9 deletions util/deploy-dagger.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ _deploy \

_deploy \
"" \
java/dagger/android/android.aar \
java/dagger/android/artifact.aar \
java/dagger/android/pom.xml \
java/dagger/android/libandroid-src.jar \
java/dagger/android/android-javadoc.jar \
java/dagger/android/artifact-src.jar \
java/dagger/android/artifact-javadoc.jar \
""

_deploy \
Expand All @@ -93,10 +93,10 @@ _deploy \

_deploy \
"" \
java/dagger/android/support/support.aar \
java/dagger/android/support/artifact.aar \
java/dagger/android/support/pom.xml \
java/dagger/android/support/libsupport-src.jar \
java/dagger/android/support/support-javadoc.jar \
java/dagger/android/support/artifact-src.jar \
java/dagger/android/support/artifact-javadoc.jar \
""

_deploy \
Expand All @@ -109,10 +109,10 @@ _deploy \

_deploy \
"com.google.auto.common,dagger.spi.internal.shaded.auto.common;androidx.room.compiler,dagger.spi.internal.shaded.androidx.room.compiler;kotlinx.metadata,dagger.spi.internal.shaded.kotlinx.metadata;androidx.room,dagger.spi.internal.shaded.androidx.room" \
java/dagger/android/processor/libprocessor.jar \
java/dagger/android/processor/artifact.jar \
java/dagger/android/processor/pom.xml \
java/dagger/android/processor/libprocessor-src.jar \
java/dagger/android/processor/processor-javadoc.jar \
java/dagger/android/processor/artifact-src.jar \
java/dagger/android/processor/artifact-javadoc.jar \
""

_deploy \
Expand Down

0 comments on commit 1503f1f

Please sign in to comment.