You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

96 lines
3.2 KiB

  1. #!/bin/bash
  2. NO_PROMPT="false"
  3. CLEAN_ALL="false"
  4. RESTORE_MODIFIED="false"
  5. START_VITIS="false"
  6. IMPORT_HW_PLATFORM_ONLY="false"
  7. REPO_INITIALIZED_FILE_EXISTS="false"
  8. for arg in "$@"; do
  9. if [ $arg == "--no-prompt" ]; then
  10. NO_PROMPT="true"
  11. elif [ $arg == "--clean-all" ]; then
  12. CLEAN_ALL="true"
  13. elif [ $arg == "--restore-modified" ]; then
  14. RESTORE_MODIFIED="true"
  15. elif [ $arg == "--start-vitis" ]; then
  16. START_VITIS="true"
  17. elif [ $arg == "--import-hw-platform-only" ]; then
  18. IMPORT_HW_PLATFORM_ONLY="true"
  19. fi
  20. done
  21. if ! [ -f ".repo_initialized" ]; then
  22. echo "!!! INFO !!! It seems that you have not executed the 'init_after_clone' script. Please run it first!"
  23. exit 1
  24. fi
  25. if [ $NO_PROMPT == "false" ]; then
  26. read -p "!!! WARNING !!! All unstaged and untracked files will be deleted! Press ENTER to continue or CTRL+C to abort..."
  27. fi
  28. echo "############################################################"
  29. echo "# Delete all untracked files ..."
  30. echo "############################################################"
  31. if [ $CLEAN_ALL == "true" ]; then
  32. git clean -dfx -e "/.repo_initialized"
  33. else
  34. git clean -dfx -e "/.repo_initialized" -e "/.metadata/.plugins/org.eclipse.core.runtime" -e "/.metadata/.plugins/org.eclipse.debug.core" -e "/.metadata/.plugins/org.eclipse.tcf.debug"
  35. fi
  36. if [ $RESTORE_MODIFIED == "true" ]; then
  37. echo "############################################################"
  38. echo "# Restore all unstaged files ..."
  39. echo "############################################################"
  40. git restore .
  41. git submodule update --recursive
  42. fi
  43. echo "############################################################"
  44. echo "# Re-checkout current branch ..."
  45. echo "############################################################"
  46. git checkout
  47. echo "############################################################"
  48. echo "# Create hardware platform ..."
  49. echo "############################################################"
  50. xsct tcl_scripts/platform_create.tcl
  51. if [ $IMPORT_HW_PLATFORM_ONLY == "true" ]; then
  52. echo "############################################################"
  53. echo "# Import hw_platform only to workspace ..."
  54. echo "############################################################"
  55. xsct tcl_scripts/import_platform_only.tcl
  56. else
  57. echo "############################################################"
  58. echo "# Import all projects to workspace ..."
  59. echo "############################################################"
  60. xsct tcl_scripts/import_platform_and_projects.tcl
  61. fi
  62. # Disable Vitis welcome screen
  63. FILE=".metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs"
  64. if ! [ -f $FILE ]; then
  65. touch $FILE
  66. echo "eclipse.preferences.version=1" >> $FILE
  67. echo "showIntro=false" >> $FILE
  68. fi
  69. echo "############################################################"
  70. echo "# ... finished!"
  71. if [ $START_VITIS == "true" ]; then
  72. echo "#"
  73. echo "# Starting Vitis ..."
  74. echo "############################################################"
  75. vitis -workspace .
  76. else
  77. echo "#"
  78. echo "# Start Vitis with 'vitis -workspace .'"
  79. echo "############################################################"
  80. fi