Avatar
norio_nomura 4/22/2019 2:05 AM
SwiftASTでswift package generate-xcodeprojしてswift run swift-ast parse Sources/SwiftAST/main.swift -buildCommand xcodebuild -scheme SwiftASTで言われます。
2:05 AM
$ swift package generate-xcodeproj warning: invalid duplicate target dependency declaration 'swift-build' in target 'FunctionalPerformanceTests' warning: invalid duplicate target dependency declaration 'swift-package' in target 'FunctionalPerformanceTests' generated: ./SwiftAST.xcodeproj $ swift run swift-ast parse Sources/SwiftAST/main.swift -buildCommand xcodebuild -scheme SwiftAST warning: invalid duplicate target dependency declaration 'swift-build' in target 'FunctionalPerformanceTests' warning: invalid duplicate target dependency declaration 'swift-package' in target 'FunctionalPerformanceTests' Reading project settings... Building dependencies... Parsing... failed to run the following command: '/usr/bin/xcrun swift -frontend -suppress-warnings -dump-ast -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/../../../Developer/Library/Frameworks -target x86_64-apple-macosx10.10 -I /Users/norio/Library/Developer/Xcode/DerivedData/SwiftAST-gglvpwfxcdqcbehkwkywmelahzns/Build/Products/Debug -F /Users/norio/Library/Developer/Xcode/DerivedData/SwiftAST-gglvpwfxcdqcbehkwkywmelahzns/Build/Products/Debug -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -primary-file /Users/norio/github/SwiftAST/Sources/SwiftAST/main.swift /Users/norio/github/SwiftAST/Sources/SwiftAST/Errors.swift /Users/norio/github/SwiftAST/Sources/SwiftAST/ParseTool.swift /Users/norio/github/SwiftAST/Sources/SwiftAST/SwiftASTTool.swift /Users/norio/github/SwiftAST/Sources/SwiftAST/SwiftBuildTool.swift /Users/norio/github/SwiftAST/Sources/SwiftAST/XcodebuildTool.swift' output: <unknown>:0: error: missing required module 'clibc'
🙏 1
2:11 AM
SourceKittenでもSourceKitへ渡すswiftcパラメータの構築をやっていて、
  • xcodebuildのログからswiftcへ渡されるパラメータを取得
  • XcodeのNew Build SystemがDerivedData内に作成するllbuildマニフェストから取得
  • SwiftPMのllbuildマニフェストdebug.ymlから取得
という3パターンをサポートしてます。 https://github.com/jpsim/SourceKitten/blob/master/Source/SourceKittenFramework/Module.swift
(edited)
An adorable little framework and command line tool for interacting with SourceKit. - jpsim/SourceKitten