export.sh 3.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #
  2. # Copyright (c) Contributors to the Open 3D Engine Project.
  3. # For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. #
  5. # SPDX-License-Identifier: Apache-2.0 OR MIT
  6. #
  7. #
  8. # This packaging script simplifies the project export command by defaulting the required and important
  9. # arguments to the values based on:
  10. # --project-path $O3DE_PROJECT_PATH <- The path to this project for exporting
  11. # --tools-build-path $TOOLS_BUILD_PATH <- The location of the tools/editor build to make sure all the tools necessary
  12. # for packaging are built and available (if applicable)
  13. # -out $OUTPUT_PATH <- The output location for the exported project. This can be set by passing in
  14. # a path to the arguments to this script. If not provided, it will default
  15. # to $O3DE_PROJECT_PATH/ProjectPackages
  16. #
  17. # Feel free to adjust any of the arguments as necessary. For more information about the project export command, type in the
  18. # following command from the engine root
  19. #
  20. # scripts\o3de.sh export-project -es ExportScripts\export_source_built_project.py --script-help
  21. #
  22. # To see the default options the export-project command will use other than the above required override arguments, you can view/edit
  23. # the parameters with the export-project-configure command
  24. #
  25. # $O3DE_PATH\scripts\o3de.bat export-project-configure --help
  26. #
  27. # To view the settings for the current project:
  28. #
  29. # $O3DE_PATH\scripts\o3de.bat export-project-configure -p $O3DE_PROJECT_PATH --list
  30. #
  31. #
  32. # Note: The location of the engine (O3DE_PATH) is hardcoded to the location of the engine that was used to generate
  33. # this project. The engine path must reflect the path to the engine on the local machine.
  34. # Resolve the current folder in order to resolve the project path
  35. SOURCE="${BASH_SOURCE[0]}"
  36. # While $SOURCE is a symlink, resolve it
  37. while [[ -h "$SOURCE" ]]; do
  38. DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
  39. SOURCE="$( readlink "$SOURCE" )"
  40. # If $SOURCE was a relative symlink (so no "/" as prefix, need to resolve it relative to the symlink base directory
  41. [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE"
  42. done
  43. DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
  44. O3DE_PROJECT_PATH=$DIR
  45. echo Using project path at $O3DE_PROJECT_PATH
  46. O3DE_PATH=${EnginePath}
  47. if [ ! -f ${O3DE_PATH}/scripts/o3de.sh ]
  48. then
  49. echo Engine path $O3DE_PATH is invalid in this script. Make sure to install the engine to $O3DE_PATH or update this script''s $O3DE_PATH to point to the installed engine path on this system.
  50. exit 1
  51. fi
  52. echo Using engine path at $O3DE_PATH
  53. if [[ $1 == "-h" ]]
  54. then
  55. echo
  56. echo "Usage: $0 EXPORT_PATH"
  57. echo "where:"
  58. echo " EXPORT_PATH The optional path to export the project package to. "
  59. echo " Default: ${O3DE_PROJECT_PATH}/ProjectPackages"
  60. echo
  61. exit 0
  62. elif [[ $1 == "" ]]
  63. then
  64. OUTPUT_PATH=${O3DE_PROJECT_PATH}/build/export
  65. else
  66. OUTPUT_PATH=$1
  67. fi
  68. echo Exporting project to $OUTPUT_PATH
  69. # The default path where the tools are built is platform dependent
  70. if [[ "$OSTYPE" == *"darwin"* ]]; then
  71. TOOLS_BUILD_PATH=${O3DE_PROJECT_PATH}/build/mac
  72. elif [[ "$OSTYPE" == "msys" ]]; then
  73. TOOLS_BUILD_PATH=${O3DE_PROJECT_PATH}/build/windows
  74. else
  75. TOOLS_BUILD_PATH=${O3DE_PROJECT_PATH}/build/linux
  76. fi
  77. ${O3DE_PATH}/scripts/o3de.sh export-project -es ExportScripts/export_source_built_project.py --project-path ${O3DE_PROJECT_PATH} --log-level INFO -out ${OUTPUT_PATH}