#!/bin/bash
set -xe
PROJECT_PREFIX=`readlink -e .`
[[ -d /usr/lib/jvm/java-11-openjdk/  ]] && export JAVA_HOME=/usr/lib/jvm/java-11-openjdk/ # Forcing J11 for RHEL
cd src/hibernate-orm-5.3.25
alias ant='$PROJECT_PREFIX/kit/apache-ant-1.9.7/bin/ant'
alias mvn='$PROJECT_PREFIX/kit/apache-maven-3.3.9/bin/mvn -Dmaven.repo.local=$PROJECT_PREFIX/kit/m2 --settings $PROJECT_PREFIX/kit/m2/settings.xml --strict-checksums -o'
alias gradlew='./gradlew --gradle-user-home=$PROJECT_PREFIX/kit/gradle-home --offline'
find $PROJECT_PREFIX/kit/gradle-home/native/ -name *.lock -delete
gradlew clean build -x test -x javadoc -x documentation:aggregateJavadocs -x release:distTar -x release:distZip -x hibernate-core:compileTestJava -x hibernate-core:processTestResources generatePomFileForPublishedArtifactsPublication
