swift-vendoring.sh.template 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. %YAML 1.2
  2. --- |
  3. #!/bin/sh
  4. #
  5. # This file has been automatically generated from a template file.
  6. # Please make modifications to `templates/swiftgrpc-vendoring.sh.template`
  7. # instead. This file can be regenerated from the template by running
  8. # `tools/buildgen/generate_projects.sh`.
  9. #
  10. #
  11. # Copyright 2017, gRPC Authors All rights reserved.
  12. #
  13. # Licensed under the Apache License, Version 2.0 (the "License");
  14. # you may not use this file except in compliance with the License.
  15. # You may obtain a copy of the License at
  16. #
  17. # http://www.apache.org/licenses/LICENSE-2.0
  18. #
  19. # Unless required by applicable law or agreed to in writing, software
  20. # distributed under the License is distributed on an "AS IS" BASIS,
  21. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  22. # See the License for the specific language governing permissions and
  23. # limitations under the License.
  24. #
  25. # This script vendors the gRPC Core library into the
  26. # CgRPC module in a form suitable for building with
  27. # the Swift Package Manager.
  28. #
  29. <%!
  30. def grpc_private_files(libs):
  31. out = []
  32. for lib in libs:
  33. if lib.name in ("grpc", "gpr"):
  34. out += lib.get('headers', [])
  35. out += lib.get('src', [])
  36. return [f for f in out]
  37. def grpc_public_headers(libs):
  38. out = []
  39. for lib in libs:
  40. if lib.name in ("grpc", "gpr"):
  41. out += lib.get('public_headers', [])
  42. return out
  43. def grpc_private_headers(libs):
  44. out = []
  45. for lib in libs:
  46. if lib.name in ("grpc", "gpr"):
  47. out += lib.get('headers', [])
  48. return [f for f in out]
  49. def sh_multiline_list(files, indent):
  50. return ('\n' + indent*' ').join('\'%s\'' % f for f in files)
  51. %>
  52. public_headers=(${sh_multiline_list(grpc_public_headers(libs), 2)})
  53. source_files=(${sh_multiline_list(grpc_private_files(libs), 2)})
  54. private_headers=(${sh_multiline_list(grpc_private_headers(libs), 2)})