The Java API is now a separate source tree from the rest of voms

This commit is contained in:
Mattias Ellert 2012-04-23 19:31:39 +02:00
commit 385e7b8b1f
6 changed files with 463 additions and 0 deletions

1
.gitignore vendored
View file

@ -0,0 +1 @@
/*.tar.gz

23
build.xml Normal file
View file

@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- ====================================================================== -->
<!-- Ant build file (http://ant.apache.org/) for Ant 1.6.2 or above. -->
<!-- ====================================================================== -->
<project name="voms-api-java" default="package" basedir=".">
<!-- ====================================================================== -->
<!-- Import maven-build.xml into the current project -->
<!-- ====================================================================== -->
<import file="maven-build.xml"/>
<!-- ====================================================================== -->
<!-- Help target -->
<!-- ====================================================================== -->
<target name="help">
<echo message="Please run: $ant -projecthelp"/>
</target>
</project>

22
maven-build.properties Normal file
View file

@ -0,0 +1,22 @@
#Generated by Maven Ant Plugin - DO NOT EDIT THIS FILE!
#Thu Mar 22 00:41:13 CET 2012
maven.settings.offline=true
maven.build.finalName=voms-api-java-2.0.7
maven.build.resourceDir.0=src/main/resources
maven.build.testOutputDir=${maven.build.dir}/test-classes
maven.build.testResourceDir.0=src/test/resources
maven.reporting.outputDirectory=${maven.build.dir}/site
project.build.sourceEncoding=UTF-8
maven.build.srcDir.0=src/main/java
project.build.directory=${maven.build.dir}
maven.test.reports=${maven.build.dir}/test-reports
maven.build.dir=target
project.build.outputDirectory=${maven.build.outputDir}
assembly.javadoc.dir=/usr/share/javadoc/voms-api-java
assembly.doc.dir=/usr/share/doc/voms-api-java-2.0.7
project.reporting.outputEncoding=UTF-8
maven.build.testDir.0=src/test/java
maven.settings.interactiveMode=true
assembly.java.dir=/usr/share/java
maven.repo.local=/home/ellert/Packaging/vomsjapi/voms-api-java-2.0.7/.m2
maven.build.outputDir=${maven.build.dir}/classes

268
maven-build.xml Normal file
View file

@ -0,0 +1,268 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- ====================================================================== -->
<!-- Ant build file (http://ant.apache.org/) for Ant 1.6.2 or above. -->
<!-- ====================================================================== -->
<!-- ====================================================================== -->
<!-- ===================== - DO NOT EDIT THIS FILE! - ===================== -->
<!-- ====================================================================== -->
<!-- -->
<!-- Any modifications will be overwritten. -->
<!-- -->
<!-- Generated by Maven Ant Plugin on 3/22/12 12:41 AM -->
<!-- See: http://maven.apache.org/plugins/maven-ant-plugin/ -->
<!-- -->
<!-- ====================================================================== -->
<project name="voms-api-java-from-maven" default="package" basedir=".">
<!-- ====================================================================== -->
<!-- Build environment properties -->
<!-- ====================================================================== -->
<property file="${user.home}/.m2/maven.properties"/>
<property file="maven-build.properties"/>
<property name="maven.build.finalName" value="voms-api-java-2.0.7"/>
<property name="maven.build.dir" value="target"/>
<property name="maven.build.outputDir" value="${maven.build.dir}/classes"/>
<property name="maven.build.srcDir.0" value="src/main/java"/>
<property name="maven.build.resourceDir.0" value="src/main/resources"/>
<property name="maven.build.testOutputDir" value="${maven.build.dir}/test-classes"/>
<property name="maven.build.testDir.0" value="src/test/java"/>
<property name="maven.build.testResourceDir.0" value="src/test/resources"/>
<property name="maven.test.reports" value="${maven.build.dir}/test-reports"/>
<property name="maven.reporting.outputDirectory" value="${maven.build.dir}/site"/>
<property name="maven.repo.local" value="${user.home}/.m2/repository"/>
<property name="maven.settings.offline" value="true"/>
<property name="maven.settings.interactiveMode" value="true"/>
<!-- ====================================================================== -->
<!-- Defining classpaths -->
<!-- ====================================================================== -->
<path id="build.classpath">
<pathelement location="${maven.repo.local}/org/bouncycastle/bcprov-jdk16/1.45/bcprov-jdk16-1.45.jar"/>
<pathelement location="${maven.repo.local}/log4j/log4j/1.2.14/log4j-1.2.14.jar"/>
<pathelement location="${maven.repo.local}/commons-cli/commons-cli/1.1/commons-cli-1.1.jar"/>
<pathelement location="${maven.repo.local}/commons-lang/commons-lang/2.3/commons-lang-2.3.jar"/>
</path>
<path id="build.test.classpath">
<pathelement location="${maven.repo.local}/junit/junit/3.8.1/junit-3.8.1.jar"/>
<pathelement location="${maven.repo.local}/org/bouncycastle/bcprov-jdk16/1.45/bcprov-jdk16-1.45.jar"/>
<pathelement location="${maven.repo.local}/log4j/log4j/1.2.14/log4j-1.2.14.jar"/>
<pathelement location="${maven.repo.local}/commons-cli/commons-cli/1.1/commons-cli-1.1.jar"/>
<pathelement location="${maven.repo.local}/commons-lang/commons-lang/2.3/commons-lang-2.3.jar"/>
</path>
<!-- ====================================================================== -->
<!-- Cleaning up target -->
<!-- ====================================================================== -->
<target name="clean" description="Clean the output directory">
<delete dir="${maven.build.dir}"/>
</target>
<!-- ====================================================================== -->
<!-- Compilation target -->
<!-- ====================================================================== -->
<target name="compile" depends="get-deps" description="Compile the code">
<mkdir dir="${maven.build.outputDir}"/>
<javac destdir="${maven.build.outputDir}"
nowarn="false"
debug="true"
optimize="false"
deprecation="true"
target="1.5"
verbose="false"
fork="false"
source="1.5">
<src>
<pathelement location="${maven.build.srcDir.0}"/>
</src>
<classpath refid="build.classpath"/>
</javac>
</target>
<!-- ====================================================================== -->
<!-- Test-compilation target -->
<!-- ====================================================================== -->
<target name="compile-tests"
depends="compile"
description="Compile the test code"
unless="maven.test.skip">
<mkdir dir="${maven.build.testOutputDir}"/>
<javac destdir="${maven.build.testOutputDir}"
nowarn="false"
debug="true"
optimize="false"
deprecation="true"
target="1.5"
verbose="false"
fork="false"
source="1.5">
<src>
<pathelement location="${maven.build.testDir.0}"/>
</src>
<classpath>
<path refid="build.test.classpath"/>
<pathelement location="${maven.build.outputDir}"/>
</classpath>
</javac>
</target>
<!-- ====================================================================== -->
<!-- Run all tests -->
<!-- ====================================================================== -->
<target name="test"
depends="compile-tests, junit-missing"
unless="junit.skipped"
description="Run the test cases">
<mkdir dir="${maven.test.reports}"/>
<junit printSummary="yes" haltonerror="true" haltonfailure="true" fork="true" dir=".">
<sysproperty key="basedir" value="."/>
<formatter type="xml"/>
<formatter type="plain" usefile="false"/>
<classpath>
<path refid="build.test.classpath"/>
<pathelement location="${maven.build.outputDir}"/>
<pathelement location="${maven.build.testOutputDir}"/>
</classpath>
<batchtest todir="${maven.test.reports}" unless="test">
<fileset dir="${maven.build.testDir.0}">
<include name="**/Test*.java"/>
<include name="**/*Test.java"/>
<include name="**/*TestCase.java"/>
<exclude name="**/*Abstract*Test.java"/>
</fileset>
</batchtest>
<batchtest todir="${maven.test.reports}" if="test">
<fileset dir="${maven.build.testDir.0}">
<include name="**/${test}.java"/>
<exclude name="**/*Abstract*Test.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="test-junit-present">
<available classname="junit.framework.Test" property="junit.present"/>
</target>
<target name="test-junit-status"
depends="test-junit-present">
<condition property="junit.missing">
<and>
<isfalse value="${junit.present}"/>
<isfalse value="${maven.test.skip}"/>
</and>
</condition>
<condition property="junit.skipped">
<or>
<isfalse value="${junit.present}"/>
<istrue value="${maven.test.skip}"/>
</or>
</condition>
</target>
<target name="junit-missing"
depends="test-junit-status"
if="junit.missing">
<echo>=================================== WARNING ===================================</echo>
<echo> JUnit is not present in your $ANT_HOME/lib directory. Tests not executed.</echo>
<echo>===============================================================================</echo>
</target>
<!-- ====================================================================== -->
<!-- Javadoc target -->
<!-- ====================================================================== -->
<target name="javadoc" description="Generates the Javadoc of the application">
<javadoc sourcepath="${maven.build.srcDir.0}"
packagenames="*"
destdir="${maven.reporting.outputDirectory}/apidocs"
access="protected"
old="false"
verbose="false"
version="true"
use="true"
author="true"
splitindex="false"
nodeprecated="false"
nodeprecatedlist="false"
notree="false"
noindex="false"
nohelp="false"
nonavbar="false"
serialwarn="false"
charset="ISO-8859-1"
linksource="false"
breakiterator="false"/>
</target>
<!-- ====================================================================== -->
<!-- Package target -->
<!-- ====================================================================== -->
<target name="package" depends="compile,test" description="Package the application">
<jar jarfile="${maven.build.dir}/${maven.build.finalName}.jar"
compress="true"
index="false"
basedir="${maven.build.outputDir}"
excludes="**/package.html"/>
</target>
<!-- ====================================================================== -->
<!-- A dummy target for the package named after the type it creates -->
<!-- ====================================================================== -->
<target name="jar" depends="package" description="Builds the jar for the application"/>
<!-- ====================================================================== -->
<!-- Download dependencies target -->
<!-- ====================================================================== -->
<target name="test-offline">
<condition property="maven.mode.offline">
<equals arg1="${maven.settings.offline}" arg2="true"/>
</condition>
</target>
<target name="get-deps"
depends="test-offline"
description="Download all dependencies"
unless="maven.mode.offline">
<mkdir dir="${maven.repo.local}"/>
<mkdir dir="${maven.repo.local}/junit/junit/3.8.1"/>
<get src="http://repo1.maven.org/maven2/junit/junit/3.8.1/junit-3.8.1.jar"
dest="${maven.repo.local}/junit/junit/3.8.1/junit-3.8.1.jar"
usetimestamp="false"
ignoreerrors="true"/>
<mkdir dir="${maven.repo.local}/org/bouncycastle/bcprov-jdk16/1.45"/>
<get src="http://repo1.maven.org/maven2/org/bouncycastle/bcprov-jdk16/1.45/bcprov-jdk16-1.45.jar"
dest="${maven.repo.local}/org/bouncycastle/bcprov-jdk16/1.45/bcprov-jdk16-1.45.jar"
usetimestamp="false"
ignoreerrors="true"/>
<mkdir dir="${maven.repo.local}/log4j/log4j/1.2.14"/>
<get src="http://repo1.maven.org/maven2/log4j/log4j/1.2.14/log4j-1.2.14.jar"
dest="${maven.repo.local}/log4j/log4j/1.2.14/log4j-1.2.14.jar"
usetimestamp="false"
ignoreerrors="true"/>
<mkdir dir="${maven.repo.local}/commons-cli/commons-cli/1.1"/>
<get src="http://repo1.maven.org/maven2/commons-cli/commons-cli/1.1/commons-cli-1.1.jar"
dest="${maven.repo.local}/commons-cli/commons-cli/1.1/commons-cli-1.1.jar"
usetimestamp="false"
ignoreerrors="true"/>
<mkdir dir="${maven.repo.local}/commons-lang/commons-lang/2.3"/>
<get src="http://repo1.maven.org/maven2/commons-lang/commons-lang/2.3/commons-lang-2.3.jar"
dest="${maven.repo.local}/commons-lang/commons-lang/2.3/commons-lang-2.3.jar"
usetimestamp="false"
ignoreerrors="true"/>
</target>
</project>

