Makefile 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. UNAME_S = $(shell uname -s)
  2. ifeq ($(UNAME_S),Linux)
  3. CFLAGS = -Xcc -DTSI_OPENSSL_ALPN_SUPPORT=0
  4. else
  5. CFLAGS = -Xcc -ISources/BoringSSL/include
  6. endif
  7. all:
  8. swift build -v $(CFLAGS)
  9. cp .build/debug/protoc-gen-swift .
  10. cp .build/debug/protoc-gen-swiftgrpc .
  11. project:
  12. swift package generate-xcodeproj
  13. @-ruby fix-project-settings.rb || echo "Consider running 'sudo gem install xcodeproj' to automatically set correct indentation settings for the generated project."
  14. test: all
  15. swift test -v $(CFLAGS)
  16. test-echo: all
  17. cp .build/debug/Echo .
  18. ./Echo serve & /bin/echo $$! > echo.pid
  19. ./Echo get | tee test.out
  20. ./Echo expand | tee -a test.out
  21. ./Echo collect | tee -a test.out
  22. ./Echo update | tee -a test.out
  23. kill -9 `cat echo.pid`
  24. diff -u test.out Sources/Examples/Echo/test.gold
  25. test-plugin:
  26. swift build -v $(CFLAGS) --product protoc-gen-swiftgrpc
  27. 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
  28. diff -u /tmp/echo.grpc.swift Sources/Examples/Echo/Generated/echo.grpc.swift
  29. clean:
  30. rm -rf Packages
  31. rm -rf .build
  32. rm -rf SwiftGRPC.xcodeproj
  33. rm -rf Package.pins Package.resolved
  34. rm -rf protoc-gen-swift protoc-gen-swiftgrpc
  35. cd Examples/Echo/PackageManager; make clean
  36. cd Examples/Simple/PackageManager; make clean