File objenesis.spec of Package objenesis

#
# spec file for package objenesis
#
# Copyright (c) 2013 Peter Conrad
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#

Name:		objenesis
Version:	1.3
Release:	1
License:	Apache-2.0
Summary:	Object instantiation helper library
Url:		http://www.objenesis.org/
Group:		Development/Libraries/Java
Source:		http://%{name}.googlecode.com/files/%{name}-%{version}-bin.zip
BuildRequires:	java-devel >= 1.6.0 unzip
%if 0%{?fedora} > 0
BuildRequires:	java-1.5.0-gcj-devel
%endif
%if 0%{?suse_version} > 1300
BuildRequires:	javapackages-tools
%endif
BuildArch:	noarch
BuildRoot:	%{_tmppath}/%{name}-%{version}-build

%description
Java already supports this dynamic instantiation of classes using
Class.newInstance(). However, this only works if the class has an appropriate
constructor. There are many times when a class cannot be instantiated this way,
such as when the class contains:

* Constructors that require arguments.
* Constructors that have side effects.
* Constructors that throw exceptions.

As a result, it is common to see restrictions in libraries stating that classes
must require a default constructor. Objenesis aims to overcomes these
restrictions by bypassing the constructor on object instantiation.

%package javadoc
Summary:	API documentation of objenesis
Group:		Development/Libraries/Java

%description javadoc
This package contains the API documentation of the objenesis library.

%prep
%setup -q
%__mkdir_p src
cd src
jar xf "../%{name}-%{version}-sources.jar"

%build
FILES="`find src -name \*.java`"

%__mkdir_p build/classes
javac -d build/classes -source 1.5 -target 1.5 -g -encoding utf8 $FILES
jar cf "build/%{name}-%{version}.jar" -C build/classes .

%__mkdir_p build/doc
javadoc -d build/doc -sourcepath src -classpath build/classes -encoding utf8 $FILES

%install
%__install -dm 755 "%{buildroot}%{_javadir}"
%__install -m 0644 "build/%{name}-%{version}.jar" "%{buildroot}%{_javadir}/"
%__ln_s "%{name}-%{version}.jar" "%{buildroot}%{_javadir}/%{name}.jar"

%__install -dm 755 "%{buildroot}/%{_javadocdir}/%{name}-%{version}"
cp -pr build/doc "%{buildroot}/%{_javadocdir}/%{name}-%{version}/"

%files
%defattr(-,root,root,-)
%doc LICENSE NOTICE
%{_javadir}/%{name}-%{version}.jar
%{_javadir}/%{name}.jar

%files javadoc
%defattr(-,root,root,-)
%{_javadocdir}/%{name}-%{version}/

%changelog
openSUSE Build Service is sponsored by