Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 3 additions & 1 deletion dagger-compiler/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ dependencies {
testImplementation(libs.ksp.common)
testImplementation(libs.ksp.embeddable)

testAnnotationProcessor(project(":dagger-compiler"))
testAnnotationProcessor(project(":dagger-compiler", "unshaded"))
testAnnotationProcessor(libs.auto.common)
testAnnotationProcessor(files(project.findXProcessingJar()))
}

daggerBuild {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ kt_jvm_library(
# TODO(bcorso): Move this into a subpackage.
java_library(
name = "compilers",
testonly = 1,
srcs = [
"CompilerMode.java",
"Compilers.java",
Expand All @@ -56,7 +57,7 @@ java_library(
"//dagger-compiler/main/java/dagger/internal/codegen/xprocessing:xprocessing-testing",
"//dagger-producers/main/java/dagger/producers",
"//dagger-runtime/main/java/dagger:core",
"//java/dagger/testing/compile",
"//dagger-testing/main/java/dagger/testing/compile",
"//third_party/java/auto:value_processor",
"//third_party/java/compile_testing",
"//third_party/java/guava/base",
Expand Down Expand Up @@ -127,8 +128,8 @@ DEPS = [
"//dagger-spi",
"//dagger-testing/main/java/dagger/model/testing",
"//dagger-testing/main/java/dagger/spi/model/testing",
"//java/dagger/testing/compile",
"//java/dagger/testing/golden",
"//dagger-testing/main/java/dagger/testing/compile:compile",
"//dagger-testing/main/java/dagger/testing/golden:golden",
]

GenJavaTests(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,11 @@ private DaggerModuleMethodSubject assertThatMethod(String method) {

/** A qualifier. */
@Qualifier
@SuppressWarnings("MissingRuntimeRetention") // For testing.
public @interface Qualifier1 {}

/** A qualifier. */
@Qualifier
@SuppressWarnings("MissingRuntimeRetention") // For testing.
public @interface Qualifier2 {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ enum CompilerType {
private final CompilerType compilerType;
private final ImmutableMap<String, String> compilerOptions;

@Parameters(name = "compilerMode={0}, creatorKind={1}")
@Parameters(name = "compilerMode={0},creatorKind={1}")
public static Collection<Object[]> parameters() {
return ImmutableList.of(
new Object[]{DEFAULT_MODE, COMPONENT_BUILDER, JAVAC},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameters;


@RunWith(Parameterized.class)
public class ComponentDependenciesTest {
@Parameters(name = "{0}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,5 @@ import javax.inject.Inject
import javax.inject.Named

class KotlinInjectedQualifier {
@Inject
@Named("TheString")
lateinit var qualifiedString: String
@Inject @Named("TheString") lateinit var qualifiedString: String
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,39 +19,37 @@ package dagger.internal.codegen
import javax.inject.Inject

object KotlinObjectWithMemberInjection {
@Inject
lateinit var property: String
@Inject lateinit var property: String
}

object KotlinObjectWithSetterMemberInjection {
@set:Inject
lateinit var setterProperty: String
@set:Inject lateinit var setterProperty: String
}

@Suppress("ClassShouldBeObject") // For testing.
class KotlinClassWithMemberInjectedCompanion {
companion object {
@Inject
lateinit var property: String
@Inject lateinit var property: String
}
}

@Suppress("ClassShouldBeObject") // For testing.
class KotlinClassWithSetterMemberInjectedCompanion {
companion object {
@set:Inject
lateinit var setterProperty: String
@set:Inject lateinit var setterProperty: String
}
}

@Suppress("ClassShouldBeObject") // For testing.
class KotlinClassWithMemberInjectedNamedCompanion {
companion object TheCompanion {
@Inject
lateinit var property: String
@Inject lateinit var property: String
}
}

@Suppress("ClassShouldBeObject") // For testing.
class KotlinClassWithSetterMemberInjectedNamedCompanion {
companion object TheCompanion {
@set:Inject
lateinit var setterProperty: String
@set:Inject lateinit var setterProperty: String
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,10 @@ public void hasParameters() {
}

@Qualifier
@SuppressWarnings("MissingRuntimeRetention") // For testing.
public @interface SomeQualifier {}

@Qualifier
@SuppressWarnings("MissingRuntimeRetention") // For testing.
public @interface OtherQualifier {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

@RunWith(Parameterized.class)
public class SubcomponentCreatorRequestFulfillmentTest extends ComponentCreatorTestHelper {
@Parameters(name = "compilerMode={0}, creatorKind={1}")
@Parameters(name = "compilerMode={0},creatorKind={1}")
public static Collection<Object[]> parameters() {
Set<List<Object>> params =
cartesianProduct(
Expand Down
30 changes: 30 additions & 0 deletions dagger-compiler/test/resources/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Copyright (C) 2025 The Dagger Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

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

# Creates a jar with all the golden files as resources located in a 'goldens'
# directory at the root of the jar.
genrule(
name = "goldens",
srcs = glob(["goldens/**"]),
outs = ["libgoldens.jar"],
cmd = """
TEMP="$$(mktemp -d)"
mkdir $$TEMP/goldens
cp $(SRCS) $$TEMP/goldens
$(JAVABASE)/bin/jar -cvf $@ -C $$TEMP .
""",
toolchains = ["@bazel_tools//tools/jdk:current_java_runtime"],
)
Loading
Loading