Makefile 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 "You may need to install xcodeproj ('sudo gem install xcodeproj')!"
  16. @ruby remove-unwanted-targets-for-carthage.rb SwiftGRPC-Carthage.xcodeproj || echo "xcodeproj ('sudo gem install xcodeproj') is required in order to generate the Carthage-compatible project!"
  17. @ruby add-swift-resolve-prebuild-phase.rb || echo "xcodeproj ('sudo gem install xcodeproj') is required in order to generate the Carthage-compatible project!"
  18. test: all
  19. swift test $(CFLAGS)
  20. test-echo: all
  21. cp .build/debug/Echo .
  22. ./Echo serve & /bin/echo $$! > echo.pid
  23. ./Echo get | tee test.out
  24. ./Echo expand | tee -a test.out
  25. ./Echo collect | tee -a test.out
  26. ./Echo update | tee -a test.out
  27. kill -9 `cat echo.pid`
  28. diff -u test.out Sources/Examples/Echo/test.gold
  29. test-plugin:
  30. swift build $(CFLAGS) --product protoc-gen-swiftgrpc
  31. 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
  32. diff -u /tmp/echo.grpc.swift Sources/Examples/Echo/Generated/echo.grpc.swift
  33. xcodebuild: project
  34. xcodebuild -project SwiftGRPC.xcodeproj -configuration "Debug" -parallelizeTargets -target SwiftGRPC -target Echo -target Simple -target protoc-gen-swiftgrpc build
  35. build-carthage:
  36. carthage build --no-skip-current
  37. clean:
  38. -rm -rf Packages
  39. -rm -rf .build build
  40. -rm -rf SwiftGRPC.xcodeproj
  41. -rm -rf Package.pins Package.resolved
  42. -rm -rf protoc-gen-swift protoc-gen-swiftgrpc
  43. -cd Examples/Echo/PackageManager && make clean
  44. -cd Examples/Simple/PackageManager && make clean