#!/usr/bin/make -f

export JAVA_HOME=/usr/lib/jvm/default-java

%:
	dh $@ --with javahelper --with maven_repo_helper

override_jh_build:
	jh_build --no-javadoc pj.jar `grep "^edu\/" compile | sed '/.*test.*/d; s/^/lib\//; s/\\\//' | paste -sd " " -`

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	# Remove .class files from the library, the test will use the jar.
	$(RM) `find lib/ -name "*.class"`
	# Call run-unit-test, which builds the test classes and run them against the
	# installed jar. As it is not installed yet, we pass it through CLASSPATH.
	CLASSPATH=`readlink -f pj.jar` sh debian/tests/run-unit-test
endif

override_dh_clean:
	find . -name "*.jar" -delete
	dh_clean
