|
#!/bin/bash
|
|
|
|
NO_PROMPT="false"
|
|
CLEAN_ALL="false"
|
|
RESTORE_MODIFIED="false"
|
|
START_VITIS="false"
|
|
IMPORT_HW_PLATFORM_ONLY="false"
|
|
|
|
REPO_INITIALIZED_FILE_EXISTS="false"
|
|
|
|
for arg in "$@"; do
|
|
if [ $arg == "--no-prompt" ]; then
|
|
NO_PROMPT="true"
|
|
elif [ $arg == "--clean-all" ]; then
|
|
CLEAN_ALL="true"
|
|
elif [ $arg == "--restore-modified" ]; then
|
|
RESTORE_MODIFIED="true"
|
|
elif [ $arg == "--start-vitis" ]; then
|
|
START_VITIS="true"
|
|
elif [ $arg == "--import-hw-platform-only" ]; then
|
|
IMPORT_HW_PLATFORM_ONLY="true"
|
|
fi
|
|
done
|
|
|
|
if ! [ -f ".repo_initialized" ]; then
|
|
echo "!!! INFO !!! It seems that you have not executed the 'init_after_clone' script. Please run it first!"
|
|
exit 1
|
|
fi
|
|
|
|
if [ $NO_PROMPT == "false" ]; then
|
|
read -p "!!! WARNING !!! All unstaged and untracked files will be deleted! Press ENTER to continue or CTRL+C to abort..."
|
|
fi
|
|
|
|
echo "############################################################"
|
|
echo "# Delete all untracked files ..."
|
|
echo "############################################################"
|
|
|
|
if [ $CLEAN_ALL == "true" ]; then
|
|
git clean -dfx -e "/.repo_initialized"
|
|
else
|
|
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"
|
|
fi
|
|
|
|
if [ $RESTORE_MODIFIED == "true" ]; then
|
|
echo "############################################################"
|
|
echo "# Restore all unstaged files ..."
|
|
echo "############################################################"
|
|
|
|
git restore .
|
|
git submodule update --recursive
|
|
fi
|
|
|
|
echo "############################################################"
|
|
echo "# Re-checkout current branch ..."
|
|
echo "############################################################"
|
|
git checkout
|
|
|
|
echo "############################################################"
|
|
echo "# Create hardware platform ..."
|
|
echo "############################################################"
|
|
xsct tcl_scripts/platform_create.tcl
|
|
|
|
if [ $IMPORT_HW_PLATFORM_ONLY == "true" ]; then
|
|
echo "############################################################"
|
|
echo "# Import hw_platform only to workspace ..."
|
|
echo "############################################################"
|
|
xsct tcl_scripts/import_platform_only.tcl
|
|
else
|
|
echo "############################################################"
|
|
echo "# Import all projects to workspace ..."
|
|
echo "############################################################"
|
|
xsct tcl_scripts/import_platform_and_projects.tcl
|
|
fi
|
|
|
|
# Disable Vitis welcome screen
|
|
FILE=".metadata/.plugins/org.eclipse.core.runtime/.settings/org.eclipse.ui.prefs"
|
|
if ! [ -f $FILE ]; then
|
|
touch $FILE
|
|
echo "eclipse.preferences.version=1" >> $FILE
|
|
echo "showIntro=false" >> $FILE
|
|
fi
|
|
|
|
echo "############################################################"
|
|
echo "# ... finished!"
|
|
|
|
if [ $START_VITIS == "true" ]; then
|
|
echo "#"
|
|
echo "# Starting Vitis ..."
|
|
echo "############################################################"
|
|
|
|
vitis -workspace .
|
|
else
|
|
echo "#"
|
|
echo "# Start Vitis with 'vitis -workspace .'"
|
|
echo "############################################################"
|
|
fi
|