File auto.spec of Package auto

# spec file for package auto
# Copyright (c) 2020 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

%global auto_ver 1.5.4
%global common_ver 0.10
%global service_ver 1.0-rc4
%global parent_ver 6
Name:           auto
Version:        %{auto_ver}
Release:        0
Summary:        A collection of source code generators for Java
License:        Apache-2.0
Group:          Development/Libraries/Java
BuildRequires:  fdupes
BuildRequires:  java-devel >= 1.8
BuildRequires:  maven-local
BuildRequires:  mvn(com.squareup:javapoet)
BuildArch:      noarch

The Auto sub-projects are a collection of code generators
that automate those types of tasks.

%package common
Summary:        Auto Common Utilities
Group:          Development/Libraries/Java
Obsoletes:      %{name}-factory < %{version}-%{release}

%description common
Common utilities for creating annotation processors.

%package service
Summary:        Provider-configuration files for ServiceLoader
Group:          Development/Libraries/Java

%description service
A configuration/meta-data generator for
java.util.ServiceLoader-style service

%package value
Summary:        Auto Value
Group:          Development/Libraries/Java

%description value
Immutable value-type code generation for Java 1.6+.

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

%description javadoc
This package contains javadoc for %{name}.

%setup -q -n auto-auto-value-%{version} -a1 -a2 -a3
rm -rf pom.xml factory/ common/ service/
mv auto-auto-parent-%{parent_ver}/pom.xml .
mv auto-auto-common-%{common_ver}/common common
mv auto-auto-service-%{service_ver}/service service

# remove unnecessary dependency on parent POM

# Disable factory module due to missing dep:
%pom_disable_module factory build-pom.xml

# Fix deps in service module
%pom_xpath_set "pom:parent/pom:version" 6 service
%pom_change_dep service

%pom_remove_plugin org.apache.maven.plugins:maven-checkstyle-plugin
%pom_remove_plugin :maven-shade-plugin value
%pom_remove_plugin :maven-invoker-plugin value

# Broader guava compatibility
sed -i -e 's/23.5-jre/20.0/' pom.xml
sed -i -e 's/toImmutableMap/toMap/' -e 's/static' \
  -e '/elementValues/s/ImmutableMap/Map/' \
sed -i -e 's/toImmutableSet/toSet/' -e 's/static' \
  -e '/ImmutableSet</s/ImmutableSet/Set/' \

%{mvn_package} :build-only __noinstall

%{mvn_build} -sf -- \
%if %{?pkg_vcmp:%pkg_vcmp java-devel >= 9}%{!?pkg_vcmp:0}
	-Dmaven.compiler.release=8 \
	-f build-pom.xml -Dsource=8 -Dfile.encoding=UTF-8

%fdupes -s %{buildroot}%{_javadocdir}

%files -f .mfiles-%{name}-parent
%dir %{_javadir}/%{name}
%license LICENSE.txt

%files common -f .mfiles-%{name}-common
%doc common/
%license LICENSE.txt

%files service -f .mfiles-%{name}-service
%doc service/
%license LICENSE.txt

%files value -f .mfiles-%{name}-value
%doc value/
%license LICENSE.txt

%files javadoc -f .mfiles-javadoc
%license LICENSE.txt

openSUSE Build Service is sponsored by