Skip to content

Extension scheme when contains application target  #1523

Open
@xxi511

Description

sample.zip

When an extension scheme contains application target.
wasCreatedForAppExtension becomes false.
Screenshot 2024-12-23 at 14 58 24

In SchemeGenerator.

        if let targetName = scheme.run?.executable {
            schemeTarget = project.getTarget(targetName)
        } else {
            guard let firstTarget = scheme.build.targets.first else {
                throw SchemeGenerationError.missingBuildTargets(scheme.name)
            }
            let name = scheme.build.targets.first { $0.buildTypes.contains(.running) }?.target.name ?? firstTarget.target.name
            schemeTarget = target ?? project.getTarget(name)
        }

If enables askForAppToLaunch, the scheme.run?.executable is Ask on Launch
So schemeTarget is nil -> wasCreatedForAppExtension is false.

Disable askForAppToLaunch to run else block still not working in this case.
In Project.init(spec:)
spec.resolvedDictionary() sorts targets so the first target is sample not sampleShare.
schemeTarget is sample -> wasCreatedForAppExtension is false.

any suggestions?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions