File opentest4j.spec of Package opentest4j.28016

#
# spec file for package opentest4j
#
# Copyright (c) 2022 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


%bcond_with tests
Name:           opentest4j
Version:        1.2.0
Release:        0
Summary:        Open Test Alliance for the JVM
License:        Apache-2.0
Group:          Development/Libraries/Java
URL:            https://github.com/ota4j-team/opentest4j
Source0:        https://github.com/ota4j-team/opentest4j/archive/r%{version}.tar.gz
Source1:        %{name}-build.xml
Source100:      https://repo1.maven.org/maven2/org/opentest4j/opentest4j/%{version}/opentest4j-%{version}.pom
BuildRequires:  ant
BuildRequires:  fdupes
BuildRequires:  java-devel >= 1.8
BuildRequires:  javapackages-local
BuildArch:      noarch
%if %{with tests}
BuildRequires:  ant-junit
%endif

%description
Open Test Alliance for the JVM is a minimal common foundation for
testing libraries on the JVM.  The primary goal of the project is to
enable testing frameworks like JUnit, TestNG, Spock, etc. and
third-party assertion libraries like Hamcrest, AssertJ, etc. to use a
common set of exceptions that IDEs and build tools can support in a
consistent manner across all testing scenarios -- for example, for
consistent handling of failed assertions and failed assumptions as
well as visualization of test execution in IDEs and reports.

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

%description javadoc
API documentation for %{name}.

%prep
%setup -q -n opentest4j-r%{version}
find -name \*.jar -delete

cp %{SOURCE1} build.xml
cp %{SOURCE100} pom.xml

%pom_add_dep junit:junit::test

%pom_xpath_inject pom:project "
  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <artifactId>maven-jar-plugin</artifactId>
          <configuration>
            <archive>
              <manifestEntries>
                <Automatic-Module-Name>org.opentest4j</Automatic-Module-Name>
                <Implementation-Title>opentest4j</Implementation-Title>
                <Implementation-Vendor>opentest4j.org</Implementation-Vendor>
                <Implementation-Version>%{version}</Implementation-Version>
                <Specification-Title>opentest4j</Specification-Title>
                <Specification-Vendor>opentest4j.org</Specification-Vendor>
                <Specification-Version>%{version}</Specification-Version>
                <!-- OSGi metadata required by Eclipse -->
                <Bundle-ManifestVersion>2</Bundle-ManifestVersion>
                <Bundle-SymbolicName>org.opentest4j</Bundle-SymbolicName>
                <Bundle-Version>%{version}</Bundle-Version>
                <Export-Package>org.opentest4j;version=\"%{version}\"</Export-Package>
              </manifestEntries>
            </archive>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>"

%build
%{ant} \
%if %{without tests}
  -Dtest.skip=true \
%endif
  jar javadoc

%install
# jar
install -dm 0755 %{buildroot}%{_javadir}/%{name}
install -pm 0644 target/%{name}-%{version}.jar %{buildroot}%{_javadir}/%{name}/%{name}.jar
# pom
install -dm 0755 %{buildroot}%{_mavenpomdir}/%{name}
install -pm 0644 %{SOURCE100} %{buildroot}%{_mavenpomdir}/%{name}/%{name}.pom
%add_maven_depmap %{name}/%{name}.pom %{name}/%{name}.jar
# javadoc
install -dm 0755 %{buildroot}%{_javadocdir}/%{name}
cp -pr target/site/apidocs/* %{buildroot}%{_javadocdir}/%{name}/
%fdupes -s %{buildroot}%{_javadocdir}

%files -f .mfiles
%license LICENSE
%doc README.md

%files javadoc
%license LICENSE
%{_javadocdir}/%{name}

%changelog
openSUSE Build Service is sponsored by