Skip to content

Add a new CopyFilesBuildPhase, "Embed ExtensionKit Extensions"#1230

Merged
yonaskolb merged 8 commits intoyonaskolb:masterfrom
mtj0928:support-extension-kit
Jul 21, 2022
Merged

Add a new CopyFilesBuildPhase, "Embed ExtensionKit Extensions"#1230
yonaskolb merged 8 commits intoyonaskolb:masterfrom
mtj0928:support-extension-kit

Conversation

@mtj0928
Copy link
Copy Markdown
Contributor

@mtj0928 mtj0928 commented Jul 17, 2022

close #1224

As @freddi-kit mentioned on #1224, extension kit extensions must be embedded as a separate copyFilesPhase from app extensions.
In this PR, I changed the followings related to extension kit extensions.

  • Added "Embed ExtensionKit Extensions" as a new CopyFilesBuildPhase 0371a6c
  • Fixed explicitFileType for extension kit extensions bf71a5d

FYI:
XcodeProj resolves the fileType from the file extension only, but extension kit extension and app extension have different fileType even though they have the same file extension.
So, I added productType as a new argument to fileType(path), to resolve the fileType from the combination of the file extension and the product type.

@mtj0928 mtj0928 changed the title Added a new CopyFilesBuildPhase, "Embed ExtensionKit Extensions" Add a new CopyFilesBuildPhase, "Embed ExtensionKit Extensions" Jul 17, 2022
@yonaskolb yonaskolb requested a review from freddi-kit July 18, 2022 04:47
Copy link
Copy Markdown
Collaborator

@freddi-kit freddi-kit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perfect from my sight

Comment on lines +739 to +743
} else if dependencyTarget.type.isExtension && dependencyTarget.type != .extensionKitExtension {
// embed app extension
extensions.append(embedFile)
} else if dependencyTarget.type == .extensionKitExtension {
extensionKitExtensions.append(embedFile)
Copy link
Copy Markdown
Collaborator

@freddi-kit freddi-kit Jul 18, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be better to write like below to consider the other addtional future cases of dependencyTarget.type when dependencyTarget.type.isExtension is true

else if dependencyTarget.type.isExtension {
     // we may add other properties == 
     if dependencyTarget.type == .extensionKitExtension {
        extensionKitExtensions.append(embedFile)
     } else {
         extensions.append(embedFile)
     }
}

Copy link
Copy Markdown
Owner

@yonaskolb yonaskolb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @mtj0928!
Would it be possible for you to add an example extension in Test/Fixtures/TestProject? That's a project that tries to have every single XcodeGen feature in it, so that any diffs in the generation are tracked.

@mtj0928
Copy link
Copy Markdown
Contributor Author

mtj0928 commented Jul 18, 2022

Thank you for your reviews!

@freddi-kit
I fixed the if statement structure based on your comment.

@yonaskolb
I added a new example extension, but the new product type com.apple.product-type.extensionkit-extension is supported on only Xcode 14 or later.
Thus, CI failed on Xcode 12.5.1 and Xcode 13.0.
Do you have any ideas to pass the check?

@yonaskolb
Copy link
Copy Markdown
Owner

To fix CI properly, we'd need a seperate Xcode14 fixture project that only runs in a seperate action with Xcode 14 in Github Actions.
If you feel comfortable doing that, that would be fantastic. Otherwise we can wait until Xcode 14 launches before merging this.

@alessionossa
Copy link
Copy Markdown

alessionossa commented Jul 20, 2022

Otherwise we can wait until Xcode 14 launches before merging this.

This would be a blow to the teams that rely on XcodeGen and would like to implement ExtensionKit Extensions like AppIntents in time for iOS 16 launch. 😥

@yonaskolb
Copy link
Copy Markdown
Owner

Otherwise we can wait until Xcode 14 launches before merging this.

This would be a blow to the teams that rely on XcodeGen and would like to implement ExtensionKit Extensions like AppIntents in time for iOS 16 launch. 😥

@alessionossa makes sense, I can appreciate that. @mtj0928 if the CI changes are too much work, I'm happy with you just commenting out the changes to the project.yml in this PR for now. Up to you 👍

@mtj0928
Copy link
Copy Markdown
Contributor Author

mtj0928 commented Jul 20, 2022

@yonaskolb
I'd like to try adding a new fixture project which runs with Xcode 14, but even if I do it, I think we cannot run it because GitHub Actions don't support Xcode 14 yet.
Thus, in this PR, I will comment out the changes in the project.yml.

I'd like to try creating the new fixture project for Xcode 14 as another issue.

@mtj0928
Copy link
Copy Markdown
Contributor Author

mtj0928 commented Jul 20, 2022

I've created a new issue #1232.
(Please modify it if needed.)

Copy link
Copy Markdown
Collaborator

@freddi-kit freddi-kit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is ready for merging 👍

@freddi-kit
Copy link
Copy Markdown
Collaborator

@yonaskolb I think we can merge it in master

Copy link
Copy Markdown
Owner

@yonaskolb yonaskolb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks @mtj0928! 🙏

@yonaskolb yonaskolb merged commit da8aad0 into yonaskolb:master Jul 21, 2022
@yonaskolb
Copy link
Copy Markdown
Owner

Released in 2.31.0

@mtj0928 mtj0928 deleted the support-extension-kit branch July 25, 2022 02:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extension Kit extension support for Xcode14

4 participants