XcodeGen icon indicating copy to clipboard operation
XcodeGen copied to clipboard

Extension scheme when contains application target

Open xxi511 opened this issue 1 year ago • 0 comments

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?

xxi511 avatar Dec 23 '24 07:12 xxi511