kareman / SwiftShell

A Swift framework for shell scripting.
https://kareman.github.io/SwiftShell
MIT License
1.03k stars 87 forks source link

Cyclic Dependency #73

Closed scifiman closed 5 years ago

scifiman commented 5 years ago

When building a new instance of SwiftShell using the init script, I received an error about a cyclic dependency.

Creating executable package: SwiftShell Creating Package.swift Creating README.md Creating .gitignore Creating Sources/ Creating Sources/SwiftShell/main.swift Creating Tests/ Creating Tests/LinuxMain.swift Creating Tests/SwiftShellTests/ Creating Tests/SwiftShellTests/SwiftShellTests.swift Creating Tests/SwiftShellTests/XCTestManifests.swift error: cyclic dependency declaration found: SwiftShell -> SwiftShell 'SwiftShell' /Users/username/Documents/SwiftShell: error: cyclic dependency declaration found: SwiftShell -> SwiftShell

kareman commented 5 years ago

Do you mean you are using the Misc/swiftshell-init script? I just tested it on my computer and it was working fine. Can you run this command from the same directory to see what version of Swift you are using?

swift -version
kareman commented 5 years ago

@scifiman I’m closing this for lack of information. Feel free to reopen it if you still have this problem.

scifiman commented 4 years ago

@kareman I am reopening this, but it's probably just a tidbit of info I'm missing that will fix this. I somehow got this working in 2019 and have been using it since, but I'm compiling a new version of my app and it is complaining that I need to recompile swiftshell to the current Swift version. So, I grabbed the swiftshell-init file again and got the same cyclic dependency error.

Here's my command: ./swiftshell-init swiftshell It seems to not give the error if I specify a different folder name, i.e. swiftshell2. However, when I do that and import the framework into my app in Xcode, it can't find swiftshell when I use the import command.

What am I doing wrong?

scifiman commented 4 years ago

Well, I think I figured out what I did last time and got it working this time. I used the command and successfully built the framework as swiftshell2. So apparently, you have to name it something different than swiftshell. Then, instead of clicking "+" and adding the framework to the project, I had to "Add files" to my project in Xcode so they were copied to a path inside the application and set to use Absolute Path instead of Relative Path. Xcode recognized it as a framework and automatically added the configuration. Then I was able to successfully build my application.

I hope this helps someone else. Thanks for the great work on this project. It has been extremely useful.

kareman commented 4 years ago

I think I see the problem. If you're going to use SwiftShell in an already existing Xcode project, you do not need to use swiftshell-init (it is for creating new Xcode projects). Instead you can add it as a Swift package dependency in your already existing Xcode project.

scifiman commented 4 years ago

Thank you! I didn't know about that functionality.