#!/bin/bash

set -uexo pipefail

top="$(pwd)"

on-exit() { cd "$top"; rm -rf debian/tests/test-lib/tmp-m2; }
trap on-exit EXIT

cd debian/tests/test-lib

./build jar
find . | sort
jar tf target/test-lib-1.2.3.jar

mkdir -p target/xjar
cd target/xjar
jar xf ../../target/test-lib-1.2.3.jar
test -f META-INF/MANIFEST.MF
test -f test-lib.clj
test -f test-lib.edn
test -f META-INF/maven/debian/test-lib/pom.xml
test -f META-INF/maven/debian/test-lib/pom.properties
cd ../..

./build clean
find . | sort
test ! -e target
