Introduce build-conditionals for jpa and spring

This commit is contained in:
Mikolaj Izdebski 2017-02-01 11:20:09 +01:00
parent 94b0a87122
commit bc9fdeafac

View File

@ -1,12 +1,11 @@
%if 0%{?fedora} %bcond_without jpa
%bcond_without extensions %bcond_without spring
%endif
%global short_name guice %global short_name guice
Name: google-%{short_name} Name: google-%{short_name}
Version: 4.1 Version: 4.1
Release: 1%{?dist} Release: 2%{?dist}
Summary: Lightweight dependency injection framework for Java 5 and above Summary: Lightweight dependency injection framework for Java 5 and above
License: ASL 2.0 License: ASL 2.0
URL: https://github.com/google/%{short_name} URL: https://github.com/google/%{short_name}
@ -36,8 +35,10 @@ BuildRequires: mvn(org.ow2.asm:asm)
BuildRequires: mvn(org.slf4j:slf4j-api) BuildRequires: mvn(org.slf4j:slf4j-api)
BuildRequires: mvn(org.sonatype.plugins:munge-maven-plugin) BuildRequires: mvn(org.sonatype.plugins:munge-maven-plugin)
%if %{with extensions} %if %{with jpa}
BuildRequires: hibernate-jpa-2.0-api BuildRequires: hibernate-jpa-2.0-api
%endif
%if %{with spring}
BuildRequires: springframework-beans BuildRequires: springframework-beans
%endif %endif
@ -81,8 +82,6 @@ Summary: Guice parent POM
Guice is a lightweight dependency injection framework for Java 5 Guice is a lightweight dependency injection framework for Java 5
and above. This package provides parent POM for Guice modules. and above. This package provides parent POM for Guice modules.
%if %{with extensions}
%package -n %{short_name}-assistedinject %package -n %{short_name}-assistedinject
Summary: AssistedInject extension module for Guice Summary: AssistedInject extension module for Guice
@ -125,12 +124,14 @@ Summary: MultiBindings extension module for Guice
Guice is a lightweight dependency injection framework for Java 5 Guice is a lightweight dependency injection framework for Java 5
and above. This package provides MultiBindings module for Guice. and above. This package provides MultiBindings module for Guice.
%if %{with jpa}
%package -n %{short_name}-persist %package -n %{short_name}-persist
Summary: Persist extension module for Guice Summary: Persist extension module for Guice
%description -n %{short_name}-persist %description -n %{short_name}-persist
Guice is a lightweight dependency injection framework for Java 5 Guice is a lightweight dependency injection framework for Java 5
and above. This package provides Persist module for Guice. and above. This package provides Persist module for Guice.
%endif
%package -n %{short_name}-servlet %package -n %{short_name}-servlet
Summary: Servlet extension module for Guice Summary: Servlet extension module for Guice
@ -139,12 +140,14 @@ Summary: Servlet extension module for Guice
Guice is a lightweight dependency injection framework for Java 5 Guice is a lightweight dependency injection framework for Java 5
and above. This package provides Servlet module for Guice. and above. This package provides Servlet module for Guice.
%if %{with spring}
%package -n %{short_name}-spring %package -n %{short_name}-spring
Summary: Spring extension module for Guice Summary: Spring extension module for Guice
%description -n %{short_name}-spring %description -n %{short_name}-spring
Guice is a lightweight dependency injection framework for Java 5 Guice is a lightweight dependency injection framework for Java 5
and above. This package provides Spring module for Guice. and above. This package provides Spring module for Guice.
%endif
%package -n %{short_name}-testlib %package -n %{short_name}-testlib
Summary: TestLib extension module for Guice Summary: TestLib extension module for Guice
@ -160,8 +163,6 @@ Summary: ThrowingProviders extension module for Guice
Guice is a lightweight dependency injection framework for Java 5 Guice is a lightweight dependency injection framework for Java 5
and above. This package provides ThrowingProviders module for Guice. and above. This package provides ThrowingProviders module for Guice.
%endif # with extensions
%package -n %{short_name}-bom %package -n %{short_name}-bom
Summary: Bill of Materials for Guice Summary: Bill of Materials for Guice
@ -210,17 +211,17 @@ This package provides %{summary}.
%pom_remove_parent %pom_remove_parent
%pom_set_parent com.google.inject:guice-parent:%{version} jdk8-tests %pom_set_parent com.google.inject:guice-parent:%{version} jdk8-tests
# Don't try to build extension modules unless they are needed %if %{without jpa}
%if %{without extensions} %pom_disable_module persist extensions
%pom_disable_module extensions %endif
%if %{without spring}
%pom_disable_module spring extensions
%endif %endif
%pom_disable_module jdk8-tests %pom_disable_module jdk8-tests
%build %build
%if %{with extensions}
%mvn_alias "com.google.inject.extensions:" "org.sonatype.sisu.inject:" %mvn_alias "com.google.inject.extensions:" "org.sonatype.sisu.inject:"
%endif # with extensions
%mvn_package :::no_aop: guice %mvn_package :::no_aop: guice
@ -239,19 +240,21 @@ This package provides %{summary}.
%files -n %{short_name}-parent -f .mfiles-guice-parent %files -n %{short_name}-parent -f .mfiles-guice-parent
%doc COPYING %doc COPYING
%if %{with extensions}
%files -n %{short_name}-assistedinject -f .mfiles-guice-assistedinject %files -n %{short_name}-assistedinject -f .mfiles-guice-assistedinject
%files -n %{short_name}-extensions -f .mfiles-extensions-parent %files -n %{short_name}-extensions -f .mfiles-extensions-parent
%files -n %{short_name}-grapher -f .mfiles-guice-grapher %files -n %{short_name}-grapher -f .mfiles-guice-grapher
%files -n %{short_name}-jmx -f .mfiles-guice-jmx %files -n %{short_name}-jmx -f .mfiles-guice-jmx
%files -n %{short_name}-jndi -f .mfiles-guice-jndi %files -n %{short_name}-jndi -f .mfiles-guice-jndi
%files -n %{short_name}-multibindings -f .mfiles-guice-multibindings %files -n %{short_name}-multibindings -f .mfiles-guice-multibindings
%if %{with jpa}
%files -n %{short_name}-persist -f .mfiles-guice-persist %files -n %{short_name}-persist -f .mfiles-guice-persist
%endif
%files -n %{short_name}-servlet -f .mfiles-guice-servlet %files -n %{short_name}-servlet -f .mfiles-guice-servlet
%if %{with spring}
%files -n %{short_name}-spring -f .mfiles-guice-spring %files -n %{short_name}-spring -f .mfiles-guice-spring
%endif
%files -n %{short_name}-testlib -f .mfiles-guice-testlib %files -n %{short_name}-testlib -f .mfiles-guice-testlib
%files -n %{short_name}-throwingproviders -f .mfiles-guice-throwingproviders %files -n %{short_name}-throwingproviders -f .mfiles-guice-throwingproviders
%endif # with extensions
%files -n %{short_name}-bom -f .mfiles-guice-bom %files -n %{short_name}-bom -f .mfiles-guice-bom
@ -260,6 +263,9 @@ This package provides %{summary}.
%changelog %changelog
* Wed Feb 1 2017 Mikolaj Izdebski <mizdebsk@redhat.com> - 4.1-2
- Introduce build-conditionals for jpa and spring
* Thu Aug 4 2016 Mikolaj Izdebski <mizdebsk@redhat.com> - 4.1-1 * Thu Aug 4 2016 Mikolaj Izdebski <mizdebsk@redhat.com> - 4.1-1
- Update to upstream version 4.1 - Update to upstream version 4.1