generate_client_protocol.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/usr/bin/env bash
  2. #
  3. # Licensed to the Apache Software Foundation (ASF) under one or more
  4. # contributor license agreements. See the NOTICE file distributed with
  5. # this work for additional information regarding copyright ownership.
  6. # The ASF licenses this file to You under the Apache License, Version 2.0
  7. # (the "License"); you may not use this file except in compliance with
  8. # the License. You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. #
  18. SCRIPT_DIR="$(dirname "$0")"
  19. SEATUNNEL_ENGINE_HOME="$(cd "$SCRIPT_DIR/"; pwd)"
  20. PYTHON="$(which python3 2>/dev/null)"
  21. PIP3="$(which pip3 2>/dev/null)"
  22. GIT="$(which git 2>/dev/null)"
  23. PROTOCOL_DIRECTORY=`mktemp -d 2>/dev/null || mktemp -d -t 'protocol'`
  24. if [ -z "$PYTHON" ]; then
  25. echo "Python 3 could not be found in your system."
  26. exit 1
  27. fi
  28. if [ -z "$PIP3" ]; then
  29. echo "PIP 3 could not be found in your system."
  30. exit 1
  31. fi
  32. if [ -z "$GIT" ]; then
  33. echo "Git could not be found in your system."
  34. exit 1
  35. fi
  36. echo $SCRIPT_DIR
  37. echo $SEATUNNEL_ENGINE_HOME
  38. echo $PROTOCOL_DIRECTORY
  39. $GIT clone --depth=1 https://github.com/hazelcast/hazelcast-client-protocol.git $PROTOCOL_DIRECTORY
  40. cd $PROTOCOL_DIRECTORY
  41. $PIP3 install -r requirements.txt
  42. $PYTHON generator.py -r $SEATUNNEL_ENGINE_HOME -p $SEATUNNEL_ENGINE_HOME/seatunnel-engine/seatunnel-engine-core/src/main/resources/client-protocol-definition \
  43. -o /tmp/seatunnel-engine/seatunnel-engine-core/src/main/java/org/apache/seatunnel/engine/core/protocol/codec \
  44. -n org.apache.seatunnel.engine.core.protocol.codec --no-binary --no-id-check
  45. rm -rf $PROTOCOL_DIRECTORY