#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/maven.mk

JAVA_HOME := /usr/lib/jvm/default-java
DEB_MAVEN_DOC_TARGET := javadoc:jar javadoc:aggregate

get-orig-source:
	uscan --download-version $(DEB_UPSTREAM_VERSION) --force-download --rename

IMPORT_BINARY_JARS = \
	for jar in `find $(CURDIR)/doxia-* -name "*.jar" -print`; \
	do \
		artifact=$$(basename $$(dirname $$(echo $$jar | sed "s/\/target//"))); \
		echo "--- $$artifact ---"; \
		mvn install:install-file -o \
			-DgroupId=org.apache.maven.doxia \
			-DartifactId=$$artifact \
			-Dversion=1.1.4 \
			-Dmaven.repo.local=$(CURDIR)/debian/maven-repo \
			-DlocalRepositoryPath=$(CURDIR)/debian/tmp/usr/share/maven-repo \
			-Dpackaging=jar -Dfile=$$jar; \
	done;

binary-jars:
	$(call IMPORT_BINARY_JARS)
	touch $@

after-mvn-build:: binary-jars
