Name:           ant-contrib
Version:        1.0
Release:        1.33.b3
Summary:        Collection of tasks for Ant
License:        ASL 2.0 and ASL 1.1
URL:            http://ant-contrib.sourceforge.net/
Source0:        https://downloads.sourceforge.net/project/ant-contrib/ant-contrib/1.0b3/ant-contrib-1.0b3-src.tar.bz2
Source1:        http://www.apache.org/licenses/LICENSE-2.0.txt

BuildRequires:  ivy-local junit ant-junit xerces-j2 bcel java-devel apache-ivy jakarta-commons-httpclient
BuildRequires:  apache-commons-logging apache-commons-parent
Requires:       java-headless junit ant xerces-j2
BuildArch:      noarch

%description
A task collection for Apache Ant.

%package        help
Summary:        Documentation for ant-contrib
Requires:       jpackage-utils
Provides:       %{name}-javadoc = %{version}-%{release}
Obsoletes:      %{name}-javadoc < %{version}-%{release}

%description    help
API documentation for ant-contrib.

%prep
%autosetup -n ant-contrib -p1

cp %{SOURCE1} LICENSE-2.0.txt

find -name '*.jar' -or -name '*.class' | xargs rm -rf

sed -i "s|xercesImpl|xerces-j2|g" ivy.xml
rm -fr src/java/net/sf/antcontrib/net/URLImportTask.java

sed -i '/<ivy:configure /d' build.xml
rm -f ivy-conf.xml

sed -i '/<info /s//&revision="1.0b3" /' ivy.xml
%mvn_alias : ant-contrib:

%build
%ant -Divy.mode=local dist

%install
%mvn_artifact ivy.xml target/%{name}.jar
%mvn_install -J target/docs/api

install -d $RPM_BUILD_ROOT%{_sysconfdir}/ant.d
echo "ant-contrib/ant-contrib" > $RPM_BUILD_ROOT%{_sysconfdir}/ant.d/ant-contrib

%files          -f .mfiles
%{_sysconfdir}/ant.d/ant-contrib
%doc target/docs/LICENSE.txt LICENSE-2.0.txt

%files          help -f .mfiles-javadoc
%doc target/docs/manual/tasks/*

%changelog
* Wed Mar 04 2020 lihao <lihao129@huawei.com> - 1.0-1.33.b3
- Package Init
