gorgeous-winter-99296
11/21/2023, 9:48 PM@rule(desc="Find all cargo packages in project")
def find_all_cargo_targets(all_targets: AllTargets) -> AllCargoTargets:
...
@rule(desc="Assign packages to workspaces")
async def assign_packages_to_workspaces(
all_cargo_targets: AllCargoTargets,
) -> CargoPackageMapping:
...
And I'm now implementing a new goal; generate-lockfiles
, which should make use of this.
@rule
async def determine_rust_user_resolves(
_: KnownCargoUserResolveNamesRequest,
cargo_targets: AllCargoTargets,
) -> KnownUserResolveNames:
...
works, but if I replace the second argument with a CargoPackageMapping
or try to query for one inside that rule, it breaks the rule graph. I'm assuming this is because of something that the assign_package_to_workspaces
rule does, but the only things it looks for is SourceFiles
, DigestContents
, and RawSpecs
. Neither of those should - I think? - need resolves to be known. Or maybe they do, in order to validate fields..?gorgeous-winter-99296
11/21/2023, 9:49 PMNo installed rules return the type BuildTargetIdentifier, and it was not provided by potential callers of @rule(pants.bsp.util_rules.targets:212:resolve_bsp_build_target_identifier(BuildTargetIdentifier, BSPBuildTargets) -> BSPBuildTargetInternal).
If that type should be computed by a rule, ensure that that rule is installed.
If it should be provided by a caller, ensure that it is included in any relevant Query or Get.
No installed rules return the type CargoSourcesRequest, and it was not provided by potential callers of @rule(pants_cargo_porcelain.util_rules.sandbox:16:cargo_sources(CargoSourcesRequest) -> SourceFiles, gets=[Get(TransitiveTargets, [TransitiveTargetsRequest]), Get(SourceFiles, [SourceFilesRequest])]).
If that type should be computed by a rule, ensure that that rule is installed.
If it should be provided by a caller, ensure that it is included in any relevant Query or Get.
No installed rules return the type EnvironmentNameRequest, and it was not provided by potential callers of @rule(pants.core.util_rules.environments:694:resolve_environment_name(EnvironmentNameRequest, EnvironmentsSubsystem, GlobalOptions) -> EnvironmentName, gets=[ChosenLocalEnvironmentName, Get(EnvironmentTarget, [EnvironmentName]), Get(EnvironmentName, [EnvironmentNameRequest])]).
If that type should be computed by a rule, ensure that that rule is installed.
If it should be provided by a caller, ensure that it is included in any relevant Query or Get.
No installed rules return the type KnownPythonUserResolveNamesRequest, and it was not provided by potential callers of @rule(pants.backend.python.goals.lockfile:210:determine_python_user_resolves(KnownPythonUserResolveNamesRequest, PythonSetup) -> KnownUserResolveNames).
If that type should be computed by a rule, ensure that that rule is installed.
If it should be provided by a caller, ensure that it is included in any relevant Query or Get.
No installed rules return the type SingleEnvironmentNameRequest, and it was not provided by potential callers of @rule(pants.core.util_rules.environments:660:resolve_single_environment_name(SingleEnvironmentNameRequest) -> EnvironmentName, gets=[Get(EnvironmentName, [EnvironmentNameRequest])]).
If that type should be computed by a rule, ensure that that rule is installed.
If it should be provided by a caller, ensure that it is included in any relevant Query or Get.
No installed rules return the type _ParseOneBSPMappingRequest, and it was not provided by potential callers of @rule(pants.bsp.util_rules.targets:137:parse_one_bsp_mapping(_ParseOneBSPMappingRequest) -> BSPBuildTargetInternal).
If that type should be computed by a rule, ensure that that rule is installed.
If it should be provided by a caller, ensure that it is included in any relevant Query or Get.
No source of dependency BSPBuildTargets for @rule(pants.bsp.util_rules.targets:212:resolve_bsp_build_target_identifier(BuildTargetIdentifier, BSPBuildTargets) -> BSPBuildTargetInternal). All potential sources were eliminated: []
No source of dependency ChosenLocalEnvironmentName for @rule(pants.core.util_rules.environments:694:resolve_environment_name(EnvironmentNameRequest, EnvironmentsSubsystem, GlobalOptions) -> EnvironmentName, gets=[ChosenLocalEnvironmentName, Get(EnvironmentTarget, [EnvironmentName]), Get(EnvironmentName, [EnvironmentNameRequest])]). All potential sources were eliminated: []
No source of dependency EnvironmentsSubsystem for @rule(pants.core.util_rules.environments:694:resolve_environment_name(EnvironmentNameRequest, EnvironmentsSubsystem, GlobalOptions) -> EnvironmentName, gets=[ChosenLocalEnvironmentName, Get(EnvironmentTarget, [EnvironmentName]), Get(EnvironmentName, [EnvironmentNameRequest])]). All potential sources were eliminated: []
No source of dependency Get(EnvironmentName, [EnvironmentNameRequest]) for @rule(pants.core.util_rules.environments:660:resolve_single_environment_name(SingleEnvironmentNameRequest) -> EnvironmentName, gets=[Get(EnvironmentName, [EnvironmentNameRequest])]). All potential sources were eliminated: []
No source of dependency Get(EnvironmentName, [EnvironmentNameRequest]) for @rule(pants.core.util_rules.environments:694:resolve_environment_name(EnvironmentNameRequest, EnvironmentsSubsystem, GlobalOptions) -> EnvironmentName, gets=[ChosenLocalEnvironmentName, Get(EnvironmentTarget, [EnvironmentName]), Get(EnvironmentName, [EnvironmentNameRequest])]). All potential sources were eliminated: []
No source of dependency Get(EnvironmentTarget, [EnvironmentName]) for @rule(pants.core.util_rules.environments:694:resolve_environment_name(EnvironmentNameRequest, EnvironmentsSubsystem, GlobalOptions) -> EnvironmentName, gets=[ChosenLocalEnvironmentName, Get(EnvironmentTarget, [EnvironmentName]), Get(EnvironmentName, [EnvironmentNameRequest])]). All potential sources were eliminated: []
No source of dependency Get(SourceFiles, [SourceFilesRequest]) for @rule(pants_cargo_porcelain.util_rules.sandbox:16:cargo_sources(CargoSourcesRequest) -> SourceFiles, gets=[Get(TransitiveTargets, [TransitiveTargetsRequest]), Get(SourceFiles, [SourceFilesRequest])]). All potential sources were eliminated: []
No source of dependency Get(TransitiveTargets, [TransitiveTargetsRequest]) for @rule(pants_cargo_porcelain.util_rules.sandbox:16:cargo_sources(CargoSourcesRequest) -> SourceFiles, gets=[Get(TransitiveTargets, [TransitiveTargetsRequest]), Get(SourceFiles, [SourceFilesRequest])]). All potential sources were eliminated: []
No source of dependency GlobalOptions for @rule(pants.core.util_rules.environments:694:resolve_environment_name(EnvironmentNameRequest, EnvironmentsSubsystem, GlobalOptions) -> EnvironmentName, gets=[ChosenLocalEnvironmentName, Get(EnvironmentTarget, [EnvironmentName]), Get(EnvironmentName, [EnvironmentNameRequest])]). All potential sources were eliminated: []
gorgeous-winter-99296
11/21/2023, 9:53 PM@rule(desc="Load Cargo.toml for Cargo target")
async def load_cargo_toml(request: CargoTomlRequest) -> CargoToml:
files = await Get(
SourceFiles,
SourceFilesRequest(
[request.sources],
),
)
gorgeous-winter-99296
11/21/2023, 9:56 PMgorgeous-winter-99296
11/21/2023, 9:58 PMgorgeous-winter-99296
11/21/2023, 10:16 PMsnapshot = await Get(
Snapshot,
PathGlobs,
request.sources.path_globs(UnmatchedBuildFileGlobs.error()),
)
a bit roundabout but solves it 🤷