File checkstyle.spec of Package checkstyle
#
# spec file for package checkstyle
#
# Copyright (c) 2025 SUSE LLC
# Copyright (c) 2000-2005, JPackage Project
#
# 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/
#
Name: checkstyle
Version: 10.21.2
Release: 0
Summary: Java Code Quality Tool
License: LGPL-2.1-or-later
Group: Development/Libraries/Java
URL: https://%{name}.org/
Source0: https://github.com/%{name}/%{name}/archive/refs/tags/%{name}-%{version}.tar.gz
Source1: %{name}.catalog
Source2: %{name}.pod
Patch0: 00-doxia1.patch
BuildRequires: ant
BuildRequires: fdupes
BuildRequires: maven-local
BuildRequires: mvn(antlr:antlr)
BuildRequires: mvn(apache:commons-logging)
BuildRequires: mvn(com.google.guava:guava)
BuildRequires: mvn(commons-beanutils:commons-beanutils)
BuildRequires: mvn(commons-cli:commons-cli)
BuildRequires: mvn(info.picocli:picocli)
BuildRequires: mvn(javax.xml.bind:jaxb-api)
BuildRequires: mvn(net.sf.saxon:Saxon-HE:12)
BuildRequires: mvn(org.antlr:antlr4-maven-plugin)
BuildRequires: mvn(org.antlr:antlr4-runtime)
BuildRequires: mvn(org.apache.ant:ant)
BuildRequires: mvn(org.apache.ant:ant-nodeps)
BuildRequires: mvn(org.apache.commons:commons-parent:pom:)
BuildRequires: mvn(org.apache.maven.plugins:maven-antrun-plugin)
BuildRequires: mvn(org.apache.maven.plugins:maven-failsafe-plugin)
BuildRequires: mvn(org.checkerframework:checker-qual)
BuildRequires: mvn(org.codehaus.mojo:antlr-maven-plugin)
BuildRequires: mvn(org.codehaus.mojo:build-helper-maven-plugin)
BuildRequires: mvn(org.codehaus.mojo:exec-maven-plugin)
BuildRequires: mvn(org.codehaus.plexus:plexus-component-annotations)
BuildRequires: mvn(org.codehaus.plexus:plexus-component-metadata)
BuildRequires: mvn(org.reflections:reflections)
#BuildConflicts: java >= 13
#BuildConflicts: java-devel >= 13
#BuildConflicts: java-headless >= 13
#!BuildRequires: stringtemplate4
Requires: javapackages-tools
BuildArch: noarch
%description
Checkstyle is a development tool to help programmers write Java code that
adheres to a coding standard. By default it supports the Google Java Style
Guide and Sun Code Conventions, but is highly configurable. It can be invoked
with an ANT task and a command line program.
%package javadoc
Summary: Javadoc for %{name}
Group: Documentation/HTML
%description javadoc
API documentation for %{name}.
%prep
%setup -q -n %{name}-%{name}-%{version}
%patch -P0 -p1
%pom_remove_parent
sed -i s/guava-jdk5/guava/ pom.xml
# not needed for package build
%pom_remove_plugin :maven-eclipse-plugin
%pom_remove_plugin :maven-site-plugin
%pom_remove_plugin :nexus-staging-maven-plugin
%pom_remove_plugin :maven-enforcer-plugin
# these are only needed for upstream QA
#%%pom_remove_plugin :cobertura-maven-plugin
%pom_remove_plugin :maven-linkcheck-plugin
%pom_remove_plugin :maven-pmd-plugin
%pom_remove_plugin :xml-maven-plugin
%pom_remove_plugin :forbiddenapis
%pom_remove_plugin :spotbugs-maven-plugin
%pom_remove_plugin org.jacoco:jacoco-maven-plugin
%pom_remove_plugin :maven-source-plugin
%pom_remove_plugin org.codehaus.mojo:tidy-maven-plugin
%pom_change_dep net.sf.saxon:Saxon-HE net.sf.saxon:Saxon-HE:12
%pom_add_dep javax.xml.bind:jaxb-api
%pom_add_dep org.codehaus.plexus:plexus-component-annotations
%pom_add_dep apache:commons-logging
# The following test needs network access, so it would fail on Koji
sed -i '/testLoadFromURL/s/ *.*/ @org.junit.Ignore&/' \
src/test/java/com/puppycrawl/tools/checkstyle/filters/SuppressionsLoaderTest.java
%{mvn_file} : %{name}
%build
%{mvn_build} -f -- \
-Dproject.build.outputTimestamp=$(date -u -d @${SOURCE_DATE_EPOCH:-$(date +%%s)} +%%Y-%%m-%%dT%%H:%%M:%%SZ)
pod2man --release='%{name} %{version}' --section=1 --center='User Commands' --quotes=none -u %{SOURCE2} %{name}.1
%install
%mvn_install
%fdupes -s %{buildroot}%{_javadocdir}
# Script
%jpackage_script com.puppycrawl.tools.checkstyle.Main "" "" %{name}:antlr:apache-commons-beanutils:apache-commons-cli:apache-commons-logging:apache-commons-collections:guava:picocli %{name} true
# DTDs
install -Dm0644 %{SOURCE1} %{buildroot}%{_datadir}/xml/%{name}/catalog
cp -pa src/main/resources/com/puppycrawl/tools/checkstyle/*.dtd \
%{buildroot}%{_datadir}/xml/%{name}
# Ant stuff
install -dm0755 %{buildroot}%{_sysconfdir}/ant.d
echo checkstyle antlr apache-commons-{beanutils,cli,logging} guava \
> %{buildroot}%{_sysconfdir}/ant.d/%{name}
# Manual page
install -dm0755 %{buildroot}%{_mandir}/man1
install -Dm0644 %{name}.1 %{buildroot}%{_mandir}/man1
%post
# Note that we're using a fully versioned catalog, so this is always ok.
if [ -x %{_bindir}/install-catalog -a -d %{_sysconfdir}/sgml ]; then
%{_bindir}/install-catalog --add \
%{_sysconfdir}/sgml/%{name}-%{version}-%{release}.cat \
%{_datadir}/xml/%{name}/catalog > /dev/null || :
fi
%postun
# Note that we're using a fully versioned catalog, so this is always ok.
if [ -x %{_bindir}/install-catalog -a -d %{_sysconfdir}/sgml ]; then
%{_bindir}/install-catalog --remove \
%{_sysconfdir}/sgml/%{name}-%{version}-%{release}.cat \
%{_datadir}/xml/%{name}/catalog > /dev/null || :
fi
%files -f .mfiles
%license LICENSE
%doc README.md
%{_datadir}/xml/%{name}
%{_bindir}/%{name}
%{_mandir}/man1/*.1%{?ext_man}
%config(noreplace) %{_sysconfdir}/ant.d/%{name}
%files javadoc -f .mfiles-javadoc
%license LICENSE
%changelog