vinivendra / Gryphon

The Swift to Kotlin translator.
https://vinivendra.github.io/Gryphon/
Other
609 stars 46 forks source link

Support -UseModernBuildSystem for xcodebuild #113

Open kyzmitch opened 2 years ago

kyzmitch commented 2 years ago

This is needed to support projects which uses SwiftPackageManager frameworks.

What's in this pull request?

Replace this with a description of what you changed and why. Provide some links to existing discussions if there are any.

Does this resolve an open issue?

Yeah, it resolves #123.

Checklist for submitting a pull request:

Example of swift compiler step from xcodebuild command, it wasn't able to parse it without changes from this PR:

CompileSwiftSources normal arm64 com.apple.xcode.tools.swift.compiler (in target 'FrameworkNameKit' from project 'AppName')
    cd /Users/kyzmitch/prj/LegacyAppName/AppName
    export DEVELOPER_DIR\=/Applications/Xcode-13.2.1.app/Contents/Developer
    export SDKROOT\=/Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.2.sdk
    /Applications/Xcode-13.2.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -incremental -module-name FrameworkNameKit -O -whole-module-optimization -enforce-exclusivity\=checked @/Users/kyzmitch/prj/LegacyAppName/AppName/build/AppName.build/Release-iphoneos/FrameworkNameKit.build/Objects-normal/arm64/FrameworkNameKit.SwiftFileList -sdk /Applications/Xcode-13.2.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS15.2.sdk -target arm64-apple-ios13.0 -g -Xfrontend -serialize-debugging-options -embed-bitcode-marker -swift-version 5 -I /Users/kyzmitch/prj/LegacyAppName/AppName/build/Release-iphoneos -F /Users/kyzmitch/prj/LegacyAppName/AppName/build/Release-iphoneos -c -num-threads 8 -output-file-map /Users/kyzmitch/prj/LegacyAppName/AppName/build/AppName.build/Release-iphoneos/FrameworkNameKit.build/Objects-normal/arm64/FrameworkNameKit-OutputFileMap.json -parseable-output -serialize-diagnostics -emit-dependencies -emit-module -emit-module-path /Users/kyzmitch/prj/LegacyAppName/AppName/build/AppName.build/Release-iphoneos/FrameworkNameKit.build/Objects-normal/arm64/FrameworkNameKit.swiftmodule -Xcc -I/Users/kyzmitch/prj/LegacyAppName/AppName/build/AppName.build/Release-iphoneos/FrameworkNameKit.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/kyzmitch/prj/LegacyAppName/AppName/build/AppName.build/Release-iphoneos/FrameworkNameKit.build/FrameworkNameKit-generated-files.hmap -Xcc -I/Users/kyzmitch/prj/LegacyAppName/AppName/build/AppName.build/Release-iphoneos/FrameworkNameKit.build/FrameworkNameKit-own-target-headers.hmap -Xcc -I/Users/kyzmitch/prj/LegacyAppName/AppName/build/AppName.build/Release-iphoneos/FrameworkNameKit.build/FrameworkNameKit-all-non-framework-target-headers.hmap -Xcc -ivfsoverlay -Xcc /Users/kyzmitch/prj/LegacyAppName/AppName/build/AppName.build/Release-iphoneos/FrameworkNameKit.build/all-product-headers.yaml -Xcc -iquote -Xcc /Users/kyzmitch/prj/LegacyAppName/AppName/build/AppName.build/Release-iphoneos/FrameworkNameKit.build/FrameworkNameKit-project-headers.hmap -Xcc -I/Users/kyzmitch/prj/LegacyAppName/AppName/build/Release-iphoneos/include -Xcc -I/Users/kyzmitch/prj/LegacyAppName/AppName/build/AppName.build/Release-iphoneos/FrameworkNameKit.build/DerivedSources-normal/arm64 -Xcc -I/Users/kyzmitch/prj/LegacyAppName/AppName/build/AppName.build/Release-iphoneos/FrameworkNameKit.build/DerivedSources/arm64 -Xcc -I/Users/kyzmitch/prj/LegacyAppName/AppName/build/AppName.build/Release-iphoneos/FrameworkNameKit.build/DerivedSources -emit-objc-header -emit-objc-header-path /Users/kyzmitch/prj/LegacyAppName/AppName/build/AppName.build/Release-iphoneos/FrameworkNameKit.build/Objects-normal/arm64/FrameworkNameKit-Swift.h -import-underlying-module -Xcc -ivfsoverlay -Xcc /Users/kyzmitch/prj/LegacyAppName/AppName/build/AppName.build/Release-iphoneos/FrameworkNameKit.build/unextended-module-overlay.yaml -working-directory /Users/kyzmitch/prj/LegacyAppName/AppName
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
vinivendra commented 2 years ago

Hey @kyzmitch, I noticed it's been a while since you updated this branch, so I wanted to offer some help (no pressure, I know life can get busy). Is there anything you want to ask? Would you like me to try to finish this feature for you?

kyzmitch commented 2 years ago

@vinivendra thanks for the help, I still need this to be supported, but it's not fully tested yet. I'm currently finishing preparing my own Swift project (Framework) before using Gryphon. If I remember it correctly, last time I was able to initialize the project without any errors, but wasn't able to convert the Framework automatically, I know that it is still an option to convert file by file, but wanted to do it automatically. Basically I was planning to finish this PR probably in current month, but if you have free time it would be great.

kyzmitch commented 2 years ago

hey @vinivendra , now I'm not sure that will be bale to finish this in the near time, would be glad if you help with this PR.