hamcrest/hamcrest.spec

181 lines
6.8 KiB
RPMSpec
Raw Normal View History

#
# spec file for package hamcrest
#
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 https://bugs.opensuse.org/
#
Name: hamcrest
Version: 1.3
Release: 0
Summary: Library of matchers for building test expressions
License: BSD-3-Clause
Group: Development/Libraries/Java
Url: https://github.com/hamcrest/JavaHamcrest
Source0: http://%{name}.googlecode.com/files/%{name}-%{version}.tgz
Source1: http://repo1.maven.org/maven2/org/%{name}/%{name}-parent/%{version}/%{name}-parent-%{version}.pom
Source2: http://repo1.maven.org/maven2/org/%{name}/%{name}-library/%{version}/%{name}-library-%{version}.pom
Source3: http://repo1.maven.org/maven2/org/%{name}/%{name}-integration/%{version}/%{name}-integration-%{version}.pom
Source4: http://repo1.maven.org/maven2/org/%{name}/%{name}-generator/%{version}/%{name}-generator-%{version}.pom
Source5: http://repo1.maven.org/maven2/org/%{name}/%{name}-core/%{version}/%{name}-core-%{version}.pom
Source6: http://repo1.maven.org/maven2/org/%{name}/%{name}-all/%{version}/%{name}-all-%{version}.pom
# This file was added by the maintainer for compatibility with maven dep
# solving system
Source7: %{name}-text-%{version}.pom
Source8: hamcrest-core-MANIFEST.MF
Source9: hamcrest-library-MANIFEST.MF
Source10: hamcrest-text-MANIFEST.MF
Source11: hamcrest-integration-MANIFEST.MF
Source12: hamcrest-generator-MANIFEST.MF
#PATCH-FIX-OPENSUSE: don't use versioned deps, no overview in html
Patch0: %{name}-%{version}-build.patch
#PATCH-FIX-OPENSUSE: don't bundle QDox classes into hamcrest-generator.jar
Patch1: %{name}-%{version}-no-jarjar.patch
#PATCH-FIX-OPENSUSE: don't build hamcrest-integration.jar
Patch2: %{name}-%{version}-no-integration.patch
#PATCH-FIX-OPENSUSE: there is no hamcrest-generator-nodeps
Patch3: %{name}-%{version}-javadoc.patch
#PATCH-FIX-UPSTREAM: random build crash fix
Patch4: hamcrest-1.3-random-build-crash.patch
Patch5: hamcrest-1.3-fork-javac.patch
Patch6: hamcrest-1.3-javadoc9.patch
Patch7: hamcrest-1.3-javadoc10.patch
Patch8: hamcrest-1.3-qdox-2.0.patch
BuildRequires: ant >= 1.6.5
BuildRequires: java-devel >= 1.6.0
BuildRequires: javapackages-local
BuildRequires: javapackages-tools
BuildRequires: qdox >= 2.0
BuildRequires: zip
Requires: java >= 1.6.0
Requires: qdox >= 2.0
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
%description
Provides a library of matcher objects (also known as constraints or
predicates) allowing 'match' rules to be defined declaratively, to be
used in other frameworks. Typical scenarios include testing frameworks,
mocking libraries and UI validation rules.
%package javadoc
Summary: Javadoc for %{name}
Group: Documentation/HTML
%description javadoc
Javadoc for %{name}.
%package demo
Summary: Demo files for %{name}
Group: Development/Libraries/Java
Requires: %{name} = %{version}
Requires: junit
%description demo
Demo files for %{name}.
%prep
%setup -q
find . -type f -name "*.jar" | xargs -t rm
rm -fr hamcrest-integration/src/main/java/org/hamcrest/integration/JMock1Adapter.java
rm -fr hamcrest-integration/src/main/java/org/hamcrest/JMock1Matchers.java
rm -fr hamcrest-unit-test/src/main/java/org/hamcrest/integration/JMock1AdapterTest.java
ln -sf $(build-classpath qdox) lib/generator/
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
perl -pi -e 's/\r$//g' LICENSE.txt
%build
export CLASSPATH=$(build-classpath qdox)
ant -Dant.build.javac.source=1.6 -Dversion=%{version} -Dbuild.sysclasspath=last clean core generator library bigjar javadoc
# inject OSGi manifests
jar ufm build/%{name}-core-%{version}.jar %{SOURCE8}
jar ufm build/%{name}-library-%{version}.jar %{SOURCE9}
jar ufm build/%{name}-text-%{version}.jar %{SOURCE10}
jar ufm build/%{name}-integration-%{version}.jar %{SOURCE11}
jar ufm build/%{name}-generator-%{version}.jar %{SOURCE12}
%install
# jars
install -d -m 755 %{buildroot}%{_javadir}/%{name}
install -d -m 755 %{buildroot}%{_mavenpomdir}
install -m 644 %{SOURCE1} %{buildroot}%{_mavenpomdir}/JPP.%{name}-parent.pom
%add_maven_depmap JPP.%{name}-parent.pom
install -m 644 build/%{name}-all-%{version}.jar %{buildroot}%{_javadir}/%{name}/all.jar
install -m 644 %{SOURCE6} %{buildroot}%{_mavenpomdir}/JPP.%{name}-all.pom
%add_maven_depmap JPP.%{name}-all.pom %{name}/all.jar
install -m 644 build/%{name}-core-%{version}.jar %{buildroot}%{_javadir}/%{name}/core.jar
install -m 644 %{SOURCE5} %{buildroot}%{_mavenpomdir}/JPP.%{name}-core.pom
%add_maven_depmap JPP.%{name}-core.pom %{name}/core.jar
install -m 644 build/%{name}-generator-%{version}.jar %{buildroot}%{_javadir}/%{name}/generator.jar
install -m 644 %{SOURCE4} %{buildroot}%{_mavenpomdir}/JPP.%{name}-generator.pom
%add_maven_depmap JPP.%{name}-generator.pom %{name}/generator.jar
install -m 644 build/%{name}-library-%{version}.jar %{buildroot}%{_javadir}/%{name}/library.jar
install -m 644 %{SOURCE2} %{buildroot}%{_mavenpomdir}/JPP.%{name}-library.pom
%add_maven_depmap JPP.%{name}-library.pom %{name}/library.jar
install -m 644 build/%{name}-text-%{version}.jar %{buildroot}%{_javadir}/%{name}/text.jar
install -m 644 %{SOURCE7} %{buildroot}%{_mavenpomdir}/JPP.%{name}-text.pom
%add_maven_depmap JPP.%{name}-text.pom %{name}/text.jar
# javadoc
install -d -m 755 %{buildroot}%{_javadocdir}/%{name}
cp -pr build/temp/hamcrest-all-1.3-javadoc.jar.contents/* %{buildroot}%{_javadocdir}/%{name}
# demo
install -d -m 755 %{buildroot}%{_datadir}/%{name}
cp -pr %{name}-examples %{buildroot}%{_datadir}/%{name}/
%files
%defattr(0644,root,root,0755)
%doc LICENSE.txt
%dir %{_javadir}/%{name}
%{_javadir}/%{name}/all.jar
%{_javadir}/%{name}/core.jar
%{_javadir}/%{name}/generator.jar
%if %with integration
%{_javadir}/%{name}/integration.jar
%endif
%{_javadir}/%{name}/library.jar
%{_javadir}/%{name}/text.jar
%if %with tests
%{_javadir}/%{name}/unit-test.jar
%endif
%{_mavenpomdir}/*
%{_datadir}/maven-metadata/%{name}.xml*
%files javadoc
%defattr(0644,root,root,0755)
%{_javadocdir}/%{name}
%files demo
%defattr(0644,root,root,0755)
%{_datadir}/%{name}
%changelog