%global short_name guice %global with_ext 1 %global with_guice_persist 0 Name: google-%{short_name} Version: 3.0 Release: %mkrel 0.1.rc2.3 Summary: Lightweight dependency injection framework Group: Development/Java License: ASL 2.0 URL: http://code.google.com/p/%{name} # svn export -r1219 http://google-guice.googlecode.com/svn/trunk/ guice-2.0-1219 # tar caf guice-2.0-1219.tar.xz guice-2.0-1219 Source0: https://%{name}.googlecode.com/files/%{short_name}-%{version}-rc2-src.zip # patch from http://github.com/sonatype/sisu-guice # excluded changes to pom.xml files that changed groupIds # needed for maven 3 to work Patch0: sisu-custom.patch # remove unavailable deps Patch1: google-guice-3.0-extensions-poms.patch BuildArch: noarch BuildRequires: java-devel >= 0:1.6.0 BuildRequires: ant BuildRequires: jarjar => 1.0 BuildRequires: cglib BuildRequires: aqute-bndlib BuildRequires: objectweb-asm BuildRequires: junit BuildRequires: atinject BuildRequires: zip BuildRequires: slf4j %if %with_ext %if %with_guice_persist BuildRequires: hibernate-jpa-2.0-api %endif BuildRequires: servlet25 %endif Requires: java >= 0:1.6.0 Requires(post): jpackage-utils Requires(postun): jpackage-utils %description Put simply, Guice alleviates the need for factories and the use of new in your Java code. Think of Guice's @Inject as the new new. You will still need to write factories in some cases, but your code will not depend directly on them. Your code will be easier to change, unit test and reuse in other contexts. Guice embraces Java's type safe nature, especially when it comes to features introduced in Java 5 such as generics and annotations. You might think of Guice as filling in missing features for core Java. Ideally, the language itself would provide most of the same features, but until such a language comes along, we have Guice. Guice helps you design better APIs, and the Guice API itself sets a good example. Guice is not a kitchen sink. We justify each feature with at least three use cases. When in doubt, we leave it out. We build general functionality which enables you to extend Guice rather than adding every feature to the core framework. %package javadoc Summary: API documentation for %{name} Group: Development/Java Requires: jpackage-utils %description javadoc %{summary}. %prep %setup -q -n %{short_name}-%{version}-rc2-src %patch0 %patch1 -p1 # remove parent definition referencing google-parent sed -ie '/<parent>/,/<\/parent/ {d}' pom.xml %if %with_ext sed -i "s|<module>spring</module>|<!--module>spring</module-->|" extensions/pom.xml sed -i "s|<module>struts2</module>|<!--module>struts2</module-->|" extensions/pom.xml %endif # remove bundled libraries find . -name '*.class' -delete find . -name '*.bar' -delete # we'll repack munge.jar so don't delete it just yet find . -name '*.jar' -not -name 'munge.jar' -delete # re-create symlinks pushd lib/build build-jar-repository -s -p . aqute-bndlib cglib slf4j \ jarjar junit objectweb-asm \ mv aqute-bndlib*.jar bnd-0.0.384.jar mv cglib*.jar cglib-2.2.1-snapshot.jar mv jarjar*.jar jarjar-snapshot.jar mv objectweb-asmasm-all.jar asm-3.1.jar popd ln -sf `build-classpath atinject` lib/javax.inject.jar # there is munge.jar defining ant task it's a mixture of files, but # there are sources in jar so we re-compile the jar to verify it # builds mkdir munge-repack unzip lib/build/munge.jar -d munge-repack rm lib/build/munge.jar pushd munge-repack rm *.class javac -cp `build-classpath ant junit` *.java zip -r ../lib/build/munge.jar . popd rm -rf munge-repack #end munge.jar repack %build # create no-aop build environment ant no_aop pushd build/no_aop/ # javadoc fails without this directory mkdir -p servlet/lib/build ant -Dversion=%{version} jar popd %if %with_ext cp -pr $PWD/build/no_aop/build/dist/%{short_name}-%{version}.jar lib/ mkdir -p build/no_aop/extensions/servlet/lib/build pushd build/no_aop/extensions/servlet/lib build-jar-repository -s -p . tomcat6-servlet-2.5-api popd EXT="assistedinject grapher jmx jndi multibindings servlet throwingproviders" %if %with_guice_persist EXT="$EXT persist" mkdir -p build/no_aop/extensions/persist/lib/build pushd build/no_aop/extensions/persist/lib build-jar-repository -s -p . hibernate/hibernate-jpa-2.0-api popd %else sed -i "s|<module>persist</module>|<!--module>persist</module-->|" extensions/pom.xml %endif pushd build/no_aop/extensions # TODO spring struts2 for e in $EXT ; do pushd $e ant -Dversion=%{version} popd done popd %endif %install [ %{buildroot} != / ] && rm -rf %{buildroot} install -d -m 0755 $RPM_BUILD_ROOT%{_javadir} pushd build/no_aop install -pm 644 build/dist/%{short_name}-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}.jar ln -sf %{name}.jar $RPM_BUILD_ROOT%{_javadir}/%{short_name}.jar install -d -m 755 $RPM_BUILD_ROOT%{_mavenpomdir} install -pm 644 pom.xml $RPM_BUILD_ROOT/%{_mavenpomdir}/JPP-%{name}-parent.pom %add_to_maven_depmap com.google.inject %{short_name}-parent %{version} JPP %{name}-parent install -pm 644 core/pom.xml $RPM_BUILD_ROOT/%{_mavenpomdir}/JPP-%{name}.pom %add_to_maven_depmap com.google.inject %{short_name} %{version} JPP %{name} # provide sisu group/artifact (should be just mavenized google-guice # with %add_to_maven_depmap org.sonatype.sisu sisu-%{short_name} %{version} JPP %{name} %if %with_ext pushd extensions install -pm 644 pom.xml $RPM_BUILD_ROOT/%{_mavenpomdir}/JPP-%{short_name}-extensions-parent.pom %add_maven_depmap JPP-%{short_name}-extensions-parent.pom install -pm 644 assistedinject/build/%{short_name}-assistedinject-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{short_name}-assistedinject.jar install -pm 644 assistedinject/pom.xml $RPM_BUILD_ROOT/%{_mavenpomdir}/JPP-%{short_name}-assistedinject.pom %add_maven_depmap JPP-%{short_name}-assistedinject.pom %{short_name}-assistedinject.jar install -pm 644 grapher/build/%{short_name}-grapher-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{short_name}-grapher.jar install -pm 644 grapher/pom.xml $RPM_BUILD_ROOT/%{_mavenpomdir}/JPP-%{short_name}-grapher.pom %add_maven_depmap JPP-%{short_name}-grapher.pom %{short_name}-grapher.jar install -pm 644 jmx/build/%{short_name}-jmx-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{short_name}-jmx.jar install -pm 644 jmx/pom.xml $RPM_BUILD_ROOT/%{_mavenpomdir}/JPP-%{short_name}-jmx.pom %add_maven_depmap JPP-%{short_name}-jmx.pom %{short_name}-jmx.jar install -pm 644 jndi/build/%{short_name}-jndi-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{short_name}-jndi.jar install -pm 644 jndi/pom.xml $RPM_BUILD_ROOT/%{_mavenpomdir}/JPP-%{short_name}-jndi.pom %add_maven_depmap JPP-%{short_name}-jndi.pom %{short_name}-jndi.jar install -pm 644 multibindings/build/%{short_name}-multibindings-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{short_name}-multibindings.jar install -pm 644 multibindings/pom.xml $RPM_BUILD_ROOT/%{_mavenpomdir}/JPP-%{short_name}-multibindings.pom %add_maven_depmap JPP-%{short_name}-multibindings.pom %{short_name}-multibindings.jar %if %with_guice_persist install -pm 644 persist/build/%{short_name}-persist-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{short_name}-persist.jar install -pm 644 persist/pom.xml $RPM_BUILD_ROOT/%{_mavenpomdir}/JPP-%{short_name}-persist.pom %add_maven_depmap JPP-%{short_name}-persist.pom %{short_name}-persist.jar %endif install -pm 644 servlet/build/%{short_name}-servlet-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{short_name}-servlet.jar install -pm 644 servlet/pom.xml $RPM_BUILD_ROOT/%{_mavenpomdir}/JPP-%{short_name}-servlet.pom %add_maven_depmap JPP-%{short_name}-servlet.pom %{short_name}-servlet.jar install -pm 644 throwingproviders/build/%{short_name}-throwingproviders-%{version}.jar \ $RPM_BUILD_ROOT%{_javadir}/%{short_name}-throwingproviders.jar install -pm 644 throwingproviders/pom.xml $RPM_BUILD_ROOT/%{_mavenpomdir}/JPP-%{short_name}-throwingproviders.pom %add_maven_depmap JPP-%{short_name}-throwingproviders.pom %{short_name}-throwingproviders.jar popd %endif popd # javadoc install -d -m 0755 $RPM_BUILD_ROOT%{_javadocdir}/%{name} cp -r javadoc/* %{buildroot}%{_javadocdir}/%{name} %pre javadoc # workaround for rpm bug, can be removed in F-17 [ $1 -gt 1 ] && [ -L %{_javadocdir}/%{name} ] && \ rm -rf $(readlink -f %{_javadocdir}/%{name}) %{_javadocdir}/%{name} || : %post %update_maven_depmap %postun %update_maven_depmap %files %doc COPYING %{_javadir}/*.jar %{_mavenpomdir}/* %{_mavendepmapfragdir}/* %files javadoc %doc COPYING %doc %{_javadocdir}/%{name} %changelog * Sun Oct 09 2011 gil <gil> 3.0-0.1.rc2.3.mga2 + Revision: 153488 - edit release.... - added extension libraries * Thu Apr 28 2011 dmorgan <dmorgan> 3.0-0.1.rc2.2.mga1 + Revision: 92449 - Rebuild after bootstrapping - imported package google-guice * Tue Mar 1 2011 Stanislav Ochotnicky <sochotnicky@redhat.com> - 3.0-0.1.rc2 - Update to 3.0rc2 - Changes according to new guidelines (versionless jars & javadocs) * Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.0-4.1219svn - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild * Thu Oct 14 2010 Stanislav Ochotnicky <sochotnicky@redhat.com> - 2.0-3.1219svn - Add java-devel >= 1:1.6.0 to BR * Wed Oct 13 2010 Stanislav Ochotnicky <sochotnicky@redhat.com> - 2.0-2.1219svn - Moved munge repacking to prep - Added -Dversion to change generated manifest version - Removed http part of URL * Thu Oct 7 2010 Stanislav Ochotnicky <sochotnicky@redhat.com> - 2.0-1.1219svn - Initial version of the package