yonaskolb / yonaskolb/XcodeGen

Extension scheme when contains application target

Open
#1,523 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
8.8k
Forks
908
Avg merge
17d 14h
Merged PRs (30d)
2

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?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in SchemeGenerator and trace how scheme.run.executable and the first resolved build target determine schemeTarget. Reproduce the extension-target case from sample.zip, then inspect Project.init(spec:) and spec.resolvedDictionary() to confirm target ordering. Done means an extension scheme with Ask on Launch or the relevant target selection preserves wasCreatedForAppExtension correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.