generate_jni_header_files.sh 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/usr/bin/env bash
  2. set -e
  3. set -x
  4. cd "$(dirname "$0")"
  5. (cd .. && bazel build //java:all_tests_deploy.jar)
  6. function generate_one()
  7. {
  8. file=${2//./_}.h
  9. javac -h ./ "$1" -classpath ../bazel-bin/java/all_tests_deploy.jar -d runtime/target/
  10. clang-format -i "$file"
  11. cat <<EOF > ../src/ray/core_worker/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. cat "$file" >> ../src/ray/core_worker/lib/java/"$file"
  27. rm -f "$file"
  28. }
  29. generate_one runtime/src/main/java/io/ray/runtime/RayNativeRuntime.java io.ray.runtime.RayNativeRuntime
  30. generate_one runtime/src/main/java/io/ray/runtime/task/NativeTaskSubmitter.java io.ray.runtime.task.NativeTaskSubmitter
  31. generate_one runtime/src/main/java/io/ray/runtime/context/NativeWorkerContext.java io.ray.runtime.context.NativeWorkerContext
  32. generate_one runtime/src/main/java/io/ray/runtime/actor/NativeActorHandle.java io.ray.runtime.actor.NativeActorHandle
  33. generate_one runtime/src/main/java/io/ray/runtime/object/NativeObjectStore.java io.ray.runtime.object.NativeObjectStore
  34. generate_one runtime/src/main/java/io/ray/runtime/gcs/GlobalStateAccessor.java io.ray.runtime.gcs.GlobalStateAccessor
  35. generate_one runtime/src/main/java/io/ray/runtime/metric/NativeMetric.java io.ray.runtime.metric.NativeMetric
  36. # Remove empty files
  37. rm -f io_ray_runtime_RayNativeRuntime_AsyncContext.h
  38. rm -f io_ray_runtime_task_NativeTaskExecutor_NativeActorContext.h