1 |
%global short_name guice |
2 |
%global revision 1219 |
3 |
|
4 |
Name: google-%{short_name} |
5 |
Version: 2.0 |
6 |
Release: 3.1219svn%{?dist} |
7 |
Summary: Lightweight dependency injection framework |
8 |
|
9 |
|
10 |
Group: Development/Tools |
11 |
License: ASL 2.0 |
12 |
URL: http://code.google.com/p/%{name} |
13 |
|
14 |
# svn export -r1219 http://google-guice.googlecode.com/svn/trunk/ guice-2.0-1219 |
15 |
# tar caf guice-2.0-1219.tar.xz guice-2.0-1219 |
16 |
Source0: %{short_name}-%{version}-%{revision}.tar.xz |
17 |
|
18 |
# TODO upstream |
19 |
Patch0: 0001-aop-fix.patch |
20 |
# see http://code.google.com/p/google-guice/issues/detail?id=436 |
21 |
# needed for sisu-inject (and maven-3) |
22 |
Patch1: 0002-get-type-converter-binding.patch |
23 |
# remove aopalliacne dep from pom and parent pom |
24 |
Patch2: 0003-aopaliance.patch |
25 |
|
26 |
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) |
27 |
|
28 |
BuildArch: noarch |
29 |
|
30 |
BuildRequires: java-devel >= 1:1.6.0 |
31 |
BuildRequires: ant |
32 |
BuildRequires: jarjar => 1.0 |
33 |
BuildRequires: cglib |
34 |
BuildRequires: aqute-bndlib |
35 |
BuildRequires: objectweb-asm |
36 |
BuildRequires: junit |
37 |
BuildRequires: atinject |
38 |
|
39 |
Requires: java >= 1:1.6.0 |
40 |
Requires(post): jpackage-utils |
41 |
Requires(postun): jpackage-utils |
42 |
|
43 |
%description |
44 |
Put simply, Guice alleviates the need for factories and the use of new |
45 |
in your Java code. Think of Guice's @Inject as the new new. You will |
46 |
still need to write factories in some cases, but your code will not |
47 |
depend directly on them. Your code will be easier to change, unit test |
48 |
and reuse in other contexts. |
49 |
|
50 |
Guice embraces Java's type safe nature, especially when it comes to |
51 |
features introduced in Java 5 such as generics and annotations. You |
52 |
might think of Guice as filling in missing features for core |
53 |
Java. Ideally, the language itself would provide most of the same |
54 |
features, but until such a language comes along, we have Guice. |
55 |
|
56 |
Guice helps you design better APIs, and the Guice API itself sets a |
57 |
good example. Guice is not a kitchen sink. We justify each feature |
58 |
with at least three use cases. When in doubt, we leave it out. We |
59 |
build general functionality which enables you to extend Guice rather |
60 |
than adding every feature to the core framework. |
61 |
|
62 |
%package javadoc |
63 |
Summary: API documentation for %{name} |
64 |
Group: Documentation |
65 |
Requires: jpackage-utils |
66 |
|
67 |
%description javadoc |
68 |
%{summary}. |
69 |
|
70 |
%prep |
71 |
%setup -q -n %{short_name}-%{version}-%{revision} |
72 |
%patch0 -p1 |
73 |
%patch1 -p1 |
74 |
%patch2 -p1 |
75 |
|
76 |
# remove bundled libraries |
77 |
find . -name '*.class' -delete |
78 |
find . -name '*.bar' -delete |
79 |
# we'll repack munge.jar so don't delete it just yet |
80 |
find . -name '*.jar' -not -name 'munge.jar' -delete |
81 |
|
82 |
# re-create symlinks |
83 |
pushd lib/build |
84 |
build-jar-repository -s -p . aqute-bndlib cglib \ |
85 |
jarjar junit objectweb-asm \ |
86 |
|
87 |
mv aqute-bndlib*.jar bnd-0.0.384.jar |
88 |
mv cglib*.jar cglib-2.2.1-snapshot.jar |
89 |
mv jarjar*.jar jarjar-1.0rc8.jar |
90 |
mv objectweb-asmasm-all.jar asm-3.1.jar |
91 |
|
92 |
popd |
93 |
ln -sf `build-classpath atinject` lib/javax.inject.jar |
94 |
|
95 |
# there is munge.jar defining ant task it's a mixture of files, but |
96 |
# there are sources in jar so we re-compile the jar to verify it |
97 |
# builds |
98 |
mkdir munge-repack |
99 |
unzip lib/build/munge.jar -d munge-repack |
100 |
rm lib/build/munge.jar |
101 |
|
102 |
pushd munge-repack |
103 |
rm *.class |
104 |
javac -cp `build-classpath ant junit` *.java |
105 |
zip -r ../lib/build/munge.jar . |
106 |
popd |
107 |
|
108 |
rm -rf munge-repack |
109 |
#end munge.jar repack |
110 |
|
111 |
%build |
112 |
# create no-aop build environment |
113 |
ant no_aop |
114 |
|
115 |
pushd build/no_aop/ |
116 |
# javadoc fails without this directory |
117 |
mkdir -p servlet/lib/build |
118 |
|
119 |
ant -Dversion=%{version} jar javadoc |
120 |
popd |
121 |
|
122 |
%install |
123 |
rm -rf $RPM_BUILD_ROOT |
124 |
|
125 |
install -d -m 0755 $RPM_BUILD_ROOT%{_javadir} |
126 |
pushd build/no_aop |
127 |
install -pm 644 build/dist/%{short_name}-%{version}.jar $RPM_BUILD_ROOT%{_javadir}/%{name}-%{version}.jar |
128 |
(cd $RPM_BUILD_ROOT%{_javadir} && for jar in *-%{version}*; do ln -sf ${jar} `echo $jar| sed "s|google-||g"`; done) |
129 |
(cd $RPM_BUILD_ROOT%{_javadir} && for jar in *-%{version}*; do ln -sf ${jar} `echo $jar| sed "s|-%{version}||g"`; done) |
130 |
|
131 |
install -d -m 755 $RPM_BUILD_ROOT%{_mavenpomdir} |
132 |
install -pm 644 %{short_name}-parent/pom.xml $RPM_BUILD_ROOT/%{_mavenpomdir}/JPP-%{short_name}-parent.pom |
133 |
|
134 |
install -pm 644 pom.xml $RPM_BUILD_ROOT/%{_mavenpomdir}/JPP-%{name}.pom |
135 |
%add_to_maven_depmap com.google.inject %{short_name} %{version} JPP %{name} |
136 |
# provide sisu group/artifact (should be just mavenized google-guice |
137 |
# with |
138 |
%add_to_maven_depmap org.sonatype.sisu sisu-%{short_name} %{version} JPP %{name} |
139 |
|
140 |
|
141 |
# javadoc |
142 |
install -d -m 0755 $RPM_BUILD_ROOT%{_javadocdir}/%{name}-%{version} |
143 |
cp -pr build/javadoc/* %{buildroot}%{_javadocdir}/%{name}-%{version}/ |
144 |
ln -s %{name}-%{version} %{buildroot}%{_javadocdir}/%{name} |
145 |
|
146 |
|
147 |
|
148 |
%clean |
149 |
rm -rf $RPM_BUILD_ROOT |
150 |
|
151 |
%post |
152 |
%update_maven_depmap |
153 |
|
154 |
%postun |
155 |
%update_maven_depmap |
156 |
|
157 |
|
158 |
%files |
159 |
%defattr(-,root,root,-) |
160 |
%doc COPYING |
161 |
%{_javadir}/*.jar |
162 |
%{_mavenpomdir}/* |
163 |
%{_mavendepmapfragdir}/* |
164 |
|
165 |
|
166 |
%files javadoc |
167 |
%defattr(-,root,root,-) |
168 |
%doc COPYING |
169 |
%doc %{_javadocdir}/%{name}* |
170 |
|
171 |
|
172 |
|