Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building Swift runtime failed when running swift package generate-xcodeproj in boot.py #4526

Open
youny626 opened this issue Feb 5, 2024 · 3 comments

Comments

@youny626
Copy link

youny626 commented Feb 5, 2024

I am building the Swift runtime by running python boot.py --gen-xcodeproj in antlr4/runtime/Swift (following the instructions in https://github.com/antlr/antlr4/blob/master/doc/swift-target.md)
I got this error:

warning: 'antlr4': Invalid Exclude '/Users/zhiruzhu/Desktop/Apple-Escrow/antlr4/runtime/Swift/Tests/Antlr4Tests/runtime/Swift/Tests/VisitorCalc.g4': File not found.
warning: 'antlr4': Invalid Exclude '/Users/zhiruzhu/Desktop/Apple-Escrow/antlr4/runtime/Swift/Tests/Antlr4Tests/runtime/Swift/Tests/VisitorBasic.g4': File not found.
warning: 'antlr4': Invalid Exclude '/Users/zhiruzhu/Desktop/Apple-Escrow/antlr4/runtime/Swift/Tests/Antlr4Tests/runtime/Swift/Tests/LexerA.g4': File not found.
warning: 'antlr4': Invalid Exclude '/Users/zhiruzhu/Desktop/Apple-Escrow/antlr4/runtime/Swift/Tests/Antlr4Tests/runtime/Swift/Tests/Threading.g4': File not found.
warning: 'antlr4': Invalid Exclude '/Users/zhiruzhu/Desktop/Apple-Escrow/antlr4/runtime/Swift/Tests/Antlr4Tests/runtime/Swift/Tests/LexerB.g4': File not found.
error: Unknown subcommand or plugin name ‘generate-xcodeproj’
Usage: swift package <options> <subcommand>
  See 'package -help' for more information.
Error: command 'swift package generate-xcodeproj' exited with status 64

Here's my swift version

swift-driver version: 1.87.3 Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)
Target: arm64-apple-macosx14.0

It seems like generate-xcodeproj is already removed from Swift. Could you help solve this?

@ericvergnaud
Copy link
Contributor

For a quick fix, I suspect you might have to fallback to a version of Swift that supports this command.
See https://medium.com/xcblog/switching-swift-versions-inside-xcode-using-toolchains-755b28831c43

But you are also welcome to provide a PR that updates boot-py to support recent versions of Swift that no longer require or support ‘generate-xcodeproj’

@digitalloophole
Copy link

According to https://forums.swift.org/t/rfc-deprecating-generate-xcodeproj/42159 generate_package is deprecated. So I commented out the call "swift package generate-xcodeporj" on line 172. However I don't see a Package.swift file which should have been generated by:
check_call([java, "-jar", a4, "-Dlanguage=Swift", grammar, "-visitor", "-o", grammar_folder + "/gen"])
Otherwise what would the call "swift package generate-xcodeporj" have to generate an Xcode project from?

@youny626
Copy link
Author

youny626 commented Feb 23, 2024

According to https://forums.swift.org/t/rfc-deprecating-generate-xcodeproj/42159 generate_package is deprecated. So I commented out the call "swift package generate-xcodeporj" on line 172. However I don't see a Package.swift file which should have been generated by: check_call([java, "-jar", a4, "-Dlanguage=Swift", grammar, "-visitor", "-o", grammar_folder + "/gen"]) Otherwise what would the call "swift package generate-xcodeporj" have to generate an Xcode project from?

I actually figured it out. I also commented out the line swift package generate-xcodeproj and ran boot.py. Then I manually created the swift package by roughly following this guide https://developer.apple.com/documentation/xcode/creating-a-standalone-swift-package-with-xcode and configuring the Package.swift file. Then I added the package as a local package dependency to my own xcode project.

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

No branches or pull requests

3 participants