From 453ed94abe9afbb8f9b3bc47c3aeac55b7804ee4 Mon Sep 17 00:00:00 2001 From: Mat Booth Date: Dec 09 2018 21:25:36 +0000 Subject: Add jp_minimal condition build functionality --- diff --git a/glassfish-hk2.spec b/glassfish-hk2.spec index 5df582c..0b81cfd 100644 --- a/glassfish-hk2.spec +++ b/glassfish-hk2.spec @@ -1,9 +1,12 @@ +# Set this flag to build with reduced dependency set +%bcond_with jp_minimal + %global namedreltag %nil %global namedversion %{version}%{?namedreltag} Name: glassfish-hk2 Version: 2.4.0 -Release: 10%{?dist} +Release: 11%{?dist} Summary: Hundred Kilobytes Kernel License: CDDL or GPLv2 with exceptions URL: http://hk2.java.net/ @@ -18,46 +21,44 @@ Source2: hk2-inhabitant-generator-osgi.bundle # fixes invalid whitespace in hk2-core osgi metadata Patch0: glassfish-hk2-2.3.0-hk2-utils-osgi_bundle.patch -BuildRequires: maven-local -BuildRequires: mvn(aopalliance:aopalliance) -BuildRequires: mvn(args4j:args4j) -BuildRequires: mvn(com.google.inject:guice) -BuildRequires: mvn(com.sun.codemodel:codemodel) -BuildRequires: mvn(javax.el:javax.el-api) -BuildRequires: mvn(javax.enterprise:cdi-api) -BuildRequires: mvn(javax.inject:javax.inject) -BuildRequires: mvn(junit:junit) -BuildRequires: mvn(net.java:jvnet-parent:pom:) -BuildRequires: mvn(org.apache.ant:ant) -BuildRequires: mvn(org.apache.ant:ant-launcher) -BuildRequires: mvn(org.apache.bcel:bcel) -BuildRequires: mvn(org.apache.felix:maven-bundle-plugin) -BuildRequires: mvn(org.apache.felix:org.apache.felix.bundlerepository) -BuildRequires: mvn(org.apache.felix:org.osgi.core) -BuildRequires: mvn(org.apache.maven:maven-archiver) -BuildRequires: mvn(org.apache.maven:maven-artifact) -BuildRequires: mvn(org.apache.maven:maven-compat) -BuildRequires: mvn(org.apache.maven:maven-core) -BuildRequires: mvn(org.apache.maven:maven-plugin-api) -BuildRequires: mvn(org.apache.maven.plugins:maven-antrun-plugin) -BuildRequires: mvn(org.apache.maven.plugins:maven-compiler-plugin) -BuildRequires: mvn(org.apache.maven.plugins:maven-enforcer-plugin) -BuildRequires: mvn(org.apache.maven.plugins:maven-plugin-plugin) -BuildRequires: mvn(org.apache.maven.shared:maven-osgi) -BuildRequires: mvn(org.easymock:easymock) -BuildRequires: mvn(org.hibernate:hibernate-validator) -BuildRequires: mvn(org.javassist:javassist) -BuildRequires: mvn(org.jvnet:tiger-types) -BuildRequires: mvn(org.mockito:mockito-core) -BuildRequires: mvn(org.osgi:org.osgi.compendium) -BuildRequires: mvn(org.osgi:org.osgi.core) -BuildRequires: mvn(org.ow2.asm:asm-all) -BuildRequires: mvn(org.springframework:spring-context) -BuildRequires: mvn(org.testng:testng) - -Obsoletes: %{name}-apt - -BuildArch: noarch +BuildRequires: maven-local +BuildRequires: mvn(aopalliance:aopalliance) +BuildRequires: mvn(com.sun:tools) +BuildRequires: mvn(javax.enterprise:cdi-api) +BuildRequires: mvn(javax.inject:javax.inject) +BuildRequires: mvn(junit:junit) +BuildRequires: mvn(net.java:jvnet-parent:pom:) +BuildRequires: mvn(org.apache.ant:ant) +BuildRequires: mvn(org.apache.felix:maven-bundle-plugin) +BuildRequires: mvn(org.apache.maven:maven-archiver) +BuildRequires: mvn(org.apache.maven:maven-artifact) +BuildRequires: mvn(org.apache.maven:maven-compat) +BuildRequires: mvn(org.apache.maven:maven-core) +BuildRequires: mvn(org.apache.maven:maven-plugin-api) +BuildRequires: mvn(org.apache.maven.plugins:maven-antrun-plugin) +BuildRequires: mvn(org.apache.maven.plugins:maven-plugin-plugin) +BuildRequires: mvn(org.apache.maven.shared:maven-osgi) +BuildRequires: mvn(org.assertj:assertj-core) +BuildRequires: mvn(org.easymock:easymock) +BuildRequires: mvn(org.javassist:javassist) +BuildRequires: mvn(org.jvnet:tiger-types) +BuildRequires: mvn(org.mockito:mockito-core) +BuildRequires: mvn(org.osgi:org.osgi.compendium) +BuildRequires: mvn(org.osgi:org.osgi.core) +BuildRequires: mvn(org.ow2.asm:asm-all) +BuildRequires: mvn(org.testng:testng) +%if %{without jp_minimal} +BuildRequires: mvn(args4j:args4j) +BuildRequires: mvn(com.google.inject:guice) +BuildRequires: mvn(com.sun.codemodel:codemodel) +BuildRequires: mvn(javax.el:javax.el-api) +BuildRequires: mvn(org.apache.bcel:bcel) +BuildRequires: mvn(org.apache.felix:org.apache.felix.bundlerepository) +BuildRequires: mvn(org.hibernate:hibernate-validator) +BuildRequires: mvn(org.springframework:spring-context) +%endif + +BuildArch: noarch %description HK2 for Hundred Kilobytes Kernel is an abstraction to @@ -88,6 +89,7 @@ Summary: HK2 core module %description core Hundred Kilobytes Kernel core module. +%if %{without jp_minimal} %package dependency-verifier Summary: HK2 Static Analyser for verifying module dependency @@ -100,6 +102,7 @@ Summary: HK2 Tool to visualize the dependencies %description dependency-visualizer Tool to visualize the dependencies generated by HK2's dependency-verifier. +%endif %package extras Summary: HK2 extras module @@ -107,11 +110,13 @@ Summary: HK2 extras module %description extras Default implementations for HK2 services. +%if %{without jp_minimal} %package guice-bridge Summary: HK2 Guice Bridge %description guice-bridge Hundred Kilobytes Kernel Guice Bridge. +%endif %package hk2 Summary: HK2 module of HK2 itself @@ -176,11 +181,13 @@ Summary: HK2 Metadata Generator %description metadata-generator HK2 Metadata Generator Subsystem. +%if %{without jp_minimal} %package osgi Summary: HK2 OSGi Adapter %description osgi HK2 Maven plugin for developing. +%endif %package osgi-resource-locator Summary: HK2 OSGi resource locator bundle @@ -198,11 +205,13 @@ Summary: HK2 Run Level Service %description runlevel Hundred Kilobytes Kernel Run Level Service. +%if %{without jp_minimal} %package spring-bridge Summary: HK2 Spring Bridge %description spring-bridge Hundred Kilobytes Kernel Spring Bridge. +%endif %package runlevel-extras Summary: HK2 RunLevel unit tests @@ -241,6 +250,7 @@ find . -name '*.jar' ! -name "gendir.jar" -type f -print -delete find . -name '*.class' -print -delete %patch0 -p0 + # Use system libraries %pom_change_dep -r org.glassfish.hk2.external:asm-all-repackaged org.ow2.asm:asm-all:'${asm.version}' %pom_change_dep -r org.glassfish.hk2.external:aopalliance-repackaged aopalliance:aopalliance:'${aopalliance.version}' @@ -253,31 +263,65 @@ find ./ -name "*.java" -exec sed -i "s/org.glassfish.hk2.external.org.objectweb. # hk2-api hk2-extras %pom_change_dep -r :osgi-resource-locator ::'${project.version}' -%pom_remove_plugin :maven-resources-plugin -# org.apache.maven.wagon:wagon-webdav-jackrabbit:2.0 -%pom_xpath_remove pom:build/pom:extensions +# Fix deps on org.osgi stuff +%pom_remove_dep org.apache.felix:org.osgi.core +%pom_change_dep org.osgi:osgi_R4_core org.osgi:org.osgi.core . hk2-maven +%pom_change_dep org.apache.felix:org.osgi.core org.osgi:org.osgi.core \ + dependency-verifier osgi/adapter-tests/sdp-management-bundle +%pom_remove_dep org.osgi:org.osgi.enterprise +%pom_change_dep :org.osgi.enterprise org.osgi:org.osgi.compendium:4.2.0 class-model -%pom_remove_plugin com.googlecode.maven-download-plugin:maven-download-plugin -%pom_remove_plugin :maven-site-plugin +# Fix deps on injection APIs +%pom_change_dep org.apache.geronimo.specs:geronimo-atinject_1.0_spec javax.inject:javax.inject . osgi/adapter-tests/osgi-adapter-test + +# Remove plugins not necessary for RPM builds +%pom_xpath_remove pom:build/pom:extensions +%pom_remove_plugin :maven-download-plugin +%pom_remove_plugin :maven-resources-plugin +%pom_remove_plugin :maven-site-plugin . bom %pom_remove_plugin :maven-eclipse-plugin +%pom_remove_plugin :maven-enforcer-plugin . bom %pom_remove_plugin :findbugs-maven-plugin -%pom_remove_plugin -r :jacoco-maven-plugin -%pom_remove_dep -r :jacoco-maven-plugin +%pom_remove_plugin :jacoco-maven-plugin +%pom_remove_dep :jacoco-maven-plugin +# Don't ship re-packaged external deps or examples %pom_disable_module external %pom_disable_module examples -# Use unavailable: org.ops4j.pax.exam, org.ops4j.pax.url + +# Disable modules and tests that require org.ops4j.* +# These are not available in Fedora %pom_disable_module osgi-adapter-test osgi/adapter-tests %pom_remove_dep :osgi-adapter-test bom - %pom_remove_dep org.ops4j.base: %pom_remove_dep org.ops4j.pax.exam: %pom_remove_dep org.ops4j.pax.tipi: %pom_remove_dep org.ops4j.pax.url: -%pom_remove_dep -r org.apache.geronimo.specs:geronimo-atinject_1.0_spec +%if %{with jp_minimal} +# Disable modules with extra deps when jp_minimal is on +%pom_disable_module dependency-verifier +%pom_disable_module dependency-visualizer +%pom_disable_module osgi +%pom_disable_module guice-bridge +%pom_disable_module spring-bridge +%pom_remove_dep :osgi-adapter bom +%pom_remove_dep :guice-bridge bom +%pom_remove_dep :spring-bridge bom +%pom_disable_module hk2-xml-dom hk2-configuration/persistence +%pom_remove_dep org.glassfish.hk2:config-types hk2 bom +%pom_remove_dep org.glassfish.hk2:hk2-config hk2 bom +%endif + +# Remove test dep on org.uncommons:reportng that is not available in Fedora +%pom_remove_dep org.uncommons:reportng . hk2-testing/{hk2-mockito,hk2-runlevel-extras,hk2-testng} +%pom_remove_plugin :maven-surefire-plugin hk2-testing/{hk2-mockito,hk2-runlevel-extras,hk2-testng} + +# Remove pointless unused dependency %pom_remove_dep org.junit:com.springsource.org.junit -%pom_remove_dep org.osgi:osgi_R4_core + +# Remove test that doesn't work on mockito 2.x +rm hk2-testing/hk2-mockito/src/test/java/org/jvnet/testing/hk2mockito/CustomMockSettingsInjectionTest.java # disable tiger-types copy %pom_remove_plugin :maven-dependency-plugin hk2-utils @@ -286,26 +330,14 @@ find ./ -name "*.java" -exec sed -i "s/org.glassfish.hk2.external.org.objectweb. %pom_xpath_remove "pom:plugin[pom:artifactId ='maven-surefire-plugin']/pom:configuration" hk2-api %pom_xpath_remove "pom:plugin[pom:artifactId ='maven-surefire-plugin']/pom:configuration" hk2-locator - -%pom_xpath_set "pom:dependency[pom:groupId ='org.osgi']/pom:artifactId" org.osgi.core hk2-maven - %pom_change_dep -r :maven-project :maven-core %pom_add_dep org.apache.maven:maven-compat hk2-maven -%pom_change_dep :org.osgi.enterprise org.osgi:org.osgi.compendium:4.2.0 class-model - %pom_xpath_set "pom:dependency[pom:groupId ='com.sun']/pom:artifactId" tools hk2-testing/ant %pom_xpath_remove "pom:dependency[pom:groupId ='com.sun']/pom:scope" hk2-testing/ant %pom_xpath_remove "pom:dependency[pom:groupId ='com.sun']/pom:systemPath" hk2-testing/ant %pom_xpath_remove "pom:profiles/pom:profile[pom:id ='mac']" hk2-testing/ant -# Unavailable test dep org.assertj:assertj-core:1.4.0 org.uncommons:reportng:jar:1.1.2 -%pom_remove_dep -r org.assertj:assertj-core -%pom_remove_dep -r org.uncommons:reportng -rm -r hk2-testing/hk2-testng/src/test/java/* -rm -r hk2-testing/hk2-mockito/src/test/java/* -rm -r hk2-testing/hk2-runlevel-extras/src/test/java/* - %pom_change_dep -r ant:ant org.apache.ant:ant %pom_xpath_set "pom:addClasspath" false dependency-verifier @@ -423,6 +455,10 @@ done cp -p %{SOURCE1} LICENSE.txt sed -i 's/\r//' LICENSE.txt +# Don't package unit test jars +%mvn_package ":::tests:" __noinstall + +# Create subpackages %mvn_package ":class-model" class-model %mvn_package ":hk2" hk2 %mvn_package ":hk2-api" api @@ -480,7 +516,6 @@ sed -i 's/\r//' LICENSE.txt %mvn_package ":osgi-resource-locator" osgi-resource-locator %build - %mvn_build -- -Dmaven.test.failure.ignore=true -DsurefireArgLineExtra="-enableassertions" %install @@ -502,18 +537,22 @@ sed -i 's/\r//' LICENSE.txt %files core -f .mfiles-core %license LICENSE.txt +%if %{without jp_minimal} %files dependency-verifier -f .mfiles-dependency-verifier %license LICENSE.txt %files dependency-visualizer -f .mfiles-dependency-visualizer %doc dependency-visualizer/README %license LICENSE.txt +%endif %files extras -f .mfiles-extras %license LICENSE.txt +%if %{without jp_minimal} %files guice-bridge -f .mfiles-guice-bridge %license LICENSE.txt +%endif %files hk2 -f .mfiles-hk2 %license LICENSE.txt @@ -548,8 +587,10 @@ sed -i 's/\r//' LICENSE.txt %files metadata-generator -f .mfiles-metadata-generator %license LICENSE.txt +%if %{without jp_minimal} %files osgi -f .mfiles-osgi %license LICENSE.txt +%endif %files osgi-resource-locator -f .mfiles-osgi-resource-locator %license LICENSE.txt @@ -561,8 +602,10 @@ sed -i 's/\r//' LICENSE.txt %doc hk2-testing/hk2-runlevel-extras/README.txt %license LICENSE.txt +%if %{without jp_minimal} %files spring-bridge -f .mfiles-spring-bridge %license LICENSE.txt +%endif %files testing -f .mfiles-testing %license LICENSE.txt @@ -578,6 +621,9 @@ sed -i 's/\r//' LICENSE.txt %license LICENSE.txt %changelog +* Sun Dec 09 2018 Mat Booth - 2.4.0-11 +- Add jp_minimal condition build functionality + * Fri Jul 13 2018 Fedora Release Engineering - 2.4.0-10 - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild