eclipse plugin: Replace the 2 shell scripts with a Scons script
This commit is contained in:
parent
f23067109f
commit
6cd8d213e0
3 changed files with 85 additions and 96 deletions
85
utils/umc_dev/build/SConstruct
Normal file
85
utils/umc_dev/build/SConstruct
Normal file
|
@ -0,0 +1,85 @@
|
|||
# vi: syntax=python:et:ts=4
|
||||
#
|
||||
# SCons build description for the Wesnoth UMC Development IDE
|
||||
#
|
||||
# Prerequisites are:
|
||||
# 1. Sun/Oracle Java JDK
|
||||
# 2. Eclipse 3.7 environment with all required plugins
|
||||
# (Can be found at: http://sourceforge.net/projects/wesnoth/files/wesnoth-umcplugin/build_utils/ )
|
||||
|
||||
import os, shutil, re, subprocess
|
||||
|
||||
# Warn user of current set of build options.
|
||||
if os.path.exists('.scons-option-cache'):
|
||||
optfile = file('.scons-option-cache')
|
||||
print "Saved options:", optfile.read().replace("\n", ", ")[:-2]
|
||||
optfile.close()
|
||||
|
||||
# variables
|
||||
opts = Variables( ".scons-option-cache" )
|
||||
opts.AddVariables(
|
||||
PathVariable( "eclipsedir", "The directory that contains the eclipse binary and all the needed plugins",
|
||||
"", PathVariable.PathIsDir )
|
||||
)
|
||||
env = Environment( options = opts )
|
||||
opts.Save( '.scons-option-cache', env )
|
||||
|
||||
eclipse_dir = env[ "eclipsedir" ]
|
||||
temp_build_dir = os.environ[ "TMP" ] + "/umcdev_build"
|
||||
|
||||
print "Clearing temporary build dir ( " + temp_build_dir + " ) ..."
|
||||
if os.path.exists( temp_build_dir ):
|
||||
shutil.rmtree( temp_build_dir )
|
||||
|
||||
os.makedirs( temp_build_dir )
|
||||
|
||||
# now, we need to find 2 things:
|
||||
# 1) file: org.eclipse.equinox.launcher_*.jar
|
||||
# 2) dir: org.eclipse.pde.build_*
|
||||
|
||||
equinox_launcher_path = ""
|
||||
pde_build_dir = ""
|
||||
|
||||
for file in os.listdir( eclipse_dir + "/plugins" ):
|
||||
if re.match( "org.eclipse.equinox.launcher_.*.jar", file ):
|
||||
equinox_launcher_path = eclipse_dir + "/plugins/" + file
|
||||
elif re.match( "org.eclipse.pde.build_.*", file ):
|
||||
pde_build_dir = eclipse_dir + "/plugins/" + file
|
||||
|
||||
if equinox_launcher_path:
|
||||
print "Found equinox launcher: " + equinox_launcher_path
|
||||
else:
|
||||
print "Couldn't find equinox launcher. Aborting..."
|
||||
Return( )
|
||||
|
||||
if pde_build_dir:
|
||||
print "Found PDE Build dir: " + pde_build_dir
|
||||
else:
|
||||
print "Couldn't find PDE Build dir. Aborting..."
|
||||
Return( )
|
||||
|
||||
print "Building..."
|
||||
subprocess.call( [
|
||||
"java",
|
||||
"-cp", equinox_launcher_path, "org.eclipse.core.launcher.Main",
|
||||
"-data", "workspace",
|
||||
"-application", "org.eclipse.ant.core.antRunner",
|
||||
"-DbuildDirectory=" + temp_build_dir,
|
||||
"-Dbase=" + eclipse_dir,
|
||||
"-DbaseLocation=" + eclipse_dir,
|
||||
"-Ddeltapack=" + eclipse_dir,
|
||||
"-Declipse.pdebuild.scripts=" + pde_build_dir + "/scripts",
|
||||
"-Declipse.pdebuild.templates=" + pde_build_dir + "/templates",
|
||||
"-buildfile", "build.xml" ] )
|
||||
|
||||
# Some cleanup
|
||||
if os.path.exists( "../org.wesnoth.feature/build.xml" ):
|
||||
os.remove( "../org.wesnoth.feature/build.xml" )
|
||||
if os.path.exists( "../org.wesnoth/build.xml" ):
|
||||
os.remove( "../org.wesnoth/build.xml" )
|
||||
if os.path.exists( "../org.wesnoth.ui/build.xml" ):
|
||||
os.remove( "../org.wesnoth.ui/build.xml" )
|
||||
|
||||
# Local variables:
|
||||
# mode: python
|
||||
# end:
|
|
@ -1,38 +0,0 @@
|
|||
@echo off
|
||||
|
||||
set ECLIPSEBIN=%1
|
||||
set BUILDDIR=%TEMP%\eclipse_build
|
||||
|
||||
echo Clearing build dir...
|
||||
IF EXIST %BUILDDIR% rm -rf %BUILDDIR%
|
||||
mkdir %BUILDDIR%
|
||||
|
||||
REM get path to equinox jar inside ECLIPSEBIN folder
|
||||
for /f "delims= tokens=1" %%c in ('dir /B /S /OD %ECLIPSEBIN%\plugins\org.eclipse.equinox.launcher_*.jar') do set EQUINOXJAR=%%c
|
||||
|
||||
IF EXIST %EQUINOXJAR% (
|
||||
echo Found equinox jar: %EQUINOXJAR%
|
||||
) ELSE (
|
||||
echo Couldn't find the equinox launcher jar
|
||||
goto end
|
||||
)
|
||||
|
||||
REM find pde build folder
|
||||
for /f "delims= tokens=1" %%c in ('dir /B /S /OD %ECLIPSEBIN%\plugins\org.eclipse.pde.build_*') do set PDEBUILD_DIR=%%c
|
||||
|
||||
IF EXIST %PDEBUILD_DIR% (
|
||||
echo Found pde folder: %PDEBUILD_DIR%
|
||||
) ELSE (
|
||||
echo Couldn't find the pde build plugin. Are you using a RCP eclipse version?
|
||||
goto end
|
||||
)
|
||||
|
||||
java -cp %EQUINOXJAR% org.eclipse.core.launcher.Main -data workspace -application org.eclipse.ant.core.antRunner -DbuildDirectory=%BUILDDIR% -Dbase=%ECLIPSEBIN% -DbaseLocation=%ECLIPSEBIN% -Ddeltapack=%ECLIPSEBIN% -Declipse.pdebuild.scripts=%PDEBUILD_DIR%\scripts -Declipse.pdebuild.templates=%PDEBUILD_DIR%\templates -buildfile build.xml
|
||||
|
||||
IF EXIST ../org.wesnoth.feature/build.xml rm ../org.wesnoth.feature/build.xml
|
||||
IF EXIST ../org.wesnoth/build.xml rm ../org.wesnoth/build.xml
|
||||
IF EXIST ../org.wesnoth.ui/build.xml rm ../org.wesnoth.ui/build.xml
|
||||
|
||||
:end
|
||||
echo Script finished.
|
||||
pause
|
|
@ -1,58 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
eclipse_dir=$1
|
||||
build_dir=/tmp/eclipse_build
|
||||
|
||||
echo Cleaning build directory
|
||||
if [[ -d "$build_dir" ]]
|
||||
rm -rf "$build_dir"
|
||||
fi
|
||||
|
||||
|
||||
mkdir -p "$build_dir"
|
||||
if [[ -z "$eclipse_dir" ]]
|
||||
then
|
||||
echo Please set the eclipse installation directory as the first parameter.
|
||||
exit
|
||||
fi
|
||||
|
||||
echo Using $eclipse_dir directory as eclipse installation.
|
||||
echo Using $build_dir as temporary directory.
|
||||
|
||||
echo Searching for eclipse launcher...
|
||||
launcher_jar=`find "$eclipse_dir/plugins/" -type f -name 'org.eclipse.equinox.launcher_*.jar' -print0`
|
||||
if [[ -f "$launcher_jar" ]]
|
||||
then
|
||||
echo Found eclipse launcher jar: $launcher_jar
|
||||
else
|
||||
echo Could not find eclipse launcher, exiting.
|
||||
exit
|
||||
fi
|
||||
|
||||
echo Searching for eclipse pde build directory...
|
||||
pdebuild_dir=`find "$eclipse_dir/plugins/" -type d -name 'org.eclipse.pde.build_*' -print0`
|
||||
if [[ -d "$pdebuild_dir" ]]
|
||||
then
|
||||
echo Found pde build directory: $pdebuild_dir
|
||||
else
|
||||
echo Could not find pde build directory, exiting.
|
||||
exit
|
||||
fi
|
||||
|
||||
echo Everything set-up. Starting the build...
|
||||
|
||||
java -cp $launcher_jar org.eclipse.core.launcher.Main -data workspace -application org.eclipse.ant.core.antRunner -DbuildDirectory=$build_dir -Dbase=$eclipse_dir -DbaseLocation=$eclipse_dir -Ddeltapack=$eclipse_dir -Declipse.pdebuild.scripts=$pdebuild_dir/scripts -Declipse.pdebuild.templates=$pdebuild_dir/templates -buildfile build.xml
|
||||
|
||||
echo Cleaning up...
|
||||
if [[ -f "../org.wesnoth/build.xml" ]]
|
||||
then
|
||||
rm ../org.wesnoth/build.xml
|
||||
fi
|
||||
if [[ -f "../org.wesnoth.feature/build.xml" ]]
|
||||
then
|
||||
rm ../org.wesnoth.feature/build.xml
|
||||
fi
|
||||
if [[ -f "../org.wesnoth.ui/build.xml" ]]
|
||||
then
|
||||
rm ../org.wesnoth.ui/build.xml
|
||||
fi
|
Loading…
Add table
Reference in a new issue