mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 02:06:01 +02:00
Improve Standalone Debugger scripts
- Fix indentation - Call install.sh from cdtdebug.sh if installation needed. This should help the user realize they can run the script outside if the eclipse installation directory after the first time. - Use a subshell to run pwd to avoid having to actually change directory. - Tag the line that needs to be modified with a marker to make it future-proof. - Use find instead of ls which is easier to parse. - Allow to run install.sh without doing a cd to its location - Allow to run original cdtdebug.sh without doing a cd to its location Change-Id: I3f63dcf8a307784b0c38a286e645ea962ce62dc4 Signed-off-by: Marc Khouzam <marc.khouzam@ericsson.com> Reviewed-on: https://git.eclipse.org/r/29834 Tested-by: Hudson CI
This commit is contained in:
parent
3a98d32217
commit
f6534f6922
2 changed files with 43 additions and 44 deletions
|
@ -10,6 +10,8 @@
|
||||||
# Red Hat Inc. - initial API and implementation
|
# Red Hat Inc. - initial API and implementation
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
SCRIPT_DIR=`dirname $0`
|
||||||
|
|
||||||
usage="\
|
usage="\
|
||||||
Usage: $0 [ECLIPSE_OPTIONS] [-b BUILD_LOG] [TARGET_OPTION]
|
Usage: $0 [ECLIPSE_OPTIONS] [-b BUILD_LOG] [TARGET_OPTION]
|
||||||
|
|
||||||
|
@ -69,29 +71,26 @@ while test $# -gt 0 ; do
|
||||||
done
|
done
|
||||||
|
|
||||||
# Make sure local directory exists and has contents initialized
|
# Make sure local directory exists and has contents initialized
|
||||||
if [ ! -d $HOME/cdtdebugger ]; then
|
if [ ! -d "$HOME/cdtdebugger" ]; then
|
||||||
mkdir -p $HOME/cdtdebugger
|
/bin/sh "$SCRIPT_DIR/install.sh" || exit
|
||||||
cp config.ini $HOME/cdtdebugger
|
|
||||||
cp dev.properties $HOME/cdtdebugger
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Calculate platform-specific jar file names
|
# Calculate platform-specific jar file names
|
||||||
olddir=`pwd`
|
ECLIPSE_HOME=$(cd "$SCRIPT_DIR/../../.." && pwd) # install.sh will modify this line. DO NOT REMOVE THE FOLLOWING MARKER: @#@#
|
||||||
cd ../..
|
PLUGIN_DIR="$ECLIPSE_HOME/plugins"
|
||||||
OSGI_JAR=`ls org.eclipse.osgi_*.jar`
|
|
||||||
SWT_JAR=`ls org.eclipse.swt.*.jar`
|
OSGI_JAR=`find "$PLUGIN_DIR" -maxdepth 1 -name 'org.eclipse.osgi_*.jar' -printf "%f\n"`
|
||||||
|
SWT_JAR=`find "$PLUGIN_DIR" -maxdepth 1 -name 'org.eclipse.swt.*.jar' -printf "%f\n"`
|
||||||
SWT_PLUGIN=`echo $SWT_JAR | sed -e "s/_[0-9]*\..*.jar//"`
|
SWT_PLUGIN=`echo $SWT_JAR | sed -e "s/_[0-9]*\..*.jar//"`
|
||||||
FS_JAR=`ls org.eclipse.core.filesystem.*.jar | grep -v java7`
|
FS_JAR=`find "$PLUGIN_DIR" -maxdepth 1 -name 'org.eclipse.core.filesystem.*.jar' -printf "%f\n" | grep -v java7`
|
||||||
FS_PLUGIN=`echo $FS_JAR | sed -e "s/_[0-9]*\..*.jar//"`
|
FS_PLUGIN=`echo $FS_JAR | sed -e "s/_[0-9]*\..*.jar//"`
|
||||||
LINUX_JAR=`ls org.eclipse.cdt.core.linux.*.jar`
|
LINUX_JAR=`find "$PLUGIN_DIR" -maxdepth 1 -name 'org.eclipse.cdt.core.linux.*.jar' -printf "%f\n"`
|
||||||
LINUX_PLUGIN=`echo $LINUX_JAR | sed -e "s/_[0-9]*\..*.jar//"`
|
LINUX_PLUGIN=`echo $LINUX_JAR | sed -e "s/_[0-9]*\..*.jar//"`
|
||||||
cd ..; ECLIPSE_HOME=`pwd`
|
|
||||||
cd $olddir
|
|
||||||
|
|
||||||
# Run eclipse with the Stand-alone Debugger product specified
|
# Run eclipse with the Stand-alone Debugger product specified
|
||||||
$ECLIPSE_HOME/eclipse -clean -product org.eclipse.cdt.debug.application.product \
|
"$ECLIPSE_HOME/eclipse" -clean -product org.eclipse.cdt.debug.application.product \
|
||||||
-data $HOME/workspace-cdtdebug -configuration file\:$HOME/cdtdebugger \
|
-data "$HOME/workspace-cdtdebug" -configuration file\:"$HOME/cdtdebugger" \
|
||||||
-dev file\:$HOME/cdtdebugger/dev.properties $options \
|
-dev file\:"$HOME/cdtdebugger/dev.properties" $options \
|
||||||
-vmargs -Dosgi.jar=$OSGI_JAR -Dswt.plugin=$SWT_PLUGIN -Dfs.plugin=$FS_PLUGIN \
|
-vmargs -Dosgi.jar=$OSGI_JAR -Dswt.plugin=$SWT_PLUGIN -Dfs.plugin=$FS_PLUGIN \
|
||||||
-Dlinux.plugin=$LINUX_PLUGIN -Declipse.home=$ECLIPSE_HOME
|
-Dlinux.plugin=$LINUX_PLUGIN -Declipse.home="$ECLIPSE_HOME"
|
||||||
|
|
||||||
|
|
|
@ -9,35 +9,35 @@
|
||||||
# Contributors:
|
# Contributors:
|
||||||
# Red Hat Inc. - initial API and implementation
|
# Red Hat Inc. - initial API and implementation
|
||||||
###############################################################################
|
###############################################################################
|
||||||
olddir=`pwd`
|
|
||||||
cd ../..
|
|
||||||
PLUGINS_DIR=`pwd`
|
|
||||||
# Verify that the install script is being run from a plug-ins folder of a
|
# Verify that the install script is being run from a plug-ins folder of a
|
||||||
# downloaded Eclipse and not in a local user .eclipse folder.
|
# downloaded Eclipse and not in a local user .eclipse folder.
|
||||||
if [ ! -f ../eclipse ]; then
|
|
||||||
echo "$0: error: eclipse executable not found in expected location"
|
SCRIPT_DIR=`dirname $0`
|
||||||
echo " "
|
|
||||||
echo "This can occur if you are running this script from your local .eclipse directory"
|
if [ ! -f "$SCRIPT_DIR/../../../eclipse" ]; then
|
||||||
echo "which would mean you are running a shared instance of the Eclipse platform for"
|
echo "$0: error: eclipse executable not found in expected location"
|
||||||
echo "your distro and have installed the Stand-alone Debugger from an eclipse.org"
|
echo " "
|
||||||
echo "download repo. Downloading the Stand-alone Debugger feature on top of a distro"
|
echo "This can occur if you are running this script from your local .eclipse directory"
|
||||||
echo "version of Eclipse Debugger is not supported. If you are using a distro version"
|
echo "which would mean you are running a shared instance of the Eclipse platform for"
|
||||||
echo "of the Eclipse platform, you should not use this script. Instead, install the"
|
echo "your distro and have installed the Stand-alone Debugger from an eclipse.org"
|
||||||
echo "corresponding Eclipse CDT package for your distro (e.g. eclipse-cdt package)"
|
echo "download repo. Downloading the Stand-alone Debugger feature on top of a distro"
|
||||||
echo "which will install the Stand-alone Debugger for you."
|
echo "version of Eclipse Debugger is not supported. If you are using a distro version"
|
||||||
exit 1
|
echo "of the Eclipse platform, you should not use this script. Instead, install the"
|
||||||
|
echo "corresponding Eclipse CDT package for your distro (e.g. eclipse-cdt package)"
|
||||||
|
echo "which will install the Stand-alone Debugger for you."
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
cd $olddir
|
|
||||||
if [ ! -d $HOME/cdtdebugger ]; then
|
if [ ! -d "$HOME/cdtdebugger" ]; then
|
||||||
mkdir -p $HOME/cdtdebugger
|
mkdir -p "$HOME/cdtdebugger"
|
||||||
fi
|
fi
|
||||||
cp config.ini $HOME/cdtdebugger
|
cp "$SCRIPT_DIR/config.ini" "$HOME/cdtdebugger"
|
||||||
cp dev.properties $HOME/cdtdebugger
|
cp "$SCRIPT_DIR/dev.properties" "$HOME/cdtdebugger"
|
||||||
cp cdtdebug.sh $HOME/cdtdebugger
|
cp "$SCRIPT_DIR/cdtdebug.sh" "$HOME/cdtdebugger"
|
||||||
chmod +x $HOME/cdtdebugger/cdtdebug.sh
|
chmod +x "$HOME/cdtdebugger/cdtdebug.sh"
|
||||||
olddir=`pwd`
|
|
||||||
cd ../..
|
ECLIPSE_HOME=$(cd "$SCRIPT_DIR/../../.." && pwd)
|
||||||
PLUGINS_DIR=`pwd`
|
# Replace the entire line with tag @#@# by the actual location of the eclipse installation
|
||||||
cd $olddir
|
sed -i -e "s,^.*@#@#.*$,ECLIPSE_HOME=$ECLIPSE_HOME," "$HOME/cdtdebugger/cdtdebug.sh"
|
||||||
sed -i -e "s,cd ../..,cd $PLUGINS_DIR," $HOME/cdtdebugger/cdtdebug.sh
|
|
||||||
echo "Installation complete"
|
echo "Installation complete"
|
||||||
|
|
Loading…
Add table
Reference in a new issue