Skip to content

Latest commit

 

History

History

hello-grpc-swift

hello-grpc-swift

dev

swift -version
swift package tools-version

https://www.swift.org/download/

switch xcode version

$ gcc --version
Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: x86_64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

$ sudo xcode-select -s /Applications/Xcode.14.2.app/Contents/Developer

$ xcode-select -p
/Applications/Xcode.14.2.app/Contents/Developer

$ gcc --version
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: x86_64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.14.2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

format

brew install swiftformat
swiftformat --indent 4 --swiftversion 6.0.1 --exclude "**/*.grpc.swift,**/*.pb.swift" .

build

export PATH=/home/han/swift-6.0.1-RELEASE-ubuntu22.04/usr/bin:$PATH
```sh
swift package clean
swift build
swift build --product protoc-gen-swift
swift build --product protoc-gen-grpc-swift
export protoc_gen_swift=/mnt/d/coding/hello-grpc/hello-grpc-swift/.build/x86_64-unknown-linux-gnu/debug/protoc-gen-swift
export protoc_generate_grpc_swift=/mnt/d/coding/hello-grpc/hello-grpc-swift/.build/x86_64-unknown-linux-gnu/debug/protoc-gen-grpc-swift
sh proto2swift.sh
# 老 Mac 用上最新 macOS
# https://dortania.github.io/OpenCore-Legacy-Patcher/INSTALLER.html#creating-the-installer
# https://github.com/getlantern/lantern

# clean if meeting issue: "PCH was compiled with module cache path ..., but the path is currently ..."
rm -rf ~/Library/Developer/Xcode/DerivedData
rm -rf .build
Clean: ⇧shift+⌘cmd+K in xcode
export proxy_port=56458
export http_proxy=127.0.0.1:$proxy_port
export https_proxy=127.0.0.1:$proxy_port

run

swift run HelloServer
swift run HelloClient

prod

swift build -c release

swift build -c release -Xswiftc -cross-module-optimization

.build/release/HelloServer  
.build/release/HelloClient