[powermock] Use mvn_build

Michael Šimáček msimacek at fedoraproject.org
Tue Mar 25 13:46:07 UTC 2014


commit 07bccec8f4fec9ea86a505376d22ce185f876f30
Author: Michael Simacek <msimacek at redhat.com>
Date:   Fri Mar 21 14:13:07 2014 +0100

    Use mvn_build

 powermock-disable-modules.patch |   66 ------------
 powermock.spec                  |  218 +++++++++++++--------------------------
 2 files changed, 73 insertions(+), 211 deletions(-)
---
diff --git a/powermock.spec b/powermock.spec
index 055d4c8..2f4a235 100644
--- a/powermock.spec
+++ b/powermock.spec
@@ -1,8 +1,7 @@
 Name:           powermock
 Version:        1.4.12
-Release:        8%{?dist}
+Release:        9%{?dist}
 Summary:        A Java mocking framework
-Group:          Development/Libraries
 
 License:        ASL 2.0
 URL:            http://code.google.com/p/powermock/
@@ -10,16 +9,13 @@ Source0:        powermock-%{version}.tar.xz
 Source1:        make-powermock-sourcetarball.sh
 # Disable broken tests.
 Patch0:         powermock-disable-broken-tests.patch
-# Disable modules that we cannot build (yet).
-Patch1:         powermock-disable-modules.patch
 # Fix cglib dependency of mockito
 Patch2:         powermock-fix-cglib-mockito.patch
 # Fix compatibility with JUnit3
 Patch3:         powermock-fix-junit3-compat.patch
 
 BuildArch:      noarch
-BuildRequires:  jpackage-utils
-BuildRequires:  java-devel
+
 BuildRequires:  maven-local
 BuildRequires:  maven-enforcer-plugin
 BuildRequires:  maven-surefire-plugin
@@ -27,217 +23,149 @@ BuildRequires:  maven-surefire-provider-junit4
 BuildRequires:  maven-install-plugin
 BuildRequires:  objenesis
 BuildRequires:  junit4
-BuildRequires:  junit
 BuildRequires:  mockito
 BuildRequires:  easymock3
 BuildRequires:  javassist
 
-Requires:       jpackage-utils
-Requires:       java
+%global desc \
+PowerMock is a framework that extend other mock libraries\
+such as EasyMock with more powerful capabilities. PowerMock uses a\
+custom classloader and bytecode manipulation to enable mocking of\
+static methods, constructors, final classes and methods, private\
+methods, removal of static initializers and more.
 
 %description
-PowerMock is a framework that extend other mock libraries
-such as EasyMock with more powerful capabilities. PowerMock uses a
-custom classloader and bytecode manipulation to enable mocking of
-static methods, constructors, final classes and methods, private
-methods, removal of static initializers and more.
+%{desc}
 
 %package common
 Summary:        Common files for PowerMock
 
 %description common
-PowerMock is a framework that extend other mock libraries
-such as EasyMock with more powerful capabilities. PowerMock uses a
-custom classloader and bytecode manipulation to enable mocking of
-static methods, constructors, final classes and methods, private
-methods, removal of static initializers and more.
+%{desc}
 
 This package contains common files for all PowerMock modules.
 
 %package reflect
 Summary:        Reflection module of PowerMock
-Requires:       objenesis
-Requires:       powermock-common
+Requires:       %{name}-common = %{version}-%{release}
 
 %description reflect
-PowerMock is a framework that extend other mock libraries
-such as EasyMock with more powerful capabilities. PowerMock uses a
-custom classloader and bytecode manipulation to enable mocking of
-static methods, constructors, final classes and methods, private
-methods, removal of static initializers and more.
+%{desc}
 
 This package contains the reflection module of PowerMock.
 
 %package core
 Summary:        Core module of PowerMock
-Requires:       powermock-reflect
-Requires:       javassist
-Requires:       powermock-common
+Requires:       %{name}-common = %{version}-%{release}
 
 %description core
-PowerMock is a framework that extend other mock libraries
-such as EasyMock with more powerful capabilities. PowerMock uses a
-custom classloader and bytecode manipulation to enable mocking of
-static methods, constructors, final classes and methods, private
-methods, removal of static initializers and more.
+%{desc}
 
 This package contains the core module of PowerMock.
 
 %package junit4
 Summary:        JUnit4 common module of PowerMock
-Requires:       powermock-core
-Requires:       junit4
-Requires:       powermock-common
+Requires:       %{name}-common = %{version}-%{release}
 
 %description junit4
-PowerMock is a framework that extend other mock libraries
-such as EasyMock with more powerful capabilities. PowerMock uses a
-custom classloader and bytecode manipulation to enable mocking of
-static methods, constructors, final classes and methods, private
-methods, removal of static initializers and more.
+%{desc}
 
 This package contains the JUnit4 module of PowerMock.
 
 %package api-support
 Summary:        PowerMock API support module
-Requires:       powermock-core
-Requires:       powermock-common
+Requires:       %{name}-common = %{version}-%{release}
 
 %description api-support
-PowerMock is a framework that extend other mock libraries
-such as EasyMock with more powerful capabilities. PowerMock uses a
-custom classloader and bytecode manipulation to enable mocking of
-static methods, constructors, final classes and methods, private
-methods, removal of static initializers and more.
+%{desc}
 
 This package contains support code for the PowerMock API extensions.
 
 %package api-mockito
 Summary:        PowerMock Mockito API module
-Requires:       powermock-api-support
-Requires:       mockito
-Requires:       cglib
-Requires:       powermock-common
+Requires:       %{name}-common = %{version}-%{release}
 
 %description api-mockito
-PowerMock is a framework that extend other mock libraries
-such as EasyMock with more powerful capabilities. PowerMock uses a
-custom classloader and bytecode manipulation to enable mocking of
-static methods, constructors, final classes and methods, private
-methods, removal of static initializers and more.
+%{desc}
 
 This package contains the PowerMock Mockito API extension.
 
 %package javadoc
 Summary:        JavaDocs for %{name}
-Group:          Documentation
-Requires:       jpackage-utils
 
 %description javadoc
-PowerMock is a framework that extend other mock libraries
-such as EasyMock with more powerful capabilities. PowerMock uses a
-custom classloader and bytecode manipulation to enable mocking of
-static methods, constructors, final classes and methods, private
-methods, removal of static initializers and more.
+%{desc}
 
 This package contains the API documentation for %{name}.
 
 %prep
 %setup -q
 %patch0
-%patch1
 %patch2
 %patch3
 
+# Disable modules that we cannot build (yet).
+%pom_disable_module module-test modules
+%pom_disable_module junit4-legacy modules/module-impl
+%pom_disable_module junit4-rule-agent modules/module-impl
+%pom_disable_module junit3 modules/module-impl
+%pom_disable_module testng modules/module-impl
+%pom_disable_module testng-agent modules/module-impl
+%pom_disable_module testng-common modules/module-impl
+%pom_disable_module agent modules/module-impl
+%pom_disable_module easymock api
+%pom_disable_module examples
+%pom_disable_module release
+%pom_disable_module classloading-xstream classloading
+
+%pom_remove_plugin :rat-maven-plugin
+%pom_remove_plugin :maven-source-plugin
+%pom_xpath_remove "pom:plugin[pom:artifactId='maven-javadoc-plugin']/pom:executions"
+
+%mvn_package :powermock-core core
+%mvn_package :powermock-classloading-module core
+%mvn_package :powermock-classloading-base core
+%mvn_package :powermock-classloading-objenesis core
+%mvn_package :powermock-module-junit4 junit4
+%mvn_package :powermock-module-junit4-rule junit4
+%mvn_package :powermock-module-junit4-common junit4
+%mvn_package :powermock-api-mockito api-mockito
+%mvn_package :powermock-api-support api-support
+%mvn_package :powermock-reflect reflect
+
+%mvn_package org.powermock.tests: __noinstall
+
+# poms are not neede by anything
+%mvn_package org.powermock:powermock __noinstall
+%mvn_package org.powermock:powermock-api __noinstall
+%mvn_package org.powermock:powermock-modules __noinstall
+%mvn_package org.powermock:powermock-modules-impl __noinstall
+
 %build
-mvn-rpmbuild -DargLine=-XX:-UseSplitVerifier install javadoc:aggregate
+%mvn_build
 
 %install
