|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SRC_DIR=proto/mlagents_envs/communicator_objects |
|
DST_DIR_C=../com.unity.ml-agents/Runtime/Grpc/CommunicatorObjects |
|
DST_DIR_P=../ml-agents-envs |
|
PROTO_PATH=proto |
|
PYTHON_PACKAGE=mlagents_envs/communicator_objects |
|
|
|
|
|
rm -rf $DST_DIR_C |
|
rm -rf $DST_DIR_P/$PYTHON_PACKAGE |
|
mkdir -p $DST_DIR_C |
|
mkdir -p $DST_DIR_P/$PYTHON_PACKAGE |
|
|
|
|
|
|
|
$COMPILER/protoc --proto_path=proto --csharp_opt=internal_access --csharp_out $DST_DIR_C $SRC_DIR/*.proto |
|
$COMPILER/protoc --proto_path=proto --python_out=$DST_DIR_P --mypy_out=$DST_DIR_P $SRC_DIR/*.proto |
|
|
|
|
|
|
|
GRPC=unity_to_external.proto |
|
|
|
$COMPILER/protoc --proto_path=proto --csharp_out=$DST_DIR_C --grpc_out=internal_access:$DST_DIR_C $SRC_DIR/$GRPC --plugin=protoc-gen-grpc=$COMPILER/grpc_csharp_plugin |
|
python3 -m grpc_tools.protoc --proto_path=proto --python_out=$DST_DIR_P --grpc_python_out=$DST_DIR_P $SRC_DIR/$GRPC |
|
|
|
|
|
|
|
|
|
for FILE in $DST_DIR_P/$PYTHON_PACKAGE/*.py |
|
do |
|
FILE=${FILE##*/} |
|
|
|
echo from .${FILE%.py} import \* >> $DST_DIR_P/$PYTHON_PACKAGE/__init__.py |
|
done |
|
|
|
|
|
echo "#if UNITY_EDITOR || UNITY_STANDALONE |
|
#define MLA_SUPPORTED_TRAINING_PLATFORM |
|
#endif |
|
#if MLA_SUPPORTED_TRAINING_PLATFORM |
|
`cat $DST_DIR_C/UnityToExternalGrpc.cs` |
|
#endif" > $DST_DIR_C/UnityToExternalGrpc.cs |
|
|
|
|
|
rm $DST_DIR_P/$PYTHON_PACKAGE/__init__.py |
|
touch $DST_DIR_P/$PYTHON_PACKAGE/__init__.py |
|
|