Method: XCCache::SPM::Buildable#swift_build

Defined in:
lib/xccache/spm/build.rb

#swift_build(target: nil) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/xccache/spm/build.rb', line 24

def swift_build(target: nil)
  cmd = ["swift", "build"] + swift_build_args
  cmd << "--package-path" << pkg_dir
  cmd << "--target" << (target || name)
  cmd << "--sdk" << sdk.sdk_path
  sdk.swiftc_args.each { |arg| cmd << "-Xswiftc" << arg }
  if library_evolution?
    # Workaround for swiftinterface emission
    # https://github.com/swiftlang/swift/issues/64669#issuecomment-1535335601
    cmd << "-Xswiftc" << "-enable-library-evolution"
    cmd << "-Xswiftc" << "-alias-module-names-in-module-interface"
    cmd << "-Xswiftc" << "-emit-module-interface"
    cmd << "-Xswiftc" << "-no-verify-emitted-module-interface"
  end
  Sh.run(cmd)
end