File google-gson.spec of Package google-gson

#
# spec file for package google-gson
#
# Copyright (c) 2014 Peter Conrad <obs@quisquis.de>
#
# 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:		google-gson
Version:	2.2.4
Release:	1
License:	Apache-2.0
Summary:	Java <-> JSON converter
Url:		http://code.google.com/p/google-gson/
Group:		Development/Libraries/Java
Source:		http://google-gson.googlecode.com/files/google-gson-%{version}-release.zip
BuildRequires:	java-devel ant unzip dos2unix
BuildRoot:	%{_tmppath}/%{name}-%{version}-build
BuildArch:	noarch
%if 0%{?fedora} > 0
BuildRequires:	java-1.5.0-gcj-devel
%endif

%description
Gson is a Java library that can be used to convert Java Objects into their
JSON representation. It can also be used to convert a JSON string to an
equivalent Java object. Gson can work with arbitrary Java objects including
pre-existing objects that you do not have source-code of.

There are a few open-source projects that can convert Java objects to JSON.
However, most of them require that you place Java annotations in your classes;
something that you can not do if you do not have access to the source-code.
Most also do not fully support the use of Java Generics. Gson considers both
of these as very important design goals.

Gson Goals

* Provide simple toJson() and fromJson() methods to convert Java objects to
  JSON and vice-versa
* Allow pre-existing unmodifiable objects to be converted to and from JSON
* Extensive support of Java Generics
* Allow custom representations for objects
* Support arbitrarily complex objects (with deep inheritance hierarchies and
  extensive use of generic types) 

%package javadoc
Summary:	Javadoc for %name
Group:		Development/Libraries/Java

%description javadoc
This package contains the documentation for %{name}.

%prep
%setup -q
unzip -q "gson-%{version}-sources.jar"
%__rm *.jar

%build
dos2unix LICENSE
%__mkdir_p build/classes
find . -name \*.java | xargs javac -g -d build/classes
jar cf "%{name}.jar" -C build/classes .
%__mkdir_p build/doc
javadoc -d build/doc/ -subpackages com.google.gson

%install
%__install -dm 755 "%{buildroot}/%{_javadir}"
%__install -m 0644 "%{name}.jar"  "%{buildroot}/%{_javadir}/%{name}-%{version}.jar"
%__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 README
%{_javadir}/%{name}-%{version}.jar
%{_javadir}/%{name}.jar

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

%changelog
openSUSE Build Service is sponsored by