Makefile 2.1 KB

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