mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-05 16:56:04 +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
|
||||
###############################################################################
|
||||
|
||||
SCRIPT_DIR=`dirname $0`
|
||||
|
||||
usage="\
|
||||
Usage: $0 [ECLIPSE_OPTIONS] [-b BUILD_LOG] [TARGET_OPTION]
|
||||
|
||||
|
@ -69,29 +71,26 @@ while test $# -gt 0 ; do
|
|||
done
|
||||
|
||||
# Make sure local directory exists and has contents initialized
|
||||
if [ ! -d $HOME/cdtdebugger ]; then
|
||||
mkdir -p $HOME/cdtdebugger
|
||||
cp config.ini $HOME/cdtdebugger
|
||||
cp dev.properties $HOME/cdtdebugger
|
||||
if [ ! -d "$HOME/cdtdebugger" ]; then
|
||||
/bin/sh "$SCRIPT_DIR/install.sh" || exit
|
||||
fi
|
||||
|
||||
# Calculate platform-specific jar file names
|
||||
olddir=`pwd`
|
||||
cd ../..
|
||||
OSGI_JAR=`ls org.eclipse.osgi_*.jar`
|
||||
SWT_JAR=`ls org.eclipse.swt.*.jar`
|
||||
ECLIPSE_HOME=$(cd "$SCRIPT_DIR/../../.." && pwd) # install.sh will modify this line. DO NOT REMOVE THE FOLLOWING MARKER: @#@#
|
||||
PLUGIN_DIR="$ECLIPSE_HOME/plugins"
|
||||
|
||||
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//"`
|
||||
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//"`
|
||||
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//"`
|
||||
cd ..; ECLIPSE_HOME=`pwd`
|
||||
cd $olddir
|
||||
|
||||
# Run eclipse with the Stand-alone Debugger product specified
|
||||
$ECLIPSE_HOME/eclipse -clean -product org.eclipse.cdt.debug.application.product \
|
||||
-data $HOME/workspace-cdtdebug -configuration file\:$HOME/cdtdebugger \
|
||||
-dev file\:$HOME/cdtdebugger/dev.properties $options \
|
||||
-vmargs -Dosgi.jar=$OSGI_JAR -Dswt.plugin=$SWT_PLUGIN -Dfs.plugin=$FS_PLUGIN \
|
||||
-Dlinux.plugin=$LINUX_PLUGIN -Declipse.home=$ECLIPSE_HOME
|
||||
"$ECLIPSE_HOME/eclipse" -clean -product org.eclipse.cdt.debug.application.product \
|
||||
-data "$HOME/workspace-cdtdebug" -configuration file\:"$HOME/cdtdebugger" \
|
||||
-dev file\:"$HOME/cdtdebugger/dev.properties" $options \
|
||||
-vmargs -Dosgi.jar=$OSGI_JAR -Dswt.plugin=$SWT_PLUGIN -Dfs.plugin=$FS_PLUGIN \
|
||||
-Dlinux.plugin=$LINUX_PLUGIN -Declipse.home="$ECLIPSE_HOME"
|
||||
|
||||
|
|
|
@ -9,35 +9,35 @@
|
|||
# Contributors:
|
||||
# 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
|
||||
# downloaded Eclipse and not in a local user .eclipse folder.
|
||||
if [ ! -f ../eclipse ]; then
|
||||
echo "$0: error: eclipse executable not found in expected location"
|
||||
echo " "
|
||||
echo "This can occur if you are running this script from your local .eclipse directory"
|
||||
echo "which would mean you are running a shared instance of the Eclipse platform for"
|
||||
echo "your distro and have installed the Stand-alone Debugger from an eclipse.org"
|
||||
echo "download repo. Downloading the Stand-alone Debugger feature on top of a distro"
|
||||
echo "version of Eclipse Debugger is not supported. If you are using a distro version"
|
||||
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
|
||||
|
||||
SCRIPT_DIR=`dirname $0`
|
||||
|
||||
if [ ! -f "$SCRIPT_DIR/../../../eclipse" ]; then
|
||||
echo "$0: error: eclipse executable not found in expected location"
|
||||
echo " "
|
||||
echo "This can occur if you are running this script from your local .eclipse directory"
|
||||
echo "which would mean you are running a shared instance of the Eclipse platform for"
|
||||
echo "your distro and have installed the Stand-alone Debugger from an eclipse.org"
|
||||
echo "download repo. Downloading the Stand-alone Debugger feature on top of a distro"
|
||||
echo "version of Eclipse Debugger is not supported. If you are using a distro version"
|
||||
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
|
||||
cd $olddir
|
||||
if [ ! -d $HOME/cdtdebugger ]; then
|
||||
mkdir -p $HOME/cdtdebugger
|
||||
|
||||
if [ ! -d "$HOME/cdtdebugger" ]; then
|
||||
mkdir -p "$HOME/cdtdebugger"
|
||||
fi
|
||||
cp config.ini $HOME/cdtdebugger
|
||||
cp dev.properties $HOME/cdtdebugger
|
||||
cp cdtdebug.sh $HOME/cdtdebugger
|
||||
chmod +x $HOME/cdtdebugger/cdtdebug.sh
|
||||
olddir=`pwd`
|
||||
cd ../..
|
||||
PLUGINS_DIR=`pwd`
|
||||
cd $olddir
|
||||
sed -i -e "s,cd ../..,cd $PLUGINS_DIR," $HOME/cdtdebugger/cdtdebug.sh
|
||||
cp "$SCRIPT_DIR/config.ini" "$HOME/cdtdebugger"
|
||||
cp "$SCRIPT_DIR/dev.properties" "$HOME/cdtdebugger"
|
||||
cp "$SCRIPT_DIR/cdtdebug.sh" "$HOME/cdtdebugger"
|
||||
chmod +x "$HOME/cdtdebugger/cdtdebug.sh"
|
||||
|
||||
ECLIPSE_HOME=$(cd "$SCRIPT_DIR/../../.." && pwd)
|
||||
# Replace the entire line with tag @#@# by the actual location of the eclipse installation
|
||||
sed -i -e "s,^.*@#@#.*$,ECLIPSE_HOME=$ECLIPSE_HOME," "$HOME/cdtdebugger/cdtdebug.sh"
|
||||
echo "Installation complete"
|
||||
|
|
Loading…
Add table
Reference in a new issue