blob: 1c1f9cdfd72d9633463dd5c958ba2e8216be2b0f [file] [log] [blame]
<!--
~ This work is part of OpenLDAP Software <http://www.openldap.org/>.
~
~ Copyright 1998-2014 The OpenLDAP Foundation.
~ All rights reserved.
~
~ Redistribution and use in source and binary forms, with or without
~ modification, are permitted only as authorized by the OpenLDAP
~ Public License.
~
~ A copy of this license is available in the file LICENSE in the
~ top-level directory of the distribution or, alternatively, at
~ <http://www.OpenLDAP.org/license.html>.
-->
<project name="fortress-sentry" default="build" basedir="." xmlns:ivy="antlib:org.apache.ivy.ant">
<target name="init">
<!-- read properties from the build.properties, if any -->
<property name="component-propfile" value="${basedir}/build.properties"/>
<property file="${component-propfile}"/>
<!-- read properties from the ${user.home}/propfile, if any -->
<property name="user-propfile" value="${user.home}/build.properties"/>
<property file="${user-propfile}"/>
<property name="project.name" value="Fortress Java Sentry Websphere"/>
<property name="name" value="fortressSentry"/>
<property name="version" value="1.0-RC18"/>
<property name="title" value="Fortress Java Sentry Websphere ${version}"/>
<property name="vendor" value="Joshua Tree Software"/>
<property name="package" value="org.openldap.sentry.*"/>
<property name="ivy.install.version" value="2.2.0"/>
<!-- Env vars -->
<property name="src.dir" value="${basedir}/src"/>
<property name="lib.dir" value="${basedir}/lib"/>
<property name="config.dir" value="${basedir}/conf"/>
<property name="src.java.dir" value="${src.dir}/main/java"/>
<property name="src.java.proxy.dir" value="${src.java.dir}/proxy"/>
<property name="src.java.impl.dir" value="${src.java.dir}/impl"/>
<property name="build.dir" value="${basedir}/build"/>
<property name="build.classes.dir" value="${build.dir}/classes"/>
<property name="build.classes.proxy.dir" value="${build.classes.dir}/proxy"/>
<property name="build.classes.impl.dir" value="${build.classes.dir}/impl"/>
<property name="dist.dir" value="${basedir}/dist"/>
<property name="work.base.dir" value="${build.dir}/work"/>
<property name="work.dir" value="${work.base.dir}/dflt"/>
<property name="src.dist.zip" value="${dist.dir}/${name}Src-${version}.zip"/>
<property name="dst.remote.conf" value="${config.dir}/fortress.properties"/>
<property name="src.remote.conf" value="${config.dir}/fortress.properties.src"/>
<!-- config.suffix has a '\' which is required for commons configuration utility -->
<property name="config.suffix" value="dc=${suffix.name}\,dc=com"/>
<!-- Build artifacts -->
<property name="fortressTomcatSentry.jar" value="${dist.dir}/fortressProxyTomcat-${version}.jar"/>
<property name="fortressTomcat7Sentry.jar" value="${dist.dir}/fortressProxyTomcat7-${version}.jar"/>
<property name="fortressUserRegistry.jar" value="${dist.dir}/fortressProxyWebSphere-${version}.jar"/>
<property name="fortressSentry.jar" value="${dist.dir}/fortressSentry-${version}.jar"/>
<property name="fortressSentry.zip" value="${dist.dir}/fortressSentryWebsphereDist-${version}.zip"/>
<property name="fortressSentryDistro.jar" value="${dist.dir}/fortressSentry-${version}.jar"/>
<property name="fortressJbossSentryDistro.jar" value="${dist.dir}/fortressSentryJBoss-${version}.jar"/>
<property name="fortressSentryImpl.jar" value="${dist.dir}/fortressSentryImpl-${version}.jar"/>
<property name="javadoc.dist.zip" value="${dist.dir}/fortressSentryDoc-${version}.zip"/>
<property name="config.dir" value="${basedir}/conf"/>
<!-- Dependent LIBs, not in maven -->
<property name="fortress.jar" value="${lib.dir}/fortress-${version}.jar"/>
<property name="ws_runtime.jar" value="${lib.dir}/ws_runtime.jar"/>
<!-- Dependent LIBs in maven -->
<property name="catalina7.jar" value="${lib.dir}/tomcat-catalina-7.0.22.jar"/>
<property name="catalina.jar" value="${lib.dir}/catalina-6.0.33.jar"/>
<property name="commons-config.jar" value="${lib.dir}/commons-configuration-1.6.jar"/>
<property name="commons-lang.jar" value="${lib.dir}/commons-lang-2.4.jar"/>
<property name="commons-collections.jar" value="${lib.dir}/commons-collections-3.2.1.jar"/>
<property name="commons-pool.jar" value="${lib.dir}/commons-pool-1.5.2.jar"/>
<property name="commons-logging.jar" value="${lib.dir}/commons-logging-1.1.1.jar"/>
<property name="unboundsdk.jar" value="${lib.dir}/unboundid-ldapsdk-2.1.0.jar"/>
<property name="jgraph.jar" value="${lib.dir}/jgrapht-jdk1.5-0.7.3.jar"/>
<property name="log4j.jar" value="${lib.dir}/log4j-1.2.17.jar"/>
<property name="jasypt.jar" value="${lib.dir}/jasypt-1.8.jar"/>
<property name="ehcache-core.jar" value="${lib.dir}/ehcache-core-2.6.9.jar"/>
<property name="slf4j-api.jar" value="${lib.dir}/slf4j-api-1.7.5.jar"/>
<property name="slf4j-jcl.jar" value="${lib.dir}/slf4j-jcl-1.7.5.jar"/>
<property name="apacheds-all.jar" value="${lib.dir}/apacheds-all-2.0.0-M15.jar"/>
<!-- ########### Define classpaths ########################### -->
<path id="build.proxy.class.path">
<!-- J2EE JARs -->
<pathelement location="${catalina.jar}"/>
<pathelement location="${ws_runtime.jar}"/>
<!--pathelement location="${websphere.jar}"/-->
</path>
<path id="build.proxy.tc7.class.path">
<!-- J2EE JARs -->
<pathelement location="${catalina7.jar}"/>
<pathelement location="${ws_runtime.jar}"/>
</path>
<path id="build.impl.class.path">
<!-- J2EE JARs -->
<pathelement location="${catalina.jar}"/>
<pathelement location="${ws_runtime.jar}"/>
<!-- Fortress JARs -->
<pathelement location="${build.classes.proxy.dir}"/>
<pathelement location="${fortress.jar}"/>
<pathelement location="${log4j.jar}"/>
</path>
<!-- JARS required for distribution -->
<patternset id="dist.libs">
<include name="${fortress.jar}"/>
<include name="${log4j.jar}"/>
<include name="${commons-collections.jar}"/>
<include name="${commons-config.jar}"/>
<include name="${commons-lang.jar}"/>
<include name="${commons-logging.jar}"/>
<include name="${commons-pool.jar}"/>
<include name="${jgraph.jar}"/>
<include name="${jasypt.jar}"/>
<include name="${ehcache-core.jar}"/>
<include name="${slf4j-api.jar}"/>
<include name="${ehcache-core.jar}"/>
<include name="${slf4j-api.jar}"/>
<include name="${slf4j-jcl.jar}"/>
<include name="${apacheds-all.jar}"/>
</patternset>
<!-- Javadoc vars -->
<property name="javadoc.dir" value="${dist.dir}/docs/api"/>
<property name="javadoc.images.dir" value="${javadoc.dir}/images"/>
<property name="javadoc.bottom" value="&lt;small&gt;Copyright &amp;copy; 2009-2013, JoshuaTree. All Rights Reserved."/>
<property name="javadoc.overview" value="${src.java.dir}/overview.html" />
<property name="javadoc.stylesheet" value="${src.java.dir}/fortress-javadoc.css" />
<path id="javadoc.source.path">
<pathelement location="${src.java.proxy.dir}"/>
<pathelement location="${src.java.impl.dir}"/>
</path>
<property name="javac.optimize" value="false"/>
<property name="javac.debug" value="true"/>
<property name="javac.deprecation" value="true"/>
<!-- Presetdef to create jar with common manifest -->
<presetdef name="fortressSentry.jar">
<jar compress="true">
<manifest>
<attribute name="Created-By" value="${vendor} - ${project.name} dev team"/>
<attribute name="Implementation-Vendor" value="${vendor}"/>
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Specification-Title" value="${title}"/>
<attribute name="Package" value="${package}"/>
<attribute name="Extension-Name" value="${name}"/>
<attribute name="Built-By" value="${user.name}"/>
<attribute name="Compile-JDK" value="${java.runtime.version}"/>
<attribute name="Test-VM" value="${java.vm.version}"/>
</manifest>
</jar>
</presetdef>
</target>
<!-- =================================
target: download-ivy - pulls down ivy.jar from maven 2 website
================================= -->
<target name="download-ivy" depends="init" unless="local.mode">
<!-- download from web site so that it can be used even without any special installation -->
<echo message="downloading ivy to Ant home: ${ant.home}"/>
<get src="http://repo1.maven.org/maven2/org/apache/ivy/ivy/${ivy.install.version}/ivy-${ivy.install.version}.jar"
dest="${ant.home}/lib" usetimestamp="true"/>
</target>
<!-- =================================
target: resolve
================================= -->
<target name="resolve" depends="init,download-ivy" description="--> retreive dependencies with ivy">
<ivy:retrieve pattern="${lib.dir}/[artifact]-[revision].[ext]" />
</target>
<!-- =================================
target: clean-cache
================================= -->
<target name="clean-cache" description="--> clean the ivy cache">
<ivy:cleancache />
</target>
<!-- ######################################################### -->
<target name="clean" depends="init" description="removes generated files">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<!-- ############### create javadoc ############################### -->
<target name="javadoc" depends="init" description="generates javadocs">
<mkdir dir="${javadoc.dir}"/>
<javadoc packagenames="${package}"
sourcepathref="javadoc.source.path"
destdir="${javadoc.dir}"
windowtitle="${title}"
doctitle="${title} "
bottom="${javadoc.bottom}"
overview="${javadoc.overview}"
public="true"
version="true"
author="true"
splitindex="false"
nodeprecated="true"
nodeprecatedlist="true"
notree="true"
noindex="false"
nohelp="true"
nonavbar="false"
classpathref="build.impl.class.path"
serialwarn="false">
</javadoc>
</target>
<!-- ############### compile packages ############################### -->
<target name="compile-proxy" depends="init,resolve" description="compiles proxy source files">
<mkdir dir="${build.classes.proxy.dir}"/>
<javac srcdir="${src.java.proxy.dir}"
debug="${javac.debug}"
deprecation="${javac.deprecation}"
destdir="${build.classes.proxy.dir}">
<exclude name="org/openldap/sentry/tomcat/Tc7AccessMgrProxy.java"/>
<classpath refid="build.proxy.class.path"/>
</javac>
</target>
<target name="compile-proxy-tc7" depends="compile-proxy" description="compiles tomcat 7 proxy source files">
<javac srcdir="${src.java.proxy.dir}"
debug="${javac.debug}"
deprecation="${javac.deprecation}"
destdir="${build.classes.proxy.dir}">
<exclude name="org/openldap/sentry/tomcat/TcAccessMgrProxy.java"/>
<classpath refid="build.proxy.tc7.class.path"/>
</javac>
</target>
<target name="compile-impl" depends="init,resolve" description="compiles impl source files">
<mkdir dir="${build.classes.impl.dir}"/>
<javac srcdir="${src.java.impl.dir}"
debug="${javac.debug}"
deprecation="${javac.deprecation}"
destdir="${build.classes.impl.dir}">
<classpath refid="build.impl.class.path"/>
</javac>
</target>
<target name="build-jar-tcproxy" depends="compile-proxy,compile-proxy-tc7,compile-impl">
<mkdir dir="${dist.dir}"/>
<fortressSentry.jar destfile="${fortressTomcatSentry.jar}">
<fileset dir="${build.classes.proxy.dir}">
<include name="org/openldap/sentry/tomcat/**"/>
<include name="org/openldap/sentry/util/**"/>
<exclude name="org/openldap/sentry/tomcat/Tc7AccessMgrProxy.class"/>
</fileset>
<fileset dir="${build.classes.impl.dir}">
<include name="org/openldap/sentry/tomcat/TcPrincipal.class"/>
</fileset>
<metainf dir="${basedir}" includes="LICENSE.txt,NOTICE.txt"/>
</fortressSentry.jar>
</target>
<target name="build-jar-tc7proxy" depends="compile-proxy,compile-impl">
<mkdir dir="${dist.dir}"/>
<fortressSentry.jar destfile="${fortressTomcat7Sentry.jar}">
<fileset dir="${build.classes.proxy.dir}">
<include name="org/openldap/sentry/tomcat/**"/>
<include name="org/openldap/sentry/util/**"/>
<exclude name="org/openldap/sentry/tomcat/TcAccessMgrProxy.class"/>
</fileset>
<fileset dir="${build.classes.impl.dir}">
<include name="org/openldap/sentry/tomcat/TcPrincipal.class"/>
</fileset>
<metainf dir="${basedir}" includes="LICENSE.txt,NOTICE.txt"/>
</fortressSentry.jar>
</target>
<target name="build-jar-wsproxy" depends="compile-proxy">
<mkdir dir="${dist.dir}"/>
<fortressSentry.jar destfile="${fortressUserRegistry.jar}">
<fileset dir="${build.classes.proxy.dir}">
<include name="org/openldap/sentry/websphere/**"/>
<include name="org/openldap/sentry/util/**"/>
</fileset>
<metainf dir="${basedir}" includes="LICENSE.txt,NOTICE.txt"/>
</fortressSentry.jar>
</target>
<target name="build-jar-impl" depends="compile-impl">
<mkdir dir="${dist.dir}"/>
<fortressSentry.jar basedir="${build.classes.impl.dir}" destfile="${fortressSentryImpl.jar}"/>
</target>
<target name="build-jar-distro" depends="init,build-jar-impl">
<unjar dest="${work.dir}" src="${fortressSentryImpl.jar}"/>
<unjar dest="${work.dir}" src="${fortress.jar}"/>
<unjar dest="${work.dir}" src="${log4j.jar}"/>
<unjar dest="${work.dir}" src="${commons-collections.jar}"/>
<unjar dest="${work.dir}" src="${commons-config.jar}"/>
<unjar dest="${work.dir}" src="${commons-lang.jar}"/>
<unjar dest="${work.dir}" src="${commons-pool.jar}"/>
<unjar dest="${work.dir}" src="${commons-logging.jar}"/>
<unjar dest="${work.dir}" src="${unboundsdk.jar}"/>
<unjar dest="${work.dir}" src="${jgraph.jar}"/>
<unjar dest="${work.dir}" src="${jasypt.jar}"/>
<unjar dest="${work.dir}" src="${ehcache-core.jar}"/>
<unjar dest="${work.dir}" src="${slf4j-api.jar}"/>
<unjar dest="${work.dir}" src="${slf4j-jcl.jar}"/>
<fortressSentry.jar basedir="${work.dir}" compress="true" jarfile="${fortressSentryDistro.jar}"/>
</target>
<target name="build" depends="clean,build-jar-tcproxy,build-jar-tc7proxy,build-jar-wsproxy,build-jar-impl, build-jar-distro,javadoc">
<copy todir="${dist.dir}" file="${basedir}/LICENSE.txt"/>
<copy todir="${dist.dir}" file="${basedir}/NOTICE.txt"/>
<copy todir="${dist.dir}" file="${basedir}/TOMCAT-SETUP-NOTES.txt"/>
<copy todir="${dist.dir}" file="${basedir}/WEBSPHERE-SETUP-NOTES.txt"/>
</target>
<!-- ############### create distribution packages ############################ -->
<target name="dist" depends="build" description="Create source and binary distribution">
<zip destfile='${src.dist.zip}'>
<zipfileset dir='${src.java.dir}'/>
<zipfileset dir='${dist.dir}' prefix='META-INF'>
<include name="*.txt"/>
</zipfileset>
</zip>
<zip destfile="${javadoc.dist.zip}" basedir="${javadoc.dir}">
<zipfileset dir='${dist.dir}' prefix='META-INF'>
<include name="LICENSE.txt"/>
<include name="NOTICE.txt"/>
</zipfileset>
</zip>
<echo message="############### Modify fortress configuration per user settings ###############"/>
<delete file="${dst.remote.conf}"/>
<copyfile src="${src.remote.conf}" dest="${dst.remote.conf}"/>
<replace file="${dst.remote.conf}" token="@SUFFIX@" value="${suffix}"/>
<replace file="${dst.remote.conf}" token="@LDAP_HOST@" value="${ldap.host}"/>
<replace file="${dst.remote.conf}" token="@LDAP_PORT@" value="${ldap.port}"/>
<replace file="${dst.remote.conf}" token="@ROOT_DN@" value="${root.dn}"/>
<replace file="${dst.remote.conf}" token="@CFG_ROOT_PW@" value="${cfg.root.pw}"/>
<replace file="${dst.remote.conf}" token="@ADM_MIN_CONN@" value="${admin.min.conn}"/>
<replace file="${dst.remote.conf}" token="@ADM_MAX_CONN@" value="${admin.max.conn}"/>
<replace file="${dst.remote.conf}" token="@CFG_CRYPTO_PROP@" value="${crypto.prop}"/>
<replace file="${dst.remote.conf}" token="@ENABLE_LDAP_SSL@" value="${enable.ldap.ssl}"/>
<replace file="${dst.remote.conf}" token="@ENABLE_LDAP_SSL_DEBUG@" value="${enable.ldap.ssl.debug}"/>
<replace file="${dst.remote.conf}" token="@TRUST_STORE@" value="${trust.store}"/>
<replace file="${dst.remote.conf}" token="@TRUST_STORE_PW@" value="${trust.store.password}"/>
<replace file="${dst.remote.conf}" token="@TRUST_STORE_SET_PROPW@" value="${trust.store.set.prop}"/>
<!-- Break up the install binary packages by platform: -->
<zip destfile="${fortressSentry.zip}">
<zipfileset dir="${dist.dir}" prefix="doc">
<include name="fortressSentryDoc*.zip"/>
</zipfileset>
<zipfileset dir="${dist.dir}" prefix="src">
<include name="fortressSentrySrc*.zip"/>
</zipfileset>
<zipfileset dir="${dist.dir}" prefix="proxy">
<include name="fortressTomcatSentry*.jar"/>
<include name="fortressTomcat7Sentry*.jar"/>
<include name="fortressUserRegistry*.jar"/>
</zipfileset>
<zipfileset dir="${lib.dir}" prefix="lib" excludes="ws_runtime*,*catalina*,websphere*">
<include name="*.jar"/>
</zipfileset>
<zipfileset dir="${dist.dir}" prefix="lib">
<include name="fortress*.jar"/>
<exclude name="fortressTomcatSentry*.jar"/>
<exclude name="fortressTomcat7Sentry*.jar"/>
<exclude name="fortressUserRegistry*.jar"/>
</zipfileset>
<zipfileset dir="${config.dir}" prefix="conf">
<include name="*.xml"/>
<include name="*.properties"/>
</zipfileset>
<zipfileset dir='${basedir}'>
<include name="*.txt"/>
</zipfileset>
</zip>
</target>
</project>