From 6e4bd53408832e8fe980ced7a45850737470a58d Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Wed, 8 May 2013 10:40:30 +0200 Subject: [PATCH] Don't corrupt IDEA installation if update task has failed --- build/update.cmd | 6 ++++++ build/update.sh | 10 ++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/build/update.cmd b/build/update.cmd index a49d2daf764d..a949f103ac79 100644 --- a/build/update.cmd +++ b/build/update.cmd @@ -31,6 +31,7 @@ CD %DEV_IDEA_HOME% SET ANT_HOME=%DEV_IDEA_HOME%\lib\ant SET EXEC_ANT="%JAVA_HOME%\bin\java.exe" -Dant.home=%ANT_HOME% -classpath "%ANT_HOME%\lib\ant-launcher.jar" org.apache.tools.ant.launch.Launcher CALL %EXEC_ANT% -f build/update.xml %* +IF errorlevel 1 GOTO failed DEL /Q /S %WORK_IDEA_HOME%\lib DEL /Q /S %WORK_IDEA_HOME%\plugins @@ -39,5 +40,10 @@ XCOPY %DEV_IDEA_HOME%\bin\win\*.dll %WORK_IDEA_HOME%\bin\ /Q /E /Y XCOPY %DEV_IDEA_HOME%\bin\win\fsnotifier.exe %WORK_IDEA_HOME%\bin\ /Q /E /Y XCOPY %DEV_IDEA_HOME%\bin\win\runnerw.exe %WORK_IDEA_HOME%\bin\ /Q /E /Y XCOPY %DEV_IDEA_HOME%\out\deploy\*.* %WORK_IDEA_HOME%\ /Q /E /Y +GOTO done +:failed +ECHO "Update failed; work IDEA build not modified." + +:done CD /D %WORK_IDEA_HOME%\bin diff --git a/build/update.sh b/build/update.sh index ad81cb037cae..7fdd5029aec8 100755 --- a/build/update.sh +++ b/build/update.sh @@ -11,12 +11,12 @@ if [ ! -f "$WORK_IDEA_HOME/bin/inspect.sh" ]; then echo "WORK_IDEA_HOME must be defined and point to build you're updating." - exit + exit 1 fi if [ ! -f "$DEV_IDEA_HOME/build/update.sh" ]; then echo "DEV_IDEA_HOME must be defined and point to source base you're updating from." - exit + exit 1 fi echo "Updating $WORK_IDEA_HOME from compiled classes in $DEV_IDEA_HOME" @@ -26,6 +26,12 @@ ANT_CLASSPATH="$DEV_IDEA_HOME/build/lib/gant/lib/jps.jar" java -Xms64m -Xmx512m -Dant.home="$ANT_HOME" -classpath "$ANT_HOME/lib/ant-launcher.jar" org.apache.tools.ant.launch.Launcher \ -lib "$ANT_CLASSPATH" -f $DEV_IDEA_HOME/build/update.xml $TARGET +if [ "$?" != "0" ]; then + echo "Update failed; work IDEA build not modified." + rm -rf "$WORK_IDEA_HOME/___tmp___" + exit 2 +fi + rm -rf $WORK_IDEA_HOME/lib rm -rf $WORK_IDEA_HOME/plugins