Makefile 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. UNAME_S = $(shell uname -s)
  2. ifeq ($(UNAME_S),Linux)
  3. CFLAGS = -Xcc -DTSI_OPENSSL_ALPN_SUPPORT=0 -Xlinker -lz
  4. else
  5. CFLAGS = -Xcc -ISources/BoringSSL/include
  6. endif
  7. all:
  8. swift build $(CFLAGS)
  9. cp .build/debug/protoc-gen-swift .
  10. cp .build/debug/protoc-gen-swiftgrpc .
  11. plugin:
  12. swift build $(CFLAGS) --product protoc-gen-swift --static-swift-stdlib -c release
  13. swift build $(CFLAGS) --product protoc-gen-swiftgrpc --static-swift-stdlib -c release
  14. cp .build/release/protoc-gen-swift .
  15. cp .build/release/protoc-gen-swiftgrpc .
  16. project:
  17. swift package $(CFLAGS) generate-xcodeproj --output SwiftGRPC.xcodeproj
  18. @-ruby fix-project-settings.rb SwiftGRPC.xcodeproj || echo "Consider running 'sudo gem install xcodeproj' to automatically set correct indentation settings for the generated project."
  19. project-carthage:
  20. swift package generate-xcodeproj --output SwiftGRPC-Carthage.xcodeproj
  21. @sed -i '' -e "s|$(PWD)|..|g" SwiftGRPC-Carthage.xcodeproj/project.pbxproj
  22. @sed -i '' -e "s|$(PWD)|../../..|g" SwiftGRPC-Carthage.xcodeproj/GeneratedModuleMap/BoringSSL/module.modulemap
  23. @ruby fix-project-settings.rb SwiftGRPC-Carthage.xcodeproj || echo "xcodeproj ('sudo gem install xcodeproj') is required in order to generate the Carthage-compatible project!"
  24. @ruby patch-carthage-project.rb SwiftGRPC-Carthage.xcodeproj || echo "xcodeproj ('sudo gem install xcodeproj') is required in order to generate the Carthage-compatible project!"
  25. test: all
  26. swift test $(CFLAGS)
  27. test-echo: all
  28. cp .build/debug/Echo .
  29. ./Echo serve & /bin/echo $$! > echo.pid
  30. ./Echo get | tee test.out
  31. ./Echo expand | tee -a test.out
  32. ./Echo collect | tee -a test.out
  33. ./Echo update | tee -a test.out
  34. kill -9 `cat echo.pid`
  35. diff -u test.out Sources/Examples/Echo/test.gold
  36. test-plugin:
  37. swift build $(CFLAGS) --product protoc-gen-swiftgrpc
  38. protoc Sources/Examples/Echo/echo.proto --proto_path=Sources/Examples/Echo --plugin=.build/debug/protoc-gen-swift --plugin=.build/debug/protoc-gen-swiftgrpc --swiftgrpc_out=/tmp --swiftgrpc_opt=TestStubs=true
  39. diff -u /tmp/echo.grpc.swift Sources/Examples/Echo/Generated/echo.grpc.swift
  40. xcodebuild: project
  41. xcodebuild -project SwiftGRPC.xcodeproj -configuration "Debug" -parallelizeTargets -target SwiftGRPC -target Echo -target Simple -target protoc-gen-swiftgrpc build
  42. build-carthage:
  43. carthage build -project SwiftGRPC-Carthage.xcodeproj --no-skip-current
  44. build-carthage-debug:
  45. carthage build -project SwiftGRPC-Carthage.xcodeproj --no-skip-current --configuration Debug --platform iOS, macOS
  46. clean:
  47. -rm -rf Packages
  48. -rm -rf .build build
  49. -rm -rf SwiftGRPC.xcodeproj
  50. -rm -rf Package.pins Package.resolved
  51. -rm -rf protoc-gen-swift protoc-gen-swiftgrpc
  52. -cd Examples/Google/Datastore && make clean
  53. -cd Examples/Google/NaturalLanguage && make clean
  54. -cd Examples/Google/Spanner && make clean