generate_jni_header_files.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/usr/bin/env bash
  2. set -e
  3. set -x
  4. cd "$(dirname "$0")"
  5. bazel build all_streaming_tests_deploy.jar
  6. function generate_one()
  7. {
  8. file=${1//./_}.h
  9. javah -classpath ../../bazel-bin/streaming/java/all_streaming_tests_deploy.jar "$1"
  10. # prepend licence first
  11. cat <<EOF > ../src/lib/java/"$file"
  12. // Copyright 2017 The Ray Authors.
  13. //
  14. // Licensed under the Apache License, Version 2.0 (the "License");
  15. // you may not use this file except in compliance with the License.
  16. // You may obtain a copy of the License at
  17. //
  18. // http://www.apache.org/licenses/LICENSE-2.0
  19. //
  20. // Unless required by applicable law or agreed to in writing, software
  21. // distributed under the License is distributed on an "AS IS" BASIS,
  22. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  23. // See the License for the specific language governing permissions and
  24. // limitations under the License.
  25. EOF
  26. # then append the generated header file
  27. cat "$file" >> ../src/lib/java/"$file"
  28. rm -f "$file"
  29. }
  30. generate_one io.ray.streaming.runtime.transfer.channel.ChannelId
  31. generate_one io.ray.streaming.runtime.transfer.DataReader
  32. generate_one io.ray.streaming.runtime.transfer.DataWriter
  33. generate_one io.ray.streaming.runtime.transfer.TransferHandler
  34. rm -f io_ray_streaming_*.h