#!/bin/sh

ant build-nozip || exit 

cd nbbuild
rm -f netbeans/nb.cluster.*
# Do not delete. It is needed for tests to determine classpath.
#rm -f netbeans/moduleCluster.properties
# Do not delete. It contains 'hg id' of repository in time of build.
#rm -f netbeans/build_info

cd ..

# Try to build all tests in the system to make sure they at least compile.
#ant -Dtest.fail.on.error=false build-test-dist
###############  Commit validation tests  ##########################
TESTS_STARTED=`date`
TESTS_RESULT_DIR="`pwd`/nbbuild/build/test/results"
# Different JDK for tests because JVM crashes often (see 6598709, 6607038)
JDK_TESTS=/opt/jdk1.5.0_14
# standard NetBeans unit and UI validation tests
ant commit-validation

echo TESTS STARTED: $TESTS_STARTED
echo TESTS FINISHED: `date`

# Clean up some stuff dumped in the build by tests:
rm -rf nbbuild/netbeans/testtools
rm -f nbbuild/netbeans/bin/hs_err_*
# Check to see if any other unregistered files remain (if so, delete them now so the problem can be fixed in incremental builds) (cf. #111946):
ant clean-untracked-files
# Make sure the build did not modify any files, or produce any nonignorable files.
test -z "`hg st | tee /dev/stderr`" || exit