View file

@ -0,0 +1 @@
953241b6f0162bf031de5bc833977d93 voms-api-java-2.0.7.tar.gz

148
voms-api-java.spec Normal file
View file

@ -0,0 +1,148 @@
# Use maven if it is available - otherwise fall back to ant
%if %{?fedora}%{!?fedora:0} >= 15 || %{?rhel}%{!?rhel:0} >= 7
%global maven 1
%else
%global maven 0
%endif
Name: voms-api-java
Version: 2.0.7
Release: 1%{?dist}
Summary: Virtual Organization Membership Service Java API
Group: Development/Libraries
License: ASL 2.0
URL: http://glite.web.cern.ch/glite/
# This source tarball is created from a git checkout:
# git clone git://github.com/italiangrid/voms-api-java.git
# cd voms-api-java
# git archive --format tar --prefix voms-api-java-2.0.7/ 2_0_7 \
# | gzip - > ../voms-api-java-2.0.7.tar.gz
Source0: %{name}-%{version}.tar.gz
# These are build instructions for ant generated from the maven
# build instrutions using the maven ant plugin.
# These are used for building on EPEL since there is no maven
# available there.
Source1: build.xml
Source2: maven-build.xml
Source3: maven-build.properties
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
# There is no bouncycastle in EPEL 5 ppc and EPEL 6 ppc64
%if %{?rhel}%{!?rhel:0} == 5
ExcludeArch: ppc
%endif
%if %{?rhel}%{!?rhel:0} == 6
ExcludeArch: ppc64
%endif
Requires: java
Requires: jpackage-utils
Requires: bouncycastle >= 1.39
Requires: jakarta-commons-cli
Requires: jakarta-commons-lang
Requires: log4j
Provides: vomsjapi = %{version}-%{release}
Obsoletes: vomsjapi < 2.0.7
BuildRequires: java-devel >= 1:1.6.0
BuildRequires: jpackage-utils
%if %maven
BuildRequires: maven
BuildRequires: maven-compiler-plugin
BuildRequires: maven-install-plugin
BuildRequires: maven-jar-plugin
BuildRequires: maven-javadoc-plugin
BuildRequires: maven-release-plugin
BuildRequires: maven-resources-plugin
BuildRequires: maven-surefire-plugin
BuildRequires: junit4
%else
BuildRequires: ant
BuildRequires: ant-junit
%endif
BuildRequires: bouncycastle >= 1.39
BuildRequires: jakarta-commons-cli
BuildRequires: jakarta-commons-lang
BuildRequires: log4j
%description
The Virtual Organization Membership Service (VOMS) is an attribute authority
which serves as central repository for VO user authorization information,
providing support for sorting users into group hierarchies, keeping track of
their roles and other attributes in order to issue trusted attribute
certificates and SAML assertions used in the Grid environment for
authorization purposes.
This package provides a java client API for VOMS.
%package javadoc
Summary: Virtual Organization Membership Service Java API Documentation
Group: Documentation
Requires: jpackage-utils
Requires: %{name} = %{version}-%{release}
Provides: vomsjapi-javadoc = %{version}-%{release}
Obsoletes: vomsjapi-javadoc < 2.0.7
%description javadoc
Virtual Organization Membership Service (VOMS) Java API Documentation.
%prep
%setup -q
install -m 644 %SOURCE1 .
install -m 644 %SOURCE2 .
install -m 644 %SOURCE3 .
sed s/bcprov-ext-jdk15/bcprov-jdk16/ -i pom.xml
%build
%if %{maven}
mvn-rpmbuild install javadoc:aggregate
%else
CLASSPATH=$(build-classpath bcprov log4j jakarta-commons-cli \
jakarta-commons-lang) ant package javadoc
%endif
%install
mkdir -p $RPM_BUILD_ROOT%{_javadir}
install -m 644 target/%{name}-%{version}.jar \
$RPM_BUILD_ROOT%{_javadir}/%{name}.jar
ln -s %{name}.jar $RPM_BUILD_ROOT%{_javadir}/vomsjapi.jar
mkdir -p $RPM_BUILD_ROOT%{_javadocdir}/%{name}
%if %{maven}
cp -pr target/site/javadoc/apidocs $RPM_BUILD_ROOT%{_javadocdir}/%{name}
%else
cp -pr target/site/apidocs $RPM_BUILD_ROOT%{_javadocdir}/%{name}
%endif
%if %{maven}
mkdir -p $RPM_BUILD_ROOT%{_mavenpomdir}
install -m 644 pom.xml $RPM_BUILD_ROOT%{_mavenpomdir}/JPP-%{name}.pom
%add_maven_depmap JPP-%{name}.pom %{name}.jar -a vomsjapi:%{name}
%endif
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%{_javadir}/%{name}.jar
%{_javadir}/vomsjapi.jar
%if %{maven}
%{_mavenpomdir}/JPP-%{name}.pom
%{_mavendepmapfragdir}/%{name}
%endif
%doc AUTHORS LICENSE
%files javadoc
%defattr(-,root,root,-)
%doc %{_javadocdir}/%{name}
%changelog
* Tue Mar 20 2012 Mattias Ellert <mattias.ellert@fysast.uu.se> - 2.0.7-1
- The Java API is now a separate source tree from the rest of voms