Name:           aqute-bnd
Version:        3.5.0
Release:        6
Summary:        BND Tool
License:        ASL 2.0
URL:            http://bnd.bndtools.org/
Source0:        %{version}.REL.tar.gz
Source1:        parent.pom
Source2:        https://repo1.maven.org/maven2/biz/aQute/bnd/aQute.libg/%{version}/aQute.libg-%{version}.pom
Source3:        https://repo1.maven.org/maven2/biz/aQute/bnd/biz.aQute.bnd/%{version}/biz.aQute.bnd-%{version}.pom
Source4:        https://repo1.maven.org/maven2/biz/aQute/bnd/biz.aQute.bndlib/%{version}/biz.aQute.bndlib-%{version}.pom
Source5:        https://repo1.maven.org/maven2/biz/aQute/bnd/biz.aQute.bnd.annotation/%{version}/biz.aQute.bnd.annotation-%{version}.pom
Patch0001:      0001-Disable-removed-commands.patch
Patch0002:      0002-Fix-ant-compatibility.patch
BuildRequires:  maven-local mvn(org.osgi:osgi.annotation) mvn(org.osgi:osgi.cmpn) mvn(org.osgi:osgi.core)
BuildRequires:  mvn(org.slf4j:slf4j-api) mvn(org.slf4j:slf4j-simple) mvn(org.apache.ant:ant) mvn(junit:junit)
BuildRequires:  mvn(org.apache.maven:maven-artifact) mvn(org.apache.maven:maven-compat) mvn(org.apache.maven:maven-core)
BuildRequires:  mvn(org.apache.maven:maven-plugin-api) mvn(org.apache.maven.plugins:maven-plugin-plugin)
BuildRequires:  mvn(org.apache.maven.plugins:maven-source-plugin) mvn(org.apache.maven.plugin-tools:maven-plugin-annotations)
BuildRequires:  mvn(org.eclipse.aether:aether-api) mvn(org.sonatype.plexus:plexus-build-api)
Requires:       javapackages-tools
Provides:       aqute-bndlib = %{version}-%{release} bnd-maven-plugin = %{version}-%{release}
Obsoletes:      aqute-bndlib < %{version}-%{release} bnd-maven-plugin < %{version}-%{release}
BuildArch:      noarch

%description
Bnd is the engine behind a number of popular software development tools that support OSGi.
It can be found in several maven plugins, ant, gradle, and of course Eclipse (bndtools).
It actively seeks other build tool vendors to use bnd to improve the quality of the generated
OSGi metadata.

%package        help
Provides:       aqute-bnd-javadoc = %{version}-%{release}
Obsoletes:      aqute-bnd-javadoc < %{version}-%{release}
Summary:        Documentation for aqute-bnd

%description    help
Documentation for aqute-bnd api.

%prep
%autosetup -n bnd-%{version}.REL -p1
rm gradlew*
rm biz.aQute.bnd/src/aQute/bnd/main/{RemoteCommand,ResolveCommand}.java
sed 's/@VERSION@/%{version}/' %SOURCE1 > pom.xml
sed -i 's|${Bundle-Version}|%{version}|' biz.aQute.bndlib/src/aQute/bnd/osgi/bnd.info
cd aQute.libg
cp -p %{SOURCE2} pom.xml
%pom_add_parent biz.aQute.bnd:parent:%{version}
%pom_add_dep org.osgi:osgi.cmpn
%pom_add_dep org.slf4j:slf4j-api
cd -
cd biz.aQute.bnd.annotation
cp -p %{SOURCE5} pom.xml
%pom_add_parent biz.aQute.bnd:parent:%{version}
cd -
cd biz.aQute.bndlib
cp -p %{SOURCE4} pom.xml
%pom_add_parent biz.aQute.bnd:parent:%{version}
%pom_add_dep org.osgi:osgi.annotation
%pom_add_dep org.osgi:osgi.core
%pom_add_dep org.osgi:osgi.cmpn
%pom_add_dep org.slf4j:slf4j-api
%pom_add_dep biz.aQute.bnd:aQute.libg:%{version}
%pom_add_dep biz.aQute.bnd:biz.aQute.bnd.annotation:%{version}
cd -
cd biz.aQute.bnd
cp -p %{SOURCE3} pom.xml
%pom_add_parent biz.aQute.bnd:parent:%{version}
%pom_add_dep biz.aQute.bnd:biz.aQute.bndlib:%{version}
%pom_add_dep biz.aQute.bnd:aQute.libg:%{version}
%pom_add_dep biz.aQute.bnd:biz.aQute.bnd.annotation:%{version}
%pom_add_dep org.apache.ant:ant
%pom_add_dep org.osgi:osgi.annotation
%pom_add_dep org.osgi:osgi.core
%pom_add_dep org.osgi:osgi.cmpn
%pom_add_dep org.slf4j:slf4j-api
%pom_add_dep org.slf4j:slf4j-simple::runtime
cd -
cd maven
rm bnd-shared-maven-lib/src/main/java/aQute/bnd/maven/lib/resolve/DependencyResolver.java
%pom_remove_dep -r :biz.aQute.resolve
%pom_remove_dep -r :biz.aQute.repository
%pom_disable_module bnd-indexer-maven-plugin
%pom_disable_module bnd-export-maven-plugin
%pom_disable_module bnd-resolver-maven-plugin
%pom_disable_module bnd-testing-maven-plugin
%pom_remove_plugin -r :maven-invoker-plugin
%pom_remove_plugin -r :maven-javadoc-plugin
%pom_remove_plugin -r :flatten-maven-plugin
cd -
%mvn_alias biz.aQute.bnd:biz.aQute.bnd :bnd biz.aQute:bnd
%mvn_alias biz.aQute.bnd:biz.aQute.bndlib :bndlib biz.aQute:bndlib
%mvn_package biz.aQute.bnd:biz.aQute.bndlib bndlib
%mvn_package biz.aQute.bnd:biz.aQute.bnd.annotation bndlib
%mvn_package biz.aQute.bnd:aQute.libg bndlib
%mvn_package biz.aQute.bnd:bnd-shared-maven-lib maven
%mvn_package biz.aQute.bnd:bnd-maven-plugin maven
%mvn_package biz.aQute.bnd:bnd-baseline-maven-plugin maven
%mvn_package biz.aQute.bnd:parent __noinstall
%mvn_package biz.aQute.bnd:bnd-plugin-parent __noinstall
%build
%mvn_build -- -Dproject.build.sourceEncoding=UTF-8
%install
%mvn_install
install -d -m 755 %{buildroot}%{_sysconfdir}/ant.d
echo "aqute-bnd slf4j/api slf4j/simple osgi-annotation osgi-core osgi-compendium" >%{buildroot}%{_sysconfdir}/ant.d/aqute-bnd
%jpackage_script aQute.bnd.main.bnd "" "" aqute-bnd:slf4j/slf4j-api:slf4j/slf4j-simple:osgi-annotation:osgi-core:osgi-compendium bnd 1

%files -f .mfiles
%files -f .mfiles-bndlib
%files -f .mfiles-maven
%doc LICENSE
%{_bindir}/bnd
%config(noreplace) %{_sysconfdir}/ant.d/*

%files help -f .mfiles-javadoc

%changelog
* Fri Feb 14 likexin <likexin4@huawei.com> - 3.5.0-6
- Package init