-mkdir -p $RPM_BUILD_ROOT%{_javadir}/%{name}
-cp -p reflect/target/powermock-reflect-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/%{name}-reflect.jar
-cp -p core/target/powermock-core-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/%{name}-core.jar
-cp -p modules/module-impl/junit4-common/target/powermock-module-junit4-common-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/%{name}-junit4-common.jar
-cp -p modules/module-impl/junit4/target/powermock-module-junit4-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/%{name}-junit4.jar
-cp -p api/support/target/powermock-api-support-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/%{name}-api-support.jar
-cp -p api/mockito/target/powermock-api-mockito-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}/%{name}-api-mockito.jar
-
-install -d -m 755 $RPM_BUILD_ROOT%{_mavenpomdir}
-install -pm 644 pom.xml  \
-        $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-%{name}.pom
-install -pm 644 reflect/pom.xml  \
-        $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-%{name}-reflect.pom
-install -pm 644 core/pom.xml  \
-        $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-%{name}-core.pom
-install -pm 644 modules//pom.xml  \
-        $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-%{name}-modules.pom
-install -pm 644 modules/module-impl/junit4-common/pom.xml  \
-        $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-%{name}-junit4-common.pom
-install -pm 644 modules/module-impl/junit4/pom.xml  \
-        $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-%{name}-junit4.pom
-install -pm 644 api/pom.xml  \
-        $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-%{name}-api.pom
-install -pm 644 api/support/pom.xml  \
-        $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-%{name}-api-support.pom
-install -pm 644 api/mockito/pom.xml  \
-        $RPM_BUILD_ROOT%{_mavenpomdir}/JPP.%{name}-%{name}-api-mockito.pom
-
-mkdir -p $RPM_BUILD_ROOT%{_javadocdir}/%{name}
-cp -rp target/site/apidocs/* $RPM_BUILD_ROOT%{_javadocdir}/%{name}
-
-%add_maven_depmap JPP.%{name}-%{name}.pom
-%add_maven_depmap JPP.%{name}-%{name}-modules.pom
-%add_maven_depmap JPP.%{name}-%{name}-api.pom
-%add_maven_depmap JPP.%{name}-%{name}-reflect.pom %{name}/%{name}-reflect.jar -f "reflect"
-%add_maven_depmap JPP.%{name}-%{name}-core.pom %{name}/%{name}-core.jar -f "core"
-%add_maven_depmap JPP.%{name}-%{name}-junit4-common.pom %{name}/%{name}-junit4-common.jar -f "junit4"
-%add_maven_depmap JPP.%{name}-%{name}-junit4.pom %{name}/%{name}-junit4.jar -f "junit4"
-%add_maven_depmap JPP.%{name}-%{name}-api-support.pom %{name}/%{name}-api-support.jar -f "api-support"
-%add_maven_depmap JPP.%{name}-%{name}-api-mockito.pom %{name}/%{name}-api-mockito.jar -f "api-mockito"
+%mvn_install
 
 %files common
-%{_mavenpomdir}/JPP.%{name}-%{name}.pom
-%{_mavenpomdir}/JPP.%{name}-%{name}-modules.pom
-%{_mavenpomdir}/JPP.%{name}-%{name}-api.pom
-%{_mavendepmapfragdir}/%{name}
-%doc LICENSE.txt
-
-%files reflect
-%{_javadir}/%{name}/%{name}-reflect.jar
-%{_mavenpomdir}/JPP.%{name}-%{name}-reflect.pom
-%{_mavendepmapfragdir}/%{name}-reflect
-%doc LICENSE.txt
-
-%files core
-%{_javadir}/%{name}/%{name}-core.jar
-%{_mavenpomdir}/JPP.%{name}-%{name}-core.pom
-%{_mavendepmapfragdir}/%{name}-core
-%doc LICENSE.txt
-
-%files junit4
-%{_javadir}/%{name}/%{name}-junit4-common.jar
-%{_javadir}/%{name}/%{name}-junit4.jar
-%{_mavenpomdir}/JPP.%{name}-%{name}-junit4-common.pom
-%{_mavenpomdir}/JPP.%{name}-%{name}-junit4.pom
-%{_mavendepmapfragdir}/%{name}-junit4
-%doc LICENSE.txt
-
-%files api-support
-%{_javadir}/%{name}/%{name}-api-support.jar
-%{_mavenpomdir}/JPP.%{name}-%{name}-api-support.pom
-%{_mavendepmapfragdir}/%{name}-api-support
+%dir %{_javadir}/%{name}
 %doc LICENSE.txt
+%files reflect -f .mfiles-reflect
+%files core -f .mfiles-core
+%files junit4 -f .mfiles-junit4
+%files api-support -f .mfiles-api-support
+%files api-mockito -f .mfiles-api-mockito
 
-%files api-mockito
-%{_javadir}/%{name}/%{name}-api-mockito.jar
-%{_mavenpomdir}/JPP.%{name}-%{name}-api-mockito.pom
-%{_mavendepmapfragdir}/%{name}-api-mockito
-%doc LICENSE.txt
-
-%files javadoc
-%{_javadocdir}/%{name}
+%files javadoc -f .mfiles-javadoc
 %doc LICENSE.txt
 
 %changelog
+* Fri Mar 21 2014 Michael Simacek <msimacek at redhat.com> - 1.4.12-9
+- Use mvn_build
+- Drop manual requires
+- Use pom macros instead of a patch
+- Collapse description into a macro
+
 * Fri Jul 26 2013 Alexander Kurtakov <akurtako at redhat.com> 1.4.12-8
 - Build against easymock3.
 


More information about the scm-commits mailing list