File cobertura.spec of Package cobertura

# spec file for package cobertura (Version 1.9.3)
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2000-2009, JPackage Project
# All rights reserved.
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via

%define with()          %{expand:%%{?with_%{1}:1}%%{!?with_%{1}:0}}
%define without()       %{expand:%%{?with_%{1}:0}%%{!?with_%{1}:1}}
%define bcond_with()    %{expand:%%{?_with_%{1}:%%global with_%{1} 1}}
%define bcond_without() %{expand:%%{!?_without_%{1}:%%global with_%{1} 1}}

%bcond_with gcj_support

%define section free

Name:           cobertura
Version:        1.9.3
Release:        1

Summary:        Free Java tool that calculates the percentage of code accessed by tests
Group:          Development/Libraries/Java
License:        GPLv2+
Source1:        %{name}-%{version}.pom
Source2:        %{name}-runtime-%{version}.pom
Requires(post): jpackage-utils >= 1.7.3
Requires(postun): jpackage-utils >= 1.7.3
Requires:       ant >= 1.6.5
Requires:       java >= 1.5.0
Requires:       jpackage-utils >= 1.7.3
Requires:       jakarta-oro
Requires:       junit
Requires:       log4j
Requires:       objectweb-asm >= 3.0
%if 0
Requires:       servlet_2_5_api
BuildRequires:  ant >= 1.6.5
BuildRequires:  ant-junit
BuildRequires:  ant-trax
BuildRequires:  jpackage-utils >= 1.7.3
BuildRequires:  java-devel >= 1.5.0
BuildRequires:  jakarta-oro
#BuildRequires:  groovy15
BuildRequires:  jaxen
BuildRequires:  jdom
BuildRequires:  junit
BuildRequires:  log4j
BuildRequires:  objectweb-asm >= 3.0
BuildRequires:  servlet_2_5_api
BuildRequires:  fdupes
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

Cobertura is a free Java tool that calculates the percentage of code 
accessed by tests. It can be used to identify which parts of your 
Java program are lacking test coverage. It is based on jcoverage.


    * Can be executed from ant or from the command line.
    * Instruments Java bytecode after it has been compiled.
    * Can generate reports in HTML or XML.
    * Shows percent of lines coveraged and branches coveraged for each
      class, package, and for the overall project.
    * Shows the McCabe cyclomatic code complexity of each class, and
      the average cyclomatic code complexity for each package, and for
      the overall product.
    * Can sort HTML results by class name, percent of lines covered,
      percent of branches covered, etc. And can sort in ascending or
      decending order.

%package javadoc
License:        GPLv2+
Summary:        Javadoc for %{name}
Group:          Documentation/HTML

%description    javadoc
Javadoc for %{name}.

%setup -q
%{_bindir}/find . -type f -name '*.jar' | %{_bindir}/xargs -t %{__rm}
%{__perl} -pi -e 's/\r$//g' ChangeLog COPYING COPYRIGHT README

pushd antLibrary/common
# FIXME: taskdef A class needed by class org.codehaus.groovy.ant.Groovyc cannot be found: groovyjarjarcommonscli/ParseException
#%{__ln_s} $(build-classpath groovy15-all) groovy

pushd lib
%{__ln_s} $(build-classpath jakarta-oro)
%{__ln_s} $(build-classpath junit)
%{__ln_s} $(build-classpath log4j)
%{__ln_s} $(build-classpath objectweb-asm/asm)
%{__ln_s} $(build-classpath objectweb-asm/asm-tree)
%{__ln_s} $(build-classpath servlet_2_5_api) servlet-api.jar

export CLASSPATH=$(build-classpath ant)
export OPT_JAR_LIST=:
#export OPT_JAR_LIST=`%{__cat} %{_sysconfdir}/ant.d/{junit,trax}`
%{ant} -Djetty.dir=. clean compile jar javadoc


# jar
%{__mkdir_p} %{buildroot}%{_javadir}
%{__cp} -p %{name}.jar %{buildroot}%{_javadir}/%{name}-%{version}.jar
(cd %{buildroot}%{_javadir} && for jar in *-%{version}*; do \
%{__ln_s} ${jar} ${jar/-%{version}/}; done)
%add_to_maven_depmap cobertura cobertura %{version} JPP %{name}
%add_to_maven_depmap cobertura cobertura-runtime %{version} JPP %{name}
%add_to_maven_depmap net.sourceforge.cobertura cobertura %{version} JPP %{name}
%add_to_maven_depmap net.sourceforge.cobertura cobertura-runtime %{version} JPP %{name}

# pom
%{__mkdir_p} %{buildroot}%{_datadir}/maven2/poms
%{__cp} -p %{SOURCE1} %{buildroot}%{_datadir}/maven2/poms/JPP-%{name}.pom
%{__cp} -p %{SOURCE2} %{buildroot}%{_datadir}/maven2/poms/JPP-%{name}-runtime.pom

%{__mkdir_p}  %{buildroot}%{_sysconfdir}/ant.d
%__cat > %{buildroot}%{_sysconfdir}/ant.d/%{name} << EOF
ant cobertura junit log4j oro xerces-j2

# bin
%{__mkdir_p} %{buildroot}%{_bindir}
%{__install} -p -m 755 %{SOURCE3} %{buildroot}%{_bindir}/%{name}-check
%{__install} -p -m 755 %{SOURCE4} %{buildroot}%{_bindir}/%{name}-instrument
%{__install} -p -m 755 %{SOURCE5} %{buildroot}%{_bindir}/%{name}-merge
%{__install} -p -m 755 %{SOURCE6} %{buildroot}%{_bindir}/%{name}-report

# javadoc
%{__mkdir_p} %{buildroot}%{_javadocdir}/%{name}-%{version}
%{__cp} -pr build/api/* %{buildroot}%{_javadocdir}/%{name}-%{version}
(cd %{buildroot}%{_javadocdir} && %{__ln_s} %{name}-%{version} %{name})
%fdupes -s %{buildroot}/%{_javadocdir}/

%{__rm} -rf %{buildroot}



%attr(0755,root,root) %{_bindir}/%{name}-check
%attr(0755,root,root) %{_bindir}/%{name}-instrument
%attr(0755,root,root) %{_bindir}/%{name}-merge
%attr(0755,root,root) %{_bindir}/%{name}-report
%config(noreplace) %{_sysconfdir}/ant.d/%{name}
%config(noreplace) %{_mavendepmapfragdir}/%{name}

%files javadoc

openSUSE Build Service is sponsored by