#!/usr/bin/make -f

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

PACKAGE              := $(DEB_SOURCE_PACKAGE)
VERSION              := $(DEB_UPSTREAM_VERSION)
UPSTREAM_VERSION     := $(shell echo ${VERSION} | sed 's,~\(alpha\|beta\),-\1-,' | sed 's/~rc/-rc/' | sed 's/0~20080808/0.8/')
SVN_VERSION          := $(shell echo ${VERSION} | sed 's,0~\(.*\),\1,g')
JAVA_HOME            := /usr/lib/jvm/default-java
DEB_ANT_BUILD_TARGET := jar
DEB_ANT_BUILDFILE    := build.xml
DEB_ANT_ARGS         := -Dpackage=$(PACKAGE) -DartifactId=$(PACKAGE) -Dversion=$(VERSION)
DEB_JARS             := jsr305

# to use for version 1.x
#makebuilddir/$(PACKAGE)-doc::
#	install -d build/docs/api
#	cp -r javadoc/* build/docs/api/

binary-post-install/$(PACKAGE)::
	mh_installpoms -p$(PACKAGE)
	mh_installjar -p$(PACKAGE) -l debian/pom.xml build/dist/google-collect-$(VERSION)/google-collect-$(VERSION).jar

clean::
	-rm -rf debian/tmp
	mh_clean

get-orig-source: get-orig-pom
	# to use for version 1.x
	#-uscan --download-version $(VERSION) --force-download --rename
	sh debian/orig-tar.sh X $(VERSION)

get-orig-pom:
	wget -O debian/pom.xml http://repository.sonatype.org/service/local/repositories/central/content/com/google/collections/google-collections/$(UPSTREAM_VERSION)/google-collections-$(UPSTREAM_VERSION).pom

