diff --git a/javatests/dagger/internal/codegen/BUILD b/javatests/dagger/internal/codegen/BUILD index 5984e537892..b189fe5b33d 100644 --- a/javatests/dagger/internal/codegen/BUILD +++ b/javatests/dagger/internal/codegen/BUILD @@ -51,74 +51,137 @@ java_library( srcs = [ "CompilerMode.java", "Compilers.java", + "ComponentCreatorTestHelper.java", + "DaggerModuleMethodSubject.java", + "GeneratingProcessingStep.java", "JavaFileBuilder.java", + "TestUtils.java", ], deps = [ + "//java/dagger:core", "//java/dagger/internal/codegen:package_info", "//java/dagger/internal/codegen:processor", + "//java/dagger/internal/codegen/base", + "//java/dagger/internal/codegen/binding", + "//java/dagger/internal/codegen/xprocessing", "//java/dagger/internal/codegen/xprocessing:xprocessing-testing", + "//java/dagger/producers", "//java/dagger/testing/compile", "//third_party/java/compile_testing", "//third_party/java/guava/base", "//third_party/java/guava/collect", + "//third_party/java/javapoet", + "//third_party/java/truth", "@com_google_auto_value_auto_value//jar", ], ) +# These are tests with over 25 test cases. +LARGE_TESTS = [ + "ComponentCreatorTest.java", + "ComponentProcessorTest.java", + "InjectConstructorFactoryGeneratorTest.java", + "MembersInjectionTest.java", + "MissingBindingValidationTest.java", + "ModuleFactoryGeneratorTest.java", + "ProducerModuleFactoryGeneratorTest.java", + "SubcomponentCreatorValidationTest.java", +] + +# These are tests with over 10 test cases +MEDIUM_TESTS = [ + "BindsMethodValidationTest.java", + "DaggerSuperficialValidationTest.java", + "DelegateRequestRepresentationTest.java", + "DuplicateBindingsValidationTest.java", + "IgnoreProvisionKeyWildcardsTest.java", + "MapMultibindingValidationTest.java", + "MultibindsValidationTest.java", + "ProductionComponentProcessorTest.java", + "ProductionGraphValidationTest.java", + "SubcomponentValidationTest.java", +] + +DEPS = [ + ":compilers", + ":java_lib_no_dagger_compiler", + ":kt_lib_no_dagger_compiler", + "//third_party/java/guava/base", + "//third_party/java/guava/collect", + "//third_party/java/guava/util/concurrent", + "//third_party/java/auto:value", + "@com_google_auto_value_auto_value//jar", + "//third_party/java/auto:common", + "//third_party/java/compile_testing", + "//third_party/java/javapoet", + "//third_party/java/jsr250_annotations", # Include @Generated in generated files. + "//third_party/java/jsr330_inject", + "//third_party/java/junit", + "//third_party/java/mockito", + "//third_party/java/truth", + "//java/dagger:core", + "//java/dagger/internal/codegen:package_info", + "//java/dagger/internal/codegen:processor", + "//java/dagger/internal/codegen/base", + "//java/dagger/internal/codegen/binding", + "//java/dagger/internal/codegen/bindinggraphvalidation", + "//java/dagger/internal/codegen/compileroption", + "//java/dagger/internal/codegen/extension", + "//java/dagger/internal/codegen/javac", + "//java/dagger/internal/codegen/javapoet", + "//java/dagger/internal/codegen/kotlin", + "//java/dagger/internal/codegen/langmodel", + "//java/dagger/internal/codegen/model", + "//java/dagger/internal/codegen/validation", + "//java/dagger/internal/codegen/writing", + "//java/dagger/internal/codegen/xprocessing", + "//java/dagger/internal/codegen/xprocessing:xprocessing-testing", + "//java/dagger/model/testing", + "//java/dagger/producers", + "//java/dagger/spi", + "//java/dagger/spi/model/testing", + "//java/dagger/testing/compile", + "//java/dagger/testing/golden", +] + +GenJavaTests( + name = "large_compiler_tests", + srcs = LARGE_TESTS, + functional = False, + javacopts = DOCLINT_HTML_AND_SYNTAX, + plugins = ["//java/dagger/internal/codegen/bootstrap"], + shard_count = 7, + deps = DEPS, +) + +GenJavaTests( + name = "medium_compiler_tests", + srcs = MEDIUM_TESTS, + functional = False, + javacopts = DOCLINT_HTML_AND_SYNTAX, + plugins = ["//java/dagger/internal/codegen/bootstrap"], + shard_count = 3, + deps = DEPS, +) + GenJavaTests( name = "compiler_tests", srcs = glob( ["*.java"], exclude = [ - "ComponentProcessorTestClasses.java", "CompilerMode.java", "Compilers.java", + "ComponentCreatorTestHelper.java", + "ComponentProcessorTestClasses.java", + "DaggerModuleMethodSubject.java", + "GeneratingProcessingStep.java", "InvalidInjectConstructor.java", "JavaFileBuilder.java", - ], + "TestUtils.java", + ] + LARGE_TESTS + MEDIUM_TESTS, ), functional = False, javacopts = DOCLINT_HTML_AND_SYNTAX, plugins = ["//java/dagger/internal/codegen/bootstrap"], - deps = [ - ":compilers", - ":java_lib_no_dagger_compiler", - ":kt_lib_no_dagger_compiler", - "//java/dagger:core", - "//java/dagger/internal/codegen:package_info", - "//java/dagger/internal/codegen:processor", - "//java/dagger/internal/codegen/base", - "//java/dagger/internal/codegen/binding", - "//java/dagger/internal/codegen/bindinggraphvalidation", - "//java/dagger/internal/codegen/compileroption", - "//java/dagger/internal/codegen/extension", - "//java/dagger/internal/codegen/javac", - "//java/dagger/internal/codegen/javapoet", - "//java/dagger/internal/codegen/kotlin", - "//java/dagger/internal/codegen/langmodel", - "//java/dagger/internal/codegen/model", - "//java/dagger/internal/codegen/validation", - "//java/dagger/internal/codegen/writing", - "//java/dagger/internal/codegen/xprocessing", - "//java/dagger/internal/codegen/xprocessing:xprocessing-testing", - "//java/dagger/model/testing", - "//java/dagger/producers", - "//java/dagger/spi", - "//java/dagger/spi/model/testing", - "//java/dagger/testing/compile", - "//java/dagger/testing/golden", - "//third_party/java/auto:common", - "//third_party/java/auto:value", - "//third_party/java/compile_testing", - "//third_party/java/guava/base", - "//third_party/java/guava/collect", - "//third_party/java/guava/util/concurrent", - "//third_party/java/javapoet", - "//third_party/java/jsr250_annotations", # Include @Generated in generated files. - "//third_party/java/jsr330_inject", - "//third_party/java/junit", - "//third_party/java/mockito", - "//third_party/java/truth", - "@com_google_auto_value_auto_value//jar", - ], + deps = DEPS, ) diff --git a/test_defs.bzl b/test_defs.bzl index 2046778eecb..3b136261ba6 100644 --- a/test_defs.bzl +++ b/test_defs.bzl @@ -50,6 +50,7 @@ def GenKtLibrary( deps = deps, gen_library_deps = gen_library_deps, test_only_deps = None, + shard_count = None, plugins = plugins, javacopts = javacopts, functional = functional, @@ -64,6 +65,7 @@ def GenKtTests( test_only_deps = None, plugins = None, javacopts = None, + shard_count = None, functional = True, require_jdk7_syntax = True): _GenTestsWithVariants( @@ -76,6 +78,7 @@ def GenKtTests( test_only_deps = test_only_deps, plugins = plugins, javacopts = javacopts, + shard_count = shard_count, functional = functional, require_jdk7_syntax = require_jdk7_syntax, ) @@ -101,6 +104,7 @@ def GenJavaLibrary( test_only_deps = None, plugins = plugins, javacopts = javacopts, + shard_count = None, functional = functional, require_jdk7_syntax = require_jdk7_syntax, ) @@ -113,6 +117,7 @@ def GenJavaTests( test_only_deps = None, plugins = None, javacopts = None, + shard_count = None, functional = True, require_jdk7_syntax = True): if any([src for src in srcs if src.endswith(".kt")]): @@ -127,6 +132,7 @@ def GenJavaTests( test_only_deps = test_only_deps, plugins = plugins, javacopts = javacopts, + shard_count = shard_count, functional = functional, require_jdk7_syntax = require_jdk7_syntax, ) @@ -138,6 +144,7 @@ def GenRobolectricTests( test_only_deps = None, plugins = None, javacopts = None, + shard_count = None, functional = True, require_jdk7_syntax = True, manifest_values = None): @@ -152,6 +159,7 @@ def GenRobolectricTests( test_only_deps = test_only_deps, plugins = plugins, javacopts = javacopts, + shard_count = shard_count, functional = functional, require_jdk7_syntax = require_jdk7_syntax, test_kwargs = {"manifest_values": manifest_values}, @@ -167,6 +175,7 @@ def _GenTestsWithVariants( test_only_deps, plugins, javacopts, + shard_count, functional, require_jdk7_syntax, test_kwargs = None): @@ -242,6 +251,7 @@ def _GenTestsWithVariants( deps = test_deps + variant_deps, plugins = plugins, javacopts = javacopts + variant_javacopts, + shard_count = shard_count, jvm_flags = jvm_flags, functional = functional, test_kwargs = test_kwargs, @@ -291,6 +301,7 @@ def _GenTestWithVariant( deps, plugins, javacopts, + shard_count, jvm_flags, functional, test_kwargs): @@ -319,6 +330,7 @@ def _GenTestWithVariant( jvm_flags = jvm_flags, plugins = plugins, tags = tags, + shard_count = shard_count, test_class = test_class, deps = deps, **test_kwargs_with_javacopts