You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.
How can I convert swift files that have references to classes defined in a private pod repo, using Gryphon?
What happens:
I get the following error message when trying to build the Gryphon project from my Xcode workspace. SourceKit failed to get an expression's type. Try running gryphon init again.
What I expected to see:
I expected the file to be able to converted. Gryphon succeeds in converting the entire file when it references CGPoint just fine.
Why I think the error is related to a private Cocoapod repo:
After some investigation, it appears this error happens when I try to build the Gryphon project with a variable declaration that is defined in a private pod. When I remove the declaration, the file is able to be converted.
In my private cocoapod Framework_A, I have the following defined:
public class MyPoint{
var x : Double?
var y : Double?
public init(withX xInit:Double, withY yInit:Double){
x = xInit
y = yInit
}
In my Xcode workspace (that has Gryphon initialized in it, and that has Framework_A installed via the PodFile), I call MyPoint and the error occurs.
The --verbose output points to the variable declaration as the error:
let loc = MyPoint(withX: 0.0, withY: 0.0)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Conclusion
Do I need to add my private pod repo as an input source somehow? Any information would be greatly appreciated.
Environment
Gryphon version 0.18.1, using the Swift 5.5 parser
Xcode: 13.2.1
MacOS: Monterey 12.1
The text was updated successfully, but these errors were encountered:
Hey @dylandrones, yeah you guessed it. SourceKit needs to know every file necessary to compile your Swift code. If a declaration that you use is in another package (like a pod repo), SourceKit doesn't have enough type information and Gryphon can't go on with the compilation.
There are a few things you can try here:
Create a stub MyPoint declaration to be used only with Gryphon translations, but that's ignored in your actual app. Since SourceKit only needs the code to compile correctly, the new declaration doesn't have to work - it just has to contain the type, methods, etc that you're using. Add the file to Gryphon's xcfilelist but don't add it to Xcode, and everything should be OK.
Include your pod repo's files when calling Gryphon. You technically only need to include files that are enough for everything to compile correctly, but depending on your library, that could include all of its files.
That said, this error message could be a lot better than it is. Can you give me more information about it? Did it show up as an error on the line that references MyPoint?
I would like to perform option 2, but not sure how to add the "pod repo's files when calling Gryphon".
Since there will be more the one file from the framework, can I add a reference to the framework folder?
Is there a tutorial somewhere on how to do that?
I tried adding "Input Files" in the Xcode build phrases Call Gryphon under the Gryphon target, with no success. I am unsure of other ways to add Input files to the Gryphon call.
The error in more detail:
After building the "gryphon target" I see this error:
In the Issue Navigator, I can select "show in log"
And in the log, I can see this:
MyPoint is a class defined in a private pod repo called "MyFramework". The app builds in swift successfully.
dylandrones
changed the title
Unable to convert files that reference classes defined in I a private pod
Unable to convert files that reference classes defined in a private pod
Apr 11, 2022
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
bugSomething isn't workingquestionFurther information is requested
How can I convert swift files that have references to classes defined in a private pod repo, using Gryphon?
What happens:
I get the following error message when trying to build the Gryphon project from my Xcode workspace.
SourceKit failed to get an expression's type. Try running gryphon init again.
What I expected to see:
I expected the file to be able to converted. Gryphon succeeds in converting the entire file when it references
CGPoint
just fine.Why I think the error is related to a private Cocoapod repo:
After some investigation, it appears this error happens when I try to build the Gryphon project with a variable declaration that is defined in a private pod. When I remove the declaration, the file is able to be converted.
In my private cocoapod
Framework_A
, I have the following defined:In my Xcode workspace (that has Gryphon initialized in it, and that has
Framework_A
installed via thePodFile
), I callMyPoint
and the error occurs.The
--verbose
output points to the variable declaration as the error:Conclusion
Do I need to add my private pod repo as an input source somehow? Any information would be greatly appreciated.
Environment
Gryphon version 0.18.1, using the Swift 5.5 parser
Xcode: 13.2.1
MacOS: Monterey 12.1
The text was updated successfully, but these errors were encountered: