Make mockito an OSGi bundle using upstream bnd config.

This commit is contained in:
Severin Gehwolf 2012-08-31 17:45:18 +02:00
parent f5831b6878
commit 4213781c4d
4 changed files with 51 additions and 7 deletions

27
fix-bnd-config.patch Normal file
View File

@ -0,0 +1,27 @@
--- conf/mockito-core.bnd.orig 2012-08-31 17:38:35.605728658 +0200
+++ conf/mockito-core.bnd 2012-08-31 17:39:06.490980938 +0200
@@ -1,8 +1,3 @@
--classpath= lib/run/com.springsource.org.junit-4.5.0.jar, \
- lib/run/com.springsource.org.hamcrest.core-1.1.0.jar, \
- lib/run/com.springsource.org.objenesis-1.0.0.jar
--versionpolicy=[${version;==;${@}},${version;+;${@}})
-
Bundle-Name= Mockito Mock Library for Java. Core bundle requires Hamcrest-core and Objenesis.
Bundle-SymbolicName= org.mockito.mockito-core
Bundle-Version= 1.9.0
@@ -10,7 +5,7 @@
Export-Package= !org.mockito.asm.*, \
!org.mockito.cglib.*, \
!org.mockito.internal.*, \
- org.mockito.*;version=${version}
+ org.mockito.*
Import-Package= junit.*;resolution:=optional, \
org.junit.*;resolution:=optional, \
@@ -21,4 +16,4 @@
Private-Package: org.mockito.*
--removeheaders: Private-Package
\ No newline at end of file
+-removeheaders: Private-Package

View File

@ -4,10 +4,16 @@ VERSION=1.9.0
SRCDIR=mockito-${VERSION}
hg clone https://code.google.com/p/mockito/ ${SRCDIR}
cd $SRCDIR
hg update ${VERSION}
rm -rf `find -name *.jar` build.gradle cglib-and-asm conf doc gradle gradlew gradlew.bat
pushd $SRCDIR
hg archive --prefix ${SRCDIR} -t tar -r ${VERSION} ../${SRCDIR}.tar
popd
rm -rf ${SRCDIR}
tar -xf ${SRCDIR}.tar
pushd ${SRCDIR}
rm -rf `find -name *.jar` build.gradle cglib-and-asm doc gradle gradlew gradlew.bat
dos2unix `find -name *.java`
cd ..
popd
tar -cvJf mockito-${VERSION}.tar.xz ${SRCDIR}

View File

@ -1,6 +1,6 @@
Name: mockito
Version: 1.9.0
Release: 7%{?dist}
Release: 8%{?dist}
Summary: A Java mocking framework
License: MIT
@ -10,6 +10,7 @@ Source1: make-mockito-sourcetarball.sh
Patch0: fixup-ant-script.patch
Patch1: fix-cglib-refs.patch
Patch2: maven-cglib-dependency.patch
Patch3: fix-bnd-config.patch
BuildArch: noarch
BuildRequires: jpackage-utils
@ -46,14 +47,21 @@ This package contains the API documentation for %{name}.
%patch0 -p1
%patch1 -p1
%patch2 -p1
# Set Bundle-Version properly
sed -i 's/Bundle-Version= ${version}/Bundle-Version= %{version}/' conf/mockito-core.bnd
%patch3
%build
ant jar javadoc
# Convert to OSGi bundle
pushd target
java -jar $(build-classpath aqute-bnd) wrap -output mockito-core-%{version}.bar -properties ../conf/mockito-core.bnd mockito-core-%{version}.jar
popd
%install
mkdir -p $RPM_BUILD_ROOT%{_javadir}
sed -i -e "s|@version@|%{version}|g" maven/mockito-core.pom
cp -p target/mockito-core-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}.jar
cp -p target/mockito-core-%{version}.bar $RPM_BUILD_ROOT%{_javadir}/%{name}.jar
install -d -m 755 $RPM_BUILD_ROOT%{_mavenpomdir}
install -pm 644 maven/mockito-core.pom \
@ -77,6 +85,9 @@ cp -rp target/javadoc/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}
%doc NOTICE
%changelog
* Mon Aug 27 2012 Severin Gehwolf <sgehwolf@redhat.com> 1.9.0-8
- Add aqute bnd instructions for OSGi metadata
* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.9.0-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

View File

@ -1 +1 @@
c358a9b514bee558dd78eaaa5d18cc15 mockito-1.9.0.tar.xz
1c8f7d570579d7fbaa2a45fdeaf3e3e1 mockito-1.9.0.tar.xz