def rule_runner() -> RuleRunner: rule_runner = RuleRunner( rules=[ *archive.rules(), *config_files.rules(), *coursier_fetch_rules(), *coursier_setup_rules(), *external_tool_rules(), *source_files.rules(), *javac_rules(), *javac_check_rules(), *util_rules(), *target_types_rules(), *coursier_rules(), *jdk_rules.rules(), *java_dep_inf_rules(), *source_files.rules(), *testutil.rules(), QueryRule(CheckResults, (JavacCheckRequest, )), QueryRule(FallibleClasspathEntry, (CompileJavaSourceRequest, )), QueryRule(ClasspathEntry, (CompileJavaSourceRequest, )), QueryRule(CoarsenedTargets, (Addresses, )), ], target_types=[ JvmDependencyLockfile, JavaSourcesGeneratorTarget, JvmArtifact ], bootstrap_args=[ NAMED_RESOLVE_OPTIONS, DEFAULT_RESOLVE_OPTION, ], ) rule_runner.set_options( args=[NAMED_RESOLVE_OPTIONS, DEFAULT_RESOLVE_OPTION], env_inherit=PYTHON_BOOTSTRAP_ENV) return rule_runner
def rule_runner() -> RuleRunner: rule_runner = RuleRunner( rules=[ *config_files.rules(), *jvm_tool.rules(), *java_dep_inference_rules(), *java_target_rules(), *java_util_rules(), *javac_rules(), *java_symbol_mapper.rules(), *source_files.rules(), *scala_parser.rules(), *scala_symbol_mapper.rules(), *scala_dep_inference_rules.rules(), *scala_target_types.rules(), *system_binaries.rules(), *util_rules(), QueryRule(Addresses, (DependenciesRequest, )), ], target_types=[ JavaSourcesGeneratorTarget, JavaSourceTarget, ScalaSourcesGeneratorTarget, ScalaSourceTarget, ], ) rule_runner.set_options(args=[], env_inherit=PYTHON_BOOTSTRAP_ENV) return rule_runner
def rule_runner() -> RuleRunner: rule_runner = RuleRunner( preserve_tmpdirs=True, rules=[ *config_files.rules(), *classpath.rules(), *coursier_fetch_rules(), *coursier_setup_rules(), *external_tool_rules(), *source_files.rules(), *javac_rules(), *junit_rules(), *util_rules(), *java_util_rules(), *target_types_rules(), QueryRule(CoarsenedTargets, (Addresses, )), QueryRule(TestResult, (JavaTestFieldSet, )), ], target_types=[ JvmDependencyLockfile, JvmArtifact, JavaSourcesGeneratorTarget, JunitTestsGeneratorTarget, ], ) rule_runner.set_options( # Makes JUnit output predictable and parseable across versions (#12933): args=[ "--junit-args=['--disable-ansi-colors','--details=flat','--details-theme=ascii']", NAMED_RESOLVE_OPTIONS, DEFAULT_RESOLVE_OPTION, ], env_inherit=PYTHON_BOOTSTRAP_ENV, ) return rule_runner
def rule_runner() -> RuleRunner: return RuleRunner( rules=[ *config_files.rules(), *coursier_fetch_rules(), *coursier_setup_rules(), *dep_inference_rules(), *external_tool_rules(), *java_parser_launcher_rules(), *java_parser_rules(), *java_target_rules(), *java_util_rules(), *javac_rules(), *junit_rules(), *source_files.rules(), *util_rules(), QueryRule(Addresses, [DependenciesRequest]), QueryRule(ExplicitlyProvidedDependencies, [DependenciesRequest]), QueryRule(InferredDependencies, [InferJavaImportDependencies]), QueryRule(Targets, [UnparsedAddressInputs]), ], target_types=[JavaSourcesGeneratorTarget, JunitTestsGeneratorTarget], bootstrap_args=["--javac-jdk=system" ], # TODO(#12293): use a fixed JDK version. )
def rule_runner() -> RuleRunner: rule_runner = RuleRunner( rules=[ *system_binaries.rules(), *config_files.rules(), *jvm_tool.rules(), *source_files.rules(), *javac_rules(), *javac_check_rules(), *util_rules(), *target_types_rules(), *lockfile.rules(), *jdk_rules.rules(), *java_dep_inf_rules(), *source_files.rules(), *testutil.rules(), QueryRule(CheckResults, (JavacCheckRequest, )), QueryRule(ClasspathEntry, (CompileJavaSourceRequest, )), QueryRule(CoarsenedTargets, (Addresses, )), QueryRule(FallibleClasspathEntry, (CompileJavaSourceRequest, )), QueryRule(RenderedClasspath, (CompileJavaSourceRequest, )), ], target_types=[JavaSourcesGeneratorTarget, JvmArtifactTarget], ) rule_runner.set_options([], env_inherit=PYTHON_BOOTSTRAP_ENV) return rule_runner
def rule_runner() -> RuleRunner: rule_runner = RuleRunner( rules=[ *config_files.rules(), *coursier_fetch_rules(), *coursier_rules(), *coursier_setup_rules(), *external_tool_rules(), *java_dep_inf_rules(), *javac_rules(), *jdk_rules.rules(), *scalac_rules(), *source_files.rules(), *scala_target_types_rules(), *java_target_types_rules(), *util_rules(), *testutil.rules(), QueryRule(CoarsenedTargets, (Addresses, )), QueryRule(ClasspathEntry, (CompileJavaSourceRequest, )), QueryRule(ClasspathEntry, (CompileScalaSourceRequest, )), QueryRule(FallibleClasspathEntry, (CompileJavaSourceRequest, )), QueryRule(FallibleClasspathEntry, (CompileScalaSourceRequest, )), ], target_types=[ScalaSourcesGeneratorTarget, JavaSourcesGeneratorTarget], ) rule_runner.set_options( args=[ NAMED_RESOLVE_OPTIONS, DEFAULT_RESOLVE_OPTION, ], env_inherit=PYTHON_BOOTSTRAP_ENV, ) return rule_runner
def rule_runner() -> RuleRunner: rule_runner = RuleRunner( rules=[ *coursier_fetch_rules(), *coursier_setup_rules(), *config_files.rules(), *jvm_tool.rules(), *system_binaries.rules(), *jdk_rules.rules(), *kotlin_check_rules(), *kotlinc_rules(), *kotlinc_plugins.rules(), *kotlin_dep_inf_rules(), *source_files.rules(), *target_types_rules(), *testutil.rules(), *util_rules(), QueryRule(CheckResults, (KotlincCheckRequest, )), QueryRule(CoarsenedTargets, (Addresses, )), QueryRule(FallibleClasspathEntry, (CompileKotlinSourceRequest, )), QueryRule(RenderedClasspath, (CompileKotlinSourceRequest, )), QueryRule(ClasspathEntry, (CompileKotlinSourceRequest, )), ], target_types=[ JvmArtifactTarget, KotlinSourcesGeneratorTarget, KotlincPluginTarget ], ) rule_runner.set_options(args=[], env_inherit=PYTHON_BOOTSTRAP_ENV) return rule_runner
def rule_runner() -> RuleRunner: rule_runner = RuleRunner( rules=[ *config_files.rules(), *coursier_fetch_rules(), *coursier_setup_rules(), *dep_inference_rules(), *external_tool_rules(), *scala_parser.rules(), *symbol_mapper.rules(), *scala_target_rules(), *source_files.rules(), *util_rules(), *jdk_rules(), QueryRule(Addresses, [DependenciesRequest]), QueryRule(ExplicitlyProvidedDependencies, [DependenciesRequest]), QueryRule(InferredDependencies, [InferScalaSourceDependencies]), QueryRule(Targets, [UnparsedAddressInputs]), ], target_types=[ScalaSourcesGeneratorTarget], ) rule_runner.set_options( args=[NAMED_RESOLVE_OPTIONS, DEFAULT_RESOLVE_OPTION], env_inherit=PYTHON_BOOTSTRAP_ENV ) return rule_runner
def rule_runner() -> RuleRunner: rule_runner = RuleRunner( rules=[ *config_files.rules(), *jvm_tool.rules(), *dep_inference_rules(), *java_target_rules(), *java_util_rules(), *javac_rules(), *junit_rules(), *source_files.rules(), *util_rules(), QueryRule(Addresses, [DependenciesRequest]), QueryRule(ExplicitlyProvidedDependencies, [DependenciesRequest]), QueryRule(InferredDependencies, [InferJavaSourceDependencies]), QueryRule(JavaInferredDependencies, [JavaInferredDependenciesAndExportsRequest]), QueryRule(Targets, [UnparsedAddressInputs]), ], target_types=[ JavaSourcesGeneratorTarget, JunitTestsGeneratorTarget, JvmArtifactTarget ], ) rule_runner.set_options(args=[], env_inherit=PYTHON_BOOTSTRAP_ENV) return rule_runner
def rule_runner() -> RuleRunner: rule_runner = RuleRunner( rules=[ *thrift_rules(), *scrooge_rules(), *scrooge_java_rules(), *config_files.rules(), *classpath.rules(), *coursier_fetch_rules(), *coursier_setup_rules(), *external_tool_rules(), *source_files.rules(), *scalac_rules(), *util_rules(), *jdk_rules(), *target_types.rules(), *stripped_source_files.rules(), QueryRule(HydratedSources, [HydrateSourcesRequest]), QueryRule(GeneratedSources, [GenerateJavaFromThriftRequest]), ], target_types=[ ScalaSourceTarget, ScalaSourcesGeneratorTarget, ThriftSourcesGeneratorTarget, ], ) rule_runner.set_options( [], env_inherit=PYTHON_BOOTSTRAP_ENV, ) return rule_runner
def rule_runner() -> RuleRunner: rule_runner = RuleRunner( rules=[ *config_files.rules(), *classpath.rules(), *coursier_fetch_rules(), *coursier_setup_rules(), *external_tool_rules(), *source_files.rules(), *scalac_rules(), *util_rules(), *jdk_rules(), *target_types.rules(), *protobuf_target_types_rules(), *stripped_source_files.rules(), *scala_protobuf_rules(), *artifact_mapper.rules(), *distdir.rules(), QueryRule(HydratedSources, [HydrateSourcesRequest]), QueryRule(GeneratedSources, [GenerateScalaFromProtobufRequest]), QueryRule(DigestContents, (Digest, )), ], target_types=[ ScalaSourceTarget, ScalaSourcesGeneratorTarget, ProtobufSourcesGeneratorTarget, JvmArtifactTarget, ], ) rule_runner.set_options( [], env_inherit=PYTHON_BOOTSTRAP_ENV, ) return rule_runner
def rule_runner() -> RuleRunner: rule_runner = RuleRunner( rules=[ *avro_rules(), *avro_java_rules(), *config_files.rules(), *classpath.rules(), *coursier_fetch_rules(), *coursier_setup_rules(), *external_tool_rules(), *source_files.rules(), *util_rules(), *jdk_rules(), *graph.rules(), *jvm_compile_rules(), *stripped_source_files.rules(), QueryRule(HydratedSources, [HydrateSourcesRequest]), QueryRule(GeneratedSources, [GenerateJavaFromAvroRequest]), ], target_types=[ JavaSourceTarget, JavaSourcesGeneratorTarget, AvroSourcesGeneratorTarget, ], ) rule_runner.set_options( [], env_inherit=PYTHON_BOOTSTRAP_ENV, ) return rule_runner
def rule_runner(): rule_runner = RuleRunner( rules=[ *war.rules(), *jvm_tool.rules(), *classpath.rules(), *javac_rules(), *jdk_rules.rules(), *java_dep_inf_rules(), *target_types_rules(), *core_target_types_rules(), *util_rules(), *archive.rules(), QueryRule(BuiltPackage, (PackageWarFileFieldSet,)), ], target_types=[ JvmArtifactTarget, JvmWarTarget, FileTarget, FilesGeneratorTarget, RelocatedFiles, ], ) rule_runner.set_options([], env_inherit=PYTHON_BOOTSTRAP_ENV) return rule_runner
def rule_runner() -> RuleRunner: rule_runner = RuleRunner( rules=[ *config_files.rules(), *classpath.rules(), *coursier_fetch_rules(), *coursier_setup_rules(), *jdk_rules.rules(), *javac_rules(), *util_rules(), *java_util_rules(), *target_types_rules(), *gjf_fmt_rules.rules(), *skip_field.rules(), QueryRule(LintResults, (GoogleJavaFormatRequest, )), QueryRule(FmtResult, (GoogleJavaFormatRequest, )), QueryRule(SourceFiles, (SourceFilesRequest, )), ], target_types=[JavaSourceTarget, JavaSourcesGeneratorTarget], ) rule_runner.set_options( [], env_inherit=PYTHON_BOOTSTRAP_ENV, ) return rule_runner
def rule_runner() -> RuleRunner: rule_runner = RuleRunner( rules=[ *config_files.rules(), *classpath.rules(), *coursier_fetch_rules(), *coursier_setup_rules(), *external_tool_rules(), *source_files.rules(), *scalac_rules(), *util_rules(), *jdk_rules(), *target_types.rules(), *scalafmt_rules(), *skip_field.rules(), QueryRule(FmtResult, (ScalafmtRequest, )), QueryRule(SourceFiles, (SourceFilesRequest, )), QueryRule(Snapshot, (PathGlobs, )), QueryRule(ScalafmtConfigFiles, (GatherScalafmtConfigFilesRequest, )), ], target_types=[ScalaSourceTarget, ScalaSourcesGeneratorTarget], ) rule_runner.set_options([], env_inherit=PYTHON_BOOTSTRAP_ENV) return rule_runner
def rule_runner() -> RuleRunner: rule_runner = RuleRunner( preserve_tmpdirs=True, rules=[ *classpath.rules(), *config_files.rules(), *coursier_fetch_rules(), *coursier_setup_rules(), *jdk_util_rules(), *non_jvm_dependencies_rules(), *scalac_rules(), *scalatest_rules(), *scala_target_types_rules(), *scalac_rules(), *source_files.rules(), *system_binaries.rules(), *target_types_rules(), *util_rules(), QueryRule(CoarsenedTargets, (Addresses, )), QueryRule(TestResult, (ScalatestTestFieldSet, )), QueryRule(Scalatest, ()), ], target_types=[ JvmArtifactTarget, FileTarget, FilesGeneratorTarget, RelocatedFiles, ScalaSourcesGeneratorTarget, ScalatestTestsGeneratorTarget, ], ) rule_runner.set_options(args=[], env_inherit=PYTHON_BOOTSTRAP_ENV) return rule_runner
def rule_runner() -> RuleRunner: return RuleRunner( preserve_tmpdirs=True, rules=[ *config_files.rules(), *coursier_fetch_rules(), *coursier_setup_rules(), *external_tool_rules(), *source_files.rules(), *javac_rules(), *junit_rules(), *util_rules(), *java_util_rules(), *target_types_rules(), QueryRule(CoarsenedTargets, (Addresses, )), QueryRule(TestResult, (JavaTestFieldSet, )), ], target_types=[ JvmDependencyLockfile, JvmArtifact, JavaSourcesGeneratorTarget, JunitTestsGeneratorTarget, ], bootstrap_args=[ "--javac-jdk=system", # TODO(#12293): use a fixed JDK version. # Makes JUnit output predictable and parseable across versions (#12933): "--junit-args=['--disable-ansi-colors','--details=flat','--details-theme=ascii']", ], )
def rule_runner() -> RuleRunner: rule_runner = RuleRunner( rules=[ *classpath_rules(), *coursier_fetch_rules(), *coursier_setup_rules(), *deploy_jar_rules(), *javac_rules(), *jdk_rules.rules(), *java_dep_inf_rules(), *target_types_rules(), *util_rules(), QueryRule(BashBinary, ()), QueryRule(BuiltPackage, (DeployJarFieldSet, )), QueryRule(JdkSetup, ()), QueryRule(ProcessResult, (Process, )), ], target_types=[ JvmDependencyLockfile, JavaSourcesGeneratorTarget, JvmArtifact, DeployJar, ], ) rule_runner.set_options( args=[ '--jvm-resolves={"test": "coursier_resolve.lockfile"}', "--jvm-default-resolve=test" ], env_inherit=PYTHON_BOOTSTRAP_ENV, ) return rule_runner
def rule_runner() -> RuleRunner: rule_runner = RuleRunner( rules=[ *config_files.rules(), *jvm_tool.rules(), *dep_inference_rules(), *java_target_rules(), *java_util_rules(), *javac_rules(), *source_files.rules(), *system_binaries.rules(), *util_rules(), QueryRule(Addresses, [DependenciesRequest]), QueryRule(ThirdPartySymbolMapping, []), ], objects={"parametrize": Parametrize}, target_types=[ JavaSourceTarget, JavaSourcesGeneratorTarget, JunitTestsGeneratorTarget, JvmArtifactTarget, ], ) rule_runner.set_options(args=[], env_inherit=PYTHON_BOOTSTRAP_ENV) return rule_runner
def rule_runner() -> RuleRunner: rule_runner = RuleRunner( rules=[ *scala_lockfile_rules(), *scala_dep_inf_rules.rules(), *jdk_rules.rules(), *coursier_fetch_rules(), *coursier_jvm_tool_rules(), *lockfile.rules(), *coursier_setup_rules(), *external_tool.rules(), *source_files.rules(), *util_rules(), *system_binaries.rules(), *graph.rules(), *build_files.rules(), *target_types.rules(), QueryRule(UserGenerateLockfiles, (RequestedJVMUserResolveNames,)), QueryRule(GenerateLockfileResult, (GenerateJvmLockfile,)), ], target_types=[JvmArtifactTarget, ScalaSourceTarget, ScalaSourcesGeneratorTarget], ) rule_runner.set_options( [ '--scala-version-for-resolve={"foo":"2.13.8"}', '--jvm-resolves={"foo": "foo/foo.lock"}', ], env_inherit={"PATH"}, ) return rule_runner
def rule_runner() -> RuleRunner: rule_runner = RuleRunner( rules=[ *config_files.rules(), *coursier_fetch_rules(), *coursier_setup_rules(), *external_tool_rules(), *import_parser_rules(), *java_parser_launcher_rules(), *java_parser_rules(), *java_target_rules(), *java_util_rules(), *javac_rules(), *process_rules(), *source_files.rules(), *util_rules(), QueryRule(ParsedJavaImports, [ParseJavaImportsRequest]), QueryRule(Targets, [UnparsedAddressInputs]), ], target_types=[JavaSourcesGeneratorTarget], bootstrap_args=[ NAMED_RESOLVE_OPTIONS, ], ) rule_runner.set_options(args=[], env_inherit=PYTHON_BOOTSTRAP_ENV) return rule_runner
def rule_runner() -> RuleRunner: rule_runner = RuleRunner( rules=[ *coursier_fetch_rules(), *jdk_rules.rules(), *scalac_check_rules(), *scalac_rules(), *source_files.rules(), *target_types_rules(), *testutil.rules(), *util_rules(), *scala_dep_inf_rules(), QueryRule(CheckResults, (ScalacCheckRequest, )), QueryRule(CoarsenedTargets, (Addresses, )), QueryRule(FallibleClasspathEntry, (CompileScalaSourceRequest, )), QueryRule(RenderedClasspath, (CompileScalaSourceRequest, )), QueryRule(ClasspathEntry, (CompileScalaSourceRequest, )), ], target_types=[ JvmArtifactTarget, ScalaSourcesGeneratorTarget, ScalacPluginTarget ], ) rule_runner.set_options( args=["--scala-version-for-resolve={'jvm-default':'2.13.8'}"], env_inherit=PYTHON_BOOTSTRAP_ENV, ) return rule_runner
def rule_runner() -> RuleRunner: rule_runner = RuleRunner( rules=[ *classpath_rules(), *jvm_tool.rules(), *deploy_jar_rules(), *javac_rules(), *jdk_rules.rules(), *java_dep_inf_rules(), *target_types_rules(), *util_rules(), QueryRule(BashBinary, ()), QueryRule(InternalJdk, ()), QueryRule(BuiltPackage, (DeployJarFieldSet,)), QueryRule(ProcessResult, (JvmProcess,)), QueryRule(ProcessResult, (Process,)), ], target_types=[ JavaSourcesGeneratorTarget, JvmArtifactTarget, DeployJarTarget, ], ) rule_runner.set_options(args=[], env_inherit=PYTHON_BOOTSTRAP_ENV) return rule_runner
def rule_runner() -> RuleRunner: return RuleRunner( preserve_tmpdirs=True, rules=[ *util_rules(), QueryRule(FileDigest, (ExtractFileDigest, )), ], )
def test_jvm_tool_base_extracts_correct_coordinates() -> None: rule_runner = RuleRunner( rules=[ *config_files.rules(), *coursier_fetch_rules(), *coursier_setup_rules(), *external_tool_rules(), *source_files.rules(), *util_rules(), *jvm_tool.rules(), *lockfile_rules(), generate_test_tool_lockfile_request, generate_internal_test_tool_lockfile_request, SubsystemRule(MockJvmTool), QueryRule(GenerateJvmLockfile, (MockJvmToolLockfileSentinel, )), QueryRule(GenerateJvmLockfile, (MockInternalToolLockfileSentinel, )), QueryRule(DigestContents, (Digest, )), ], target_types=[JvmArtifactTarget], ) rule_runner.set_options( args=[ "--mock-tool-artifacts=//:junit_junit", "--mock-tool-lockfile=/dev/null", ], env_inherit=PYTHON_BOOTSTRAP_ENV, ) rule_runner.write_files({ "BUILD": textwrap.dedent("""\ jvm_artifact( name="junit_junit", group="junit", artifact="junit", version="4.13.2", ) """) }) lockfile_request = rule_runner.request(GenerateJvmLockfile, [MockJvmToolLockfileSentinel()]) coordinates = sorted(i.coordinate for i in lockfile_request.artifacts) assert coordinates == [ Coordinate(group="junit", artifact="junit", version="4.13.2"), Coordinate(group="org.hamcrest", artifact="hamcrest-core", version="1.3"), ] # Ensure that an internal-only tool will not have a lockfile generated. default_lockfile_result = rule_runner.request( GenerateJvmLockfile, [MockInternalToolLockfileSentinel()]) assert default_lockfile_result.lockfile_dest == DEFAULT_TOOL_LOCKFILE
def rule_runner() -> RuleRunner: return RuleRunner( preserve_tmpdirs=True, rules=[ *config_files.rules(), *coursier_fetch_rules(), *coursier_goal_rules(), *coursier_setup_rules(), *external_tool_rules(), *source_files.rules(), *util_rules(), ], target_types=[JvmDependencyLockfile, JvmArtifact], )
def rule_runner() -> RuleRunner: return RuleRunner( rules=[ *config_files.rules(), *coursier_fetch_rules(), *coursier_setup_rules(), *external_tool_rules(), *source_files.rules(), *util_rules(), QueryRule(CoursierResolvedLockfile, (ArtifactRequirements, )), QueryRule(ResolvedClasspathEntry, (CoursierLockfileEntry, )), QueryRule(FileDigest, (ExtractFileDigest, )), ], target_types=[JvmDependencyLockfile, JvmArtifact], )
def rule_runner() -> RuleRunner: return RuleRunner( rules=[ *config_files.rules(), *source_files.rules(), *coursier_setup_rules(), *coursier_fetch_rules(), *external_tool_rules(), *util_rules(), *java_util_rules(), *process_rules(), QueryRule(BashBinary, ()), QueryRule(JdkSetup, ()), QueryRule(ProcessResult, (Process,)), ], )
def rule_runner() -> RuleRunner: rule_runner = RuleRunner( rules=[ *config_files.rules(), *coursier_fetch_rules(), *source_files.rules(), *util_rules(), QueryRule(Targets, [AddressSpecs]), QueryRule(CoursierResolvedLockfile, (ArtifactRequirements, )), QueryRule(ClasspathEntry, (CoursierLockfileEntry, )), QueryRule(FileDigest, (ExtractFileDigest, )), ], target_types=[JvmArtifactTarget], ) rule_runner.set_options(args=[], env_inherit=PYTHON_BOOTSTRAP_ENV) return rule_runner
def rule_runner() -> RuleRunner: rule_runner = RuleRunner( rules=[ *coursier_fetch_rules(), *lockfile.rules(), *coursier_setup_rules(), *external_tool_rules(), *source_files.rules(), *util_rules(), QueryRule(UserGenerateLockfiles, [RequestedJVMserResolveNames]), QueryRule(GenerateLockfileResult, [GenerateJvmLockfile]), ], target_types=[JvmArtifactTarget], ) rule_runner.set_options([], env_inherit={"PATH"}) return rule_runner