🎉

Package.swiftから実行ファイルを作る

2024/11/14に公開

Package.swiftを実行ファイルに変換

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc \
  -vfsoverlay /var/folders/kh/z_sc098d7t13qyx63_6qr0hm0000gn/T/TemporaryDirectory.bUFefn/vfs.yaml \
  -F /Users/uesrname/Library/Developer/Xcode/DerivedData/swift-package-manager-dknwrvpwyhaznheyunjozvvptptn/Build/Products/Debug/PackageFrameworks \
  -framework PackageDescription \
  -Xlinker -rpath \
  -Xlinker /Users/uesrname/Library/Developer/Xcode/DerivedData/swift-package-manager-dknwrvpwyhaznheyunjozvvptptn/Build/Products/Debug/PackageFrameworks \
  -target arm64-apple-macosx13.0 \
  -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.1.sdk \
  -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks \
  -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib \
  -L /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib \
  -swift-version 5 \
  -I /Users/uesrname/Library/Developer/Xcode/DerivedData/swift-package-manager-dknwrvpwyhaznheyunjozvvptptn/Build/Products/Debug \
  -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.1.sdk \
  -package-description-version 5.3.0 \
  /var/folders/kh/z_sc098d7t13qyx63_6qr0hm0000gn/T/TemporaryDirectory.kcH8HI/Package.swift \
  -o /var/folders/kh/z_sc098d7t13qyx63_6qr0hm0000gn/T/TemporaryDirectory.BJO964/Root-manifest

sandboxを使って実行ファイルを実行

/usr/bin/sandbox-exec \
  -p "(version 1)
      (deny default)
      (import \"system.sb\")
      (allow file-read*)
      (allow process*)
      (allow mach-lookup (global-name \"com.apple.lsd.mapdb\"))" \
  /var/folders/kh/z_sc098d7t13qyx63_6qr0hm0000gn/T/TemporaryDirectory.BJO964/Root-manifest \
  -fileno 7 \
  -context "{\"packageDirectory\":\"\\/var\\/folders\\/kh\\/z_sc098d7t13qyx63_6qr0hm0000gn\\/T\\/TemporaryDirectory.kcH8HI\"}"

Discussion