Skip to content

Commit

Permalink
[JBAS-8340] Tools module and build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
bstansberry committed Aug 13, 2010
1 parent 4aa8be8 commit bfdb22b
Show file tree
Hide file tree
Showing 38 changed files with 1,777 additions and 0 deletions.
62 changes: 62 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
JBoss Application Server

Directory Structure
-------------------
build - Contains the build scripts for creating the complete JBoss AS distribution.
testsuite - Contains code and build scripts for testing the application server
tools - Various files used by the build (ant, maven, etc.)

The remaining directories contain the various components of the application server.

Dependencies
------------
The pom.xml in the root of the source checkout contains the Maven configuration which
controls dependency versions.

Building
-------------------
From the root directory, run the build script "./build.sh" or "build.bat"
If you want to call maven directly "mvn install", you must add the jboss repository
configuration to your Maven settings. See the JBoss build wiki for more information about
repository config.

For slightly faster builds, the maven enforcer plugin can be skipped.
./build.sh -P-enforce

Generation of the source jars can be skipping by deactivating the sources
profile.
./build.sh -P-sources

During development you may want to build only a single module and update the
distribution build. This can be done using the property "module".
For example, to build the "remoting" module and update the dist build, run the following:
./build.sh -Dmodule=remoting

Running the Testsuite
--------------------
The testsuite module contains four submodules:

1) "smoke" -- core tests that should be run as part of every build of the AS. Failures here will fail the build.
2) "integration" -- the full integration testsuite. Should be run with no failures before any major commits.
3) "benchmark" -- tests used to compare performance against other releases or previous builds
4) "stress" -- tests of the server's ability to perform properly while under stress

To run the testsuite from the root directory, run the build script "./build.sh" or "build.bat":

For basic smoke tests, simply: "./build.sh test"
For integration tests: "./build.sh test -Pintegration-tests"
For benchmark tests: "./build.sh test -Pbenchmark-tests"
For stress tests: "./build.sh test -Pstress-tests"
For all of the above tests: "./build.sh test -Pall-tests"

Using Eclipse
-------------
To use eclipse you need to use the m2eclipse plugin (http://m2eclipse.sonatype.org/).
The following steps are recommended:
1. Install the latest version of eclipse
2. Set Xmx in eclipse.ini to be at least 512M, and make sure it's using java 6
3. On the command line run ./build.sh eclipse:m2eclipse
4. launch eclipse and install the m2eclipse plugin, and make sure it uses your repo configs
5. In eclipse preferences Java->Compiler->Errors/Warnings->Deprecated and restricted set forbidden reference to WARNING
6. Use import on the root pom, which will pull in all modules
7. Wait (m2eclipse takes awhile on initial import, especially if you did not do step 3)
90 changes: 90 additions & 0 deletions build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
@echo off
REM ======================================================================
REM
REM This is the main entry point for the build system.
REM
REM Users should be sure to execute this file rather than 'mvn' to ensure
REM the correct version is being used with the correct configuration.
REM
REM ======================================================================
REM
REM $Id: build.bat 105735 2010-06-04 19:45:13Z pgier $
REM
REM Authors:
REM Jason Dillon <jason@planet57.com>
REM Sacha Labourey <sacha.labourey@cogito-info.ch>
REM

REM ******************************************************
REM Ignore the MAVEN_HOME variable: we want to use *our*
REM Maven version and associated JARs.
REM ******************************************************
REM Ignore the users classpath, cause it might mess
REM things up
REM ******************************************************

SETLOCAL

set CLASSPATH=
set M2_HOME=

REM ******************************************************
REM - "for" loops have been unrolled for compatibility
REM with some WIN32 systems.
REM ******************************************************

set NAMES=tools;tools\maven;tools\apache\maven
set SUBFOLDERS=.;..;..\..;..\..\..;..\..\..\..

REM ******************************************************
REM ******************************************************

SET EXECUTED=FALSE
for %%i in (%NAMES%) do call :subLoop %%i %1 %2 %3 %4 %5 %6

goto :EOF


REM ******************************************************
REM ********* Search for names in the subfolders *********
REM ******************************************************

:subLoop
for %%j in (%SUBFOLDERS%) do call :testIfExists %%j\%1\bin\mvn.bat %2 %3 %4 %5 %6 %7

goto :EOF


REM ******************************************************
REM ************ Test if Maven Batch file exists ***********
REM ******************************************************

:testIfExists
if exist %1 call :BatchFound %1 %2 %3 %4 %5 %6 %7 %8

goto :EOF


REM ******************************************************
REM ************** Batch file has been found *************
REM ******************************************************

:BatchFound
if (%EXECUTED%)==(FALSE) call :ExecuteBatch %1 %2 %3 %4 %5 %6 %7 %8
set EXECUTED=TRUE

goto :EOF

REM ******************************************************
REM ************* Execute Batch file only once ***********
REM ******************************************************

:ExecuteBatch
echo Calling %1 %2 %3 %4 %5 %6 %7 %8
set GOAL=%2
if "%GOAL%"=="" set GOAL=install
call %1 %GOAL% %3 %4 %5 %6 %7 %8

:end

if "%NOPAUSE%" == "" pause
179 changes: 179 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,179 @@
#!/bin/sh
### ====================================================================== ###
## ##
## This is the main entry point for the build system. ##
## ##
## Users should execute this file rather than 'mvn' to ensure ##
## the correct version is being used with the correct configuration. ##
## ##
### ====================================================================== ###

# $Id: build.sh 105735 2010-06-04 19:45:13Z pgier $

PROGNAME=`basename $0`
DIRNAME=`dirname $0`
GREP="grep"
ROOT="/"

# Ignore user's MAVEN_HOME if it is set
M2_HOME=""

MAVEN_OPTS="$MAVEN_OPTS -Xmx512M"
export MAVEN_OPTS

# the default search path for maven
MAVEN_SEARCH_PATH="\
tools
tools/maven \
tools/apache/maven \
maven"

# the default arguments
MVN_OPTIONS=""

# Use the maximum available, or set MAX_FD != -1 to use that
MAX_FD="maximum"

# OS specific support (must be 'true' or 'false').
cygwin=false;
darwin=false;
case "`uname`" in
CYGWIN*)
cygwin=true
;;

Darwin*)
darwin=true
;;
esac

#
# Helper to complain.
#
die() {
echo "${PROGNAME}: $*"
exit 1
}

#
# Helper to complain.
#
warn() {
echo "${PROGNAME}: $*"
}

#
# Helper to source a file if it exists.
#
maybe_source() {
for file in $*; do
if [ -f "$file" ]; then
. $file
fi
done
}

search() {
search="$*"
for d in $search; do
MAVEN_HOME="`pwd`/$d"
MVN="$MAVEN_HOME/bin/mvn"
if [ -x "$MVN" ]; then
# found one
echo $MAVEN_HOME
break
fi
done
}

#
# Main function.
#
main() {
# if there is a build config file. then source it
maybe_source "$DIRNAME/build.conf" "$HOME/.build.conf"

# Increase the maximum file descriptors if we can
if [ $cygwin = "false" ]; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ]; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ]; then
# use the system max
MAX_FD="$MAX_FD_LIMIT"
fi

ulimit -n $MAX_FD
if [ $? -ne 0 ]; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query system maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi

# try the search path
MAVEN_HOME=`search $MAVEN_SEARCH_PATH`

# try looking up to root
if [ "x$MAVEN_HOME" = "x" ]; then
target="build"
_cwd=`pwd`

while [ "x$MAVEN_HOME" = "x" ] && [ "$cwd" != "$ROOT" ]; do
cd ..
cwd=`pwd`
MAVEN_HOME=`search $MAVEN_SEARCH_PATH`
done

# make sure we get back
cd $_cwd

if [ "$cwd" != "$ROOT" ]; then
found="true"
fi

# complain if we did not find anything
if [ "$found" != "true" ]; then
die "Could not locate Maven; check \$MVN or \$MAVEN_HOME."
fi
fi

# make sure we have one
MVN=$MAVEN_HOME/bin/mvn
if [ ! -x "$MVN" ]; then
die "Maven file is not executable: $MVN"
fi

# need to specify planet57/buildmagic protocol handler package
MVN_OPTS="-Djava.protocol.handler.pkgs=org.jboss.net.protocol"

# setup some build properties
MVN_OPTS="$MVN_OPTS -Dbuild.script=$0"

# change to the directory where the script lives so users are not forced
# to be in the same directory as build.xml
cd $DIRNAME

MVN_GOAL=$@
if [ -z "$MVN_GOAL" ]; then
MVN_GOAL="install"
fi

# export some stuff for maven
export MVN MAVEN_HOME MVN_OPTS MVN_GOAL

echo "$MVN $MVN_OPTIONS $MVN_GOAL"

# execute in debug mode, or simply execute
if [ "x$MVN_DEBUG" != "x" ]; then
/bin/sh -x $MVN $MVN_OPTIONS $MVN_GOAL
else
exec $MVN $MVN_OPTIONS $MVN_GOAL
fi
}

##
## Bootstrap
##

main "$@"
Loading

0 comments on commit bfdb22b

Please sign in to comment.