pub fn resolve_cargo(&self, ctx: &GlobalContext<'_>) -> anyhow::Result<FeatureMap> {
        let config = self.cargo_make_config(ctx)?;
        let root_manifest = self.cargo_discover_root(&config)?;
        let mut workspace = self.cargo_make_workspace(&config, &root_manifest)?;
        // See the comment in resolve_guppy about avoid-dev-deps for why this is necessary.
        if !self.include_dev {
            workspace.set_require_optional_deps(false);
        }

        let compile_kind = match &self.target_platform {
            Some(platform) => CompileKind::Target(CompileTarget::new(platform)?),
            None => CompileKind::Host,
        };
        let target_data = RustcTargetData::new(&workspace, &[compile_kind])?;

        let cli_features = self.cargo_make_cli_features();
        let packages = &self.pf.packages;
        let specs: Vec<_> = if packages.is_empty() {
            // Pass in the entire workspace.
            workspace
                .members()
                .map(|package| PackageIdSpec::from_package_id(package.package_id()))
                .collect()
        } else {
            packages
                .iter()
                .map(|spec| PackageIdSpec::parse(spec))
                .collect::<anyhow::Result<_>>()?
        };

        let ws_resolve = resolve_ws_with_opts(
            &workspace,
            &target_data,
            &[compile_kind],
            &cli_features,
            &specs,
            if self.include_dev {
                HasDevUnits::Yes
            } else {
                HasDevUnits::No
            },
            // TODO: allow for target to be "any", set this to Yes in that case
            ForceAllTargets::No,
        )?;

        let targeted_resolve = ws_resolve.targeted_resolve;
        let resolved_features = ws_resolve.resolved_features;

        let mut target_map = BTreeMap::new();
        let mut host_map = BTreeMap::new();
        for pkg_id in targeted_resolve.iter() {
            // Note that for the V1 resolver the maps are going to be identical, since
            // platform-specific filtering happens much later in the process.
            // Also, use activated_features_unverified since it's possible for a particular (package
            // ID, features for) combination to be missing.
            if let Some(target_features) =
                resolved_features.activated_features_unverified(pkg_id, FeaturesFor::NormalOrDev)
            {
                target_map.insert(pkg_id.to_guppy(), target_features.to_guppy());
            }
            if let Some(host_features) =
                resolved_features.activated_features_unverified(pkg_id, FeaturesFor::HostDep)
            {
                host_map.insert(pkg_id.to_guppy(), host_features.to_guppy());
            }
        }

        Ok(FeatureMap {
            target_map,
            host_map,
        })
    }
Resolves data for this query using Cargo.
internal-tools/cargo-compare/src/common.rs