Accepting request 973254 from Java:packages

Don't use xmvn-tools as to avoid build cycles

OBS-URL: https://build.opensuse.org/request/show/973254
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/google-guice?expand=0&rev=4
This commit is contained in:
Dominique Leuenberger 2022-04-28 21:07:42 +00:00 committed by Git OBS Bridge
commit 8644df02fa
3 changed files with 117 additions and 62 deletions

View File

@ -2,7 +2,7 @@
set -e -x
test $# -eq 1
test ! -d guice
git clone git://github.com/google/guice.git
git clone https://github.com/google/guice.git
cd ./guice
git checkout ${1}
git branch unbundled-${1}

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Wed Apr 27 11:52:34 UTC 2022 - Fridrich Strba <fstrba@suse.com>
- Avoid using xmvn-resolve and xmvn-install in order to avoid
build cycles with new dependencies in dependent packages
- Build only the NO_AOP version of the guice.jar and alias
accordingly so that it provides both
-------------------------------------------------------------------
Thu Jun 10 10:16:03 UTC 2021 - Fridrich Strba <fstrba@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file
#
# Copyright (c) 2021 SUSE LLC
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -32,20 +32,15 @@ Patch1: guice-4.1-disabledextensions.patch
Patch2: guice-4.1-javadoc.patch
Patch3: google-guice-throwingproviderbinder.patch
BuildRequires: ant
BuildRequires: aopalliance
BuildRequires: aqute-bnd
BuildRequires: atinject
BuildRequires: cglib
BuildRequires: fdupes
BuildRequires: glassfish-servlet-api
BuildRequires: guava
BuildRequires: jarjar
BuildRequires: java-devel >= 1.7
BuildRequires: java-devel >= 1.8
BuildRequires: javapackages-local
BuildRequires: objectweb-asm
BuildRequires: slf4j
BuildRequires: xmvn-install
BuildRequires: xmvn-resolve
Requires: mvn(com.google.guava:guava)
Requires: mvn(javax.inject:javax.inject)
BuildArch: noarch
%description
@ -68,6 +63,7 @@ and above. This package provides parent POM for Guice modules.
%package -n %{short_name}-assistedinject
Summary: AssistedInject extension module for Guice
Group: Development/Libraries/Java
Requires: mvn(com.google.inject:guice)
%description -n %{short_name}-assistedinject
Guice is a dependency injection framework for Java 5
@ -76,6 +72,7 @@ and above. This package provides AssistedInject module for Guice.
%package -n %{short_name}-extensions
Summary: Extensions for Guice
Group: Development/Libraries/Java
Requires: mvn(com.google.inject:guice-parent:pom:)
%description -n %{short_name}-extensions
Guice is a dependency injection framework for Java 5
@ -84,6 +81,9 @@ and above. This package provides extensions POM for Guice.
%package -n %{short_name}-grapher
Summary: Grapher extension module for Guice
Group: Development/Libraries/Java
Requires: mvn(com.google.inject.extensions:guice-assistedinject)
Requires: mvn(com.google.inject.extensions:guice-multibindings)
Requires: mvn(com.google.inject:guice)
%description -n %{short_name}-grapher
Guice is a dependency injection framework for Java 5
@ -92,6 +92,7 @@ and above. This package provides Grapher module for Guice.
%package -n %{short_name}-jmx
Summary: JMX extension module for Guice
Group: Development/Libraries/Java
Requires: mvn(com.google.inject:guice)
%description -n %{short_name}-jmx
Guice is a dependency injection framework for Java 5
@ -100,6 +101,7 @@ and above. This package provides JMX module for Guice.
%package -n %{short_name}-jndi
Summary: JNDI extension module for Guice
Group: Development/Libraries/Java
Requires: mvn(com.google.inject:guice)
%description -n %{short_name}-jndi
Guice is a dependency injection framework for Java 5
@ -108,6 +110,7 @@ and above. This package provides JNDI module for Guice.
%package -n %{short_name}-multibindings
Summary: MultiBindings extension module for Guice
Group: Development/Libraries/Java
Requires: mvn(com.google.inject:guice)
%description -n %{short_name}-multibindings
Guice is a dependency injection framework for Java 5
@ -116,6 +119,7 @@ and above. This package provides MultiBindings module for Guice.
%package -n %{short_name}-servlet
Summary: Servlet extension module for Guice
Group: Development/Libraries/Java
Requires: mvn(com.google.inject:guice)
%description -n %{short_name}-servlet
Guice is a dependency injection framework for Java 5
@ -124,6 +128,7 @@ and above. This package provides Servlet module for Guice.
%package -n %{short_name}-testlib
Summary: TestLib extension module for Guice
Group: Development/Libraries/Java
Requires: mvn(com.google.inject:guice)
%description -n %{short_name}-testlib
Guice is a dependency injection framework for Java 5
@ -132,6 +137,7 @@ and above. This package provides TestLib module for Guice.
%package -n %{short_name}-throwingproviders
Summary: ThrowingProviders extension module for Guice
Group: Development/Libraries/Java
Requires: mvn(com.google.inject:guice)
%description -n %{short_name}-throwingproviders
Guice is a dependency injection framework for Java 5
@ -140,6 +146,7 @@ and above. This package provides ThrowingProviders module for Guice.
%package -n %{short_name}-bom
Summary: Bill of Materials for Guice
Group: Development/Libraries/Java
Requires: mvn(com.google.inject:guice-parent:pom:)
%description -n %{short_name}-bom
Guice is a dependency injection framework for Java 5
@ -161,7 +168,6 @@ This package provides %{summary}.
find . -name "*.jar" -and ! -name "munge.jar" -delete
find . -name "*.class" -delete
# We don't have struts2 in Fedora yet.
%pom_disable_module struts2 extensions
# Android-specific extension
%pom_disable_module dagger-adapter extensions
@ -185,8 +191,20 @@ find . -name "*.class" -delete
%pom_remove_dep :guava-testlib extensions
%pom_xpath_remove "pom:dependency[pom:classifier[text()='tests']]" extensions
%pom_change_dep -r -f ::::: :::::
%pom_remove_parent
%pom_set_parent com.google.inject:guice-parent:%{version} jdk8-tests
%pom_remove_parent core
%pom_xpath_inject pom:project "
<groupId>com.google.inject</groupId>
<version>4.1.0</version>" core
for mdl in assistedinject dagger-adapter grapher jmx jndi multibindings persist servlet spring struts2 testlib throwingproviders; do
%pom_remove_parent extensions/${mdl}
%pom_xpath_inject pom:project "
<groupId>com.google.inject.extensions</groupId>
<version>4.1.0</version>" extensions/${mdl}
done
%pom_disable_module persist extensions
%pom_disable_module spring extensions
@ -207,79 +225,108 @@ find . -name "*.class" -delete
%pom_xpath_remove "pom:optional" core
%build
%{mvn_alias} "com.google.inject.extensions:" "org.sonatype.sisu.inject:"
%{mvn_package} :::no_aop: guice
%{mvn_package} :{*} @1
%{mvn_file} ":guice-{*}" %{short_name}/guice-@1
%{mvn_file} ":guice" %{short_name}/%{name} %{name}
%{mvn_alias} ":guice" "org.sonatype.sisu:sisu-guice"
mkdir -p lib/build
mkdir -p extensions/servlet/lib/build
build-jar-repository -s -p lib/build \
guava javax.inject glassfish-servlet-api aopalliance cglib objectweb-asm aqute-bnd jarjar
guava javax.inject glassfish-servlet-api aqute-bnd
%{ant} clean.all no_aop
pushd build/no_aop
%pom_xpath_inject "pom:project" "<classifier>no_aop</classifier>" core
%{ant} -Dversion=%{version} jar
popd
mkdir -p extensions/servlet/lib/build
%pom_remove_dep :aopalliance core
%pom_remove_dep :asm core
%pom_remove_dep :cglib core
%{ant} -Dversion=%{version} dist javadoc
%{mvn_artifact} pom.xml
%{mvn_artifact} bom/pom.xml
%{mvn_artifact} build/no_aop/core/pom.xml build/no_aop/build/guice-%{version}.jar
# a huge hack to force the no_aop classifier to the version 2.3.0 reactor
perl -pi -e 's#<ns0:artifactId>guice</ns0:artifactId>#<ns0:artifactId>guice</ns0:artifactId><ns0:classifier>no_aop</ns0:classifier>#g' .xmvn-reactor
%{mvn_artifact} core/pom.xml build/guice-%{version}.jar
%{mvn_artifact} extensions/pom.xml
%{mvn_artifact} extensions/jmx/pom.xml build/dist/guice-jmx-%{version}.jar
%{mvn_artifact} extensions/assistedinject/pom.xml build/dist/guice-assistedinject-%{version}.jar
%{mvn_artifact} extensions/multibindings/pom.xml build/dist/guice-multibindings-%{version}.jar
%{mvn_artifact} extensions/throwingproviders/pom.xml build/dist/guice-throwingproviders-%{version}.jar
%{mvn_artifact} extensions/servlet/pom.xml build/dist/guice-servlet-%{version}.jar
%{mvn_artifact} extensions/jndi/pom.xml build/dist/guice-jndi-%{version}.jar
%{mvn_artifact} extensions/testlib/pom.xml build/dist/guice-testlib-%{version}.jar
%{mvn_artifact} extensions/grapher/pom.xml build/dist/guice-grapher-%{version}.jar
popd
%install
%mvn_install -J build/docs/javadoc
# jars
install -dm 0755 %{buildroot}%{_javadir}/%{short_name}
install -pm 0644 build/no_aop/build/guice-%{version}.jar %{buildroot}%{_javadir}/%{short_name}/%{name}.jar
# Provide symlinks for all jars that existed, no_aop and aop
ln -sf %{short_name}/%{name}.jar %{buildroot}%{_javadir}/%{name}.jar
ln -sf %{name}.jar %{buildroot}%{_javadir}/%{short_name}/%{name}-no_aop.jar
ln -sf %{short_name}/%{name}.jar %{buildroot}%{_javadir}/%{name}-no_aop.jar
install -pm 0644 build/no_aop/build/dist/guice-jmx-%{version}.jar \
%{buildroot}%{_javadir}/%{short_name}/guice-jmx.jar
install -pm 0644 build/no_aop/build/dist/guice-assistedinject-%{version}.jar \
%{buildroot}%{_javadir}/%{short_name}/guice-assistedinject.jar
install -pm 0644 build/no_aop/build/dist/guice-multibindings-%{version}.jar \
%{buildroot}%{_javadir}/%{short_name}/guice-multibindings.jar
install -pm 0644 build/no_aop/build/dist/guice-throwingproviders-%{version}.jar \
%{buildroot}%{_javadir}/%{short_name}/guice-throwingproviders.jar
install -pm 0644 build/no_aop/build/dist/guice-servlet-%{version}.jar \
%{buildroot}%{_javadir}/%{short_name}/guice-servlet.jar
install -pm 0644 build/no_aop/build/dist/guice-jndi-%{version}.jar \
%{buildroot}%{_javadir}/%{short_name}/guice-jndi.jar
install -pm 0644 build/no_aop/build/dist/guice-testlib-%{version}.jar \
%{buildroot}%{_javadir}/%{short_name}/guice-testlib.jar
install -pm 0644 build/no_aop/build/dist/guice-grapher-%{version}.jar \
%{buildroot}%{_javadir}/%{short_name}/guice-grapher.jar
# poms
install -dm 0755 %{buildroot}%{_mavenpomdir}/%{short_name}
install -pm 0644 build/no_aop/pom.xml %{buildroot}%{_mavenpomdir}/%{short_name}/guice-parent.pom
%add_maven_depmap %{short_name}/guice-parent.pom -f parent
install -pm 0644 build/no_aop/bom/pom.xml %{buildroot}%{_mavenpomdir}/%{short_name}/guice-bom.pom
%add_maven_depmap %{short_name}/guice-bom.pom -f bom
install -pm 0644 build/no_aop/extensions/pom.xml %{buildroot}%{_mavenpomdir}/%{short_name}/extensions-parent.pom
%add_maven_depmap %{short_name}/extensions-parent.pom -a org.sonatype.sisu.inject:extensions-parent -f extensions
install -pm 0644 build/no_aop/core/pom.xml %{buildroot}%{_mavenpomdir}/%{short_name}/%{name}.pom
%add_maven_depmap %{short_name}/%{name}.pom %{short_name}/%{name}.jar -a "org.sonatype.sisu:sisu-guice,com.google.inject:guice::no_aop:,org.sonatype.sisu:sisu-guice::no_aop:"
install -pm 0644 build/no_aop/extensions/jmx/pom.xml %{buildroot}%{_mavenpomdir}/%{short_name}/guice-jmx.pom
%add_maven_depmap %{short_name}/guice-jmx.pom %{short_name}/guice-jmx.jar -a org.sonatype.sisu.inject:guice-jmx -f jmx
install -pm 0644 build/no_aop/extensions/assistedinject/pom.xml %{buildroot}%{_mavenpomdir}/%{short_name}/guice-assistedinject.pom
%add_maven_depmap %{short_name}/guice-assistedinject.pom %{short_name}/guice-assistedinject.jar -a org.sonatype.sisu.inject:guice-assistedinject -f assistedinject
install -pm 0644 build/no_aop/extensions/multibindings/pom.xml %{buildroot}%{_mavenpomdir}/%{short_name}/guice-multibindings.pom
%add_maven_depmap %{short_name}/guice-multibindings.pom %{short_name}/guice-multibindings.jar -a org.sonatype.sisu.inject:guice-multibindings -f multibindings
install -pm 0644 build/no_aop/extensions/throwingproviders/pom.xml %{buildroot}%{_mavenpomdir}/%{short_name}/guice-throwingproviders.pom
%add_maven_depmap %{short_name}/guice-throwingproviders.pom %{short_name}/guice-throwingproviders.jar -a org.sonatype.sisu.inject:guice-throwingproviders -f throwingproviders
install -pm 0644 build/no_aop/extensions/servlet/pom.xml %{buildroot}%{_mavenpomdir}/%{short_name}/guice-servlet.pom
%add_maven_depmap %{short_name}/guice-servlet.pom %{short_name}/guice-servlet.jar -a org.sonatype.sisu.inject:guice-servlet -f servlet
install -pm 0644 build/no_aop/extensions/jndi/pom.xml %{buildroot}%{_mavenpomdir}/%{short_name}/guice-jndi.pom
%add_maven_depmap %{short_name}/guice-jndi.pom %{short_name}/guice-jndi.jar -a org.sonatype.sisu.inject:guice-jndi -f jndi
install -pm 0644 build/no_aop/extensions/testlib/pom.xml %{buildroot}%{_mavenpomdir}/%{short_name}/guice-testlib.pom
%add_maven_depmap %{short_name}/guice-testlib.pom %{short_name}/guice-testlib.jar -a org.sonatype.sisu.inject:guice-testlib -f testlib
install -pm 0644 build/no_aop/extensions/grapher/pom.xml %{buildroot}%{_mavenpomdir}/%{short_name}/guice-grapher.pom
%add_maven_depmap %{short_name}/guice-grapher.pom %{short_name}/guice-grapher.jar -a org.sonatype.sisu.inject:guice-grapher -f grapher
# javadoc
install -dm 0755 %{buildroot}%{_javadocdir}/%{name}
cp -pr build/no_aop/build/docs/javadoc/* %{buildroot}%{_javadocdir}/%{name}/
%fdupes -s %{buildroot}%{_javadocdir}
%files -f .mfiles-guice
%files -f .mfiles
%dir %{_javadir}/%{short_name}
%{_javadir}/%{name}*.jar
%{_javadir}/%{short_name}/*-no_aop.jar
%files -n %{short_name}-parent -f .mfiles-guice-parent
%files -n %{short_name}-parent -f .mfiles-parent
%license COPYING
%files -n %{short_name}-assistedinject -f .mfiles-guice-assistedinject
%files -n %{short_name}-assistedinject -f .mfiles-assistedinject
%files -n %{short_name}-extensions -f .mfiles-extensions-parent
%files -n %{short_name}-extensions -f .mfiles-extensions
%files -n %{short_name}-grapher -f .mfiles-guice-grapher
%files -n %{short_name}-grapher -f .mfiles-grapher
%files -n %{short_name}-jmx -f .mfiles-guice-jmx
%files -n %{short_name}-jmx -f .mfiles-jmx
%files -n %{short_name}-jndi -f .mfiles-guice-jndi
%files -n %{short_name}-jndi -f .mfiles-jndi
%files -n %{short_name}-multibindings -f .mfiles-guice-multibindings
%if %{with jpa}
%files -n %{short_name}-persist -f .mfiles-guice-persist
%endif
%files -n %{short_name}-multibindings -f .mfiles-multibindings
%files -n %{short_name}-servlet -f .mfiles-guice-servlet
%if %{with spring}
%files -n %{short_name}-spring -f .mfiles-guice-spring
%endif
%files -n %{short_name}-servlet -f .mfiles-servlet
%files -n %{short_name}-testlib -f .mfiles-guice-testlib
%files -n %{short_name}-testlib -f .mfiles-testlib
%files -n %{short_name}-throwingproviders -f .mfiles-guice-throwingproviders
%files -n %{short_name}-throwingproviders -f .mfiles-throwingproviders
%files -n %{short_name}-bom -f .mfiles-guice-bom
%files -n %{short_name}-bom -f .mfiles-bom
%files javadoc -f .mfiles-javadoc
%files javadoc
%{_javadocdir}/%{name}
%license COPYING
%changelog