Files
grpc-java/grpc-java.spec

567 lines
18 KiB
RPMSpec

#
# spec file for package grpc-java
#
# Copyright (c) 2024 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/
#
%global base_name grpc-java
%global protoc_arch %{_arch}
%ifarch x86_64 %{?x86_64}
%global protoc_arch x86_64
%endif
%ifarch ppc
%global protoc_arch ppc_32
%endif
%ifarch ppc64
%global protoc_arch ppc_64
%endif
%ifarch ppc64le
%global protoc_arch ppcle_64
%endif
%ifarch %{ix86}
%global protoc_arch x86_32
%endif
%ifarch ia64
%global protoc_arch itanium_64
%endif
%ifarch s390
%global protoc_arch s390_32
%endif
%ifarch s390x
%global protoc_arch s390_64
%endif
%ifarch %{arm}
%global protoc_arch arm_32
%endif
%ifarch aarch64 %{arm64}
%global protoc_arch aarch_64
%endif
# 32 bit sparc, optimized for v9
%ifarch sparcv9
%global protoc_arch sparc_32
%endif
# 64 bit sparc
%ifarch sparc64
%global protoc_arch sparc_64
%endif
Name: grpc-java
Version: 1.68.1
Release: 0
Summary: gRPC-Java - An RPC library and framework
License: Apache-2.0
Group: Development/Libraries/Java
URL: https://github.com/grpc
Source0: https://github.com/grpc/%{base_name}/archive/refs/tags/v%{version}.tar.gz
Source100: aggregator.pom
Source101: https://repo1.maven.org/maven2/io/grpc/grpc-all/%{version}/grpc-all-%{version}.pom
Source102: https://repo1.maven.org/maven2/io/grpc/grpc-alts/%{version}/grpc-alts-%{version}.pom
Source103: https://repo1.maven.org/maven2/io/grpc/grpc-api/%{version}/grpc-api-%{version}.pom
Source104: https://repo1.maven.org/maven2/io/grpc/grpc-auth/%{version}/grpc-auth-%{version}.pom
Source105: https://repo1.maven.org/maven2/io/grpc/grpc-bom/%{version}/grpc-bom-%{version}.pom
Source106: https://repo1.maven.org/maven2/io/grpc/grpc-context/%{version}/grpc-context-%{version}.pom
Source107: https://repo1.maven.org/maven2/io/grpc/grpc-core/%{version}/grpc-core-%{version}.pom
Source108: https://repo1.maven.org/maven2/io/grpc/grpc-grpclb/%{version}/grpc-grpclb-%{version}.pom
Source109: https://repo1.maven.org/maven2/io/grpc/grpc-inprocess/%{version}/grpc-inprocess-%{version}.pom
Source110: https://repo1.maven.org/maven2/io/grpc/grpc-netty-shaded/%{version}/grpc-netty-shaded-%{version}.pom
Source111: https://repo1.maven.org/maven2/io/grpc/grpc-netty/%{version}/grpc-netty-%{version}.pom
Source112: https://repo1.maven.org/maven2/io/grpc/grpc-okhttp/%{version}/grpc-okhttp-%{version}.pom
Source113: https://repo1.maven.org/maven2/io/grpc/grpc-protobuf-lite/%{version}/grpc-protobuf-lite-%{version}.pom
Source114: https://repo1.maven.org/maven2/io/grpc/grpc-protobuf/%{version}/grpc-protobuf-%{version}.pom
Source115: https://repo1.maven.org/maven2/io/grpc/grpc-rls/%{version}/grpc-rls-%{version}.pom
Source116: https://repo1.maven.org/maven2/io/grpc/grpc-services/%{version}/grpc-services-%{version}.pom
Source117: https://repo1.maven.org/maven2/io/grpc/grpc-servlet-jakarta/%{version}/grpc-servlet-jakarta-%{version}.pom
Source118: https://repo1.maven.org/maven2/io/grpc/grpc-servlet/%{version}/grpc-servlet-%{version}.pom
Source119: https://repo1.maven.org/maven2/io/grpc/grpc-stub/%{version}/grpc-stub-%{version}.pom
Source120: https://repo1.maven.org/maven2/io/grpc/grpc-testing/%{version}/grpc-testing-%{version}.pom
Source121: https://repo1.maven.org/maven2/io/grpc/grpc-util/%{version}/grpc-util-%{version}.pom
Source122: https://repo1.maven.org/maven2/io/grpc/grpc-xds/%{version}/grpc-xds-%{version}.pom
BuildRequires: %{base_name}-protoc-gen
BuildRequires: fdupes
BuildRequires: jurand
BuildRequires: maven-local
BuildRequires: protobuf-devel
BuildRequires: mvn(com.github.fridrich:netty-resource-transformers)
BuildRequires: mvn(com.google.api.grpc:proto-google-common-protos)
BuildRequires: mvn(com.google.auto.value:auto-value)
BuildRequires: mvn(com.google.auto.value:auto-value-annotations)
BuildRequires: mvn(com.google.code.findbugs:jsr305)
BuildRequires: mvn(com.google.code.gson:gson)
BuildRequires: mvn(com.google.errorprone:error_prone_annotations)
BuildRequires: mvn(com.google.guava:guava)
BuildRequires: mvn(com.google.protobuf:protobuf-java)
BuildRequires: mvn(com.google.protobuf:protobuf-java-util)
BuildRequires: mvn(com.google.protobuf:protobuf-javalite)
BuildRequires: mvn(io.netty:netty-codec-http2)
BuildRequires: mvn(io.netty:netty-handler-proxy)
BuildRequires: mvn(io.netty:netty-tcnative::linux-%{protoc_arch}:)
BuildRequires: mvn(io.netty:netty-transport-native-unix-common)
BuildRequires: mvn(io.perfmark:perfmark-api)
BuildRequires: mvn(jakarta.servlet:jakarta.servlet-api)
BuildRequires: mvn(javax.servlet:javax.servlet-api) >= 4.0.0
BuildRequires: mvn(org.apache.maven.plugins:maven-shade-plugin)
BuildRequires: mvn(org.conscrypt:conscrypt-openjdk-uber)
%description
A high performance, open source universal RPC framework.
%package all
Summary: gRPC: All
Group: Development/Libraries/Java
BuildArch: noarch
%description all
A high performance, open source universal RPC framework.
This package contains the artifact io.grpc:grpc-all.
%package alts
Summary: gRPC: ALTS
Group: Development/Libraries/Java
BuildArch: noarch
%description alts
A high performance, open source universal RPC framework.
This package contains the artifact io.grpc:grpc-alts.
%package api
Summary: gRPC: API
Group: Development/Libraries/Java
BuildArch: noarch
%description api
A high performance, open source universal RPC framework.
This package contains the artifact io.grpc:grpc-api.
%package auth
Summary: gRPC: Auth
Group: Development/Libraries/Java
BuildArch: noarch
%description auth
A high performance, open source universal RPC framework.
This package contains the artifact io.grpc:grpc-auth.
%package bom
Summary: gRPC: BOM
Group: Development/Libraries/Java
BuildArch: noarch
%description bom
A high performance, open source universal RPC framework.
This package contains the artifact io.grpc:grpc-bom.
%package context
Summary: gRPC: Context
Group: Development/Libraries/Java
BuildArch: noarch
%description context
A high performance, open source universal RPC framework.
This package contains the artifact io.grpc:grpc-context.
%package core
Summary: gRPC: Core
Group: Development/Libraries/Java
BuildArch: noarch
%description core
A high performance, open source universal RPC framework.
This package contains the artifact io.grpc:grpc-core.
%package grpclb
Summary: gRPC: GRPCLB LoadBalancer plugin
Group: Development/Libraries/Java
BuildArch: noarch
%description grpclb
A high performance, open source universal RPC framework.
This package contains the artifact io.grpc:grpc-grpclb.
%package inprocess
Summary: gRPC: Inprocess
Group: Development/Libraries/Java
BuildArch: noarch
%description inprocess
A high performance, open source universal RPC framework.
This package contains the artifact io.grpc:grpc-inprocess.
%package netty
Summary: gRPC: Netty
Group: Development/Libraries/Java
BuildArch: noarch
%description netty
A high performance, open source universal RPC framework.
This package contains the artifact io.grpc:grpc-netty.
%package netty-shaded
Summary: gRPC: Netty Shaded
Group: Development/Libraries/Java
%description netty-shaded
A high performance, open source universal RPC framework.
This package contains the artifact io.grpc:grpc-netty-shaded.
%package okhttp
Summary: gRPC: OkHttp
Group: Development/Libraries/Java
BuildArch: noarch
%description okhttp
A high performance, open source universal RPC framework.
This package contains the artifact io.grpc:grpc-okhttp.
%package protobuf
Summary: gRPC: Protobuf
Group: Development/Libraries/Java
BuildArch: noarch
%description protobuf
A high performance, open source universal RPC framework.
This package contains the artifact io.grpc:grpc-protobuf.
%package protobuf-lite
Summary: gRPC: Protobuf Lite
Group: Development/Libraries/Java
BuildArch: noarch
%description protobuf-lite
A high performance, open source universal RPC framework.
This package contains the artifact io.grpc:grpc-protobuf-lite.
%package rls
Summary: gRPC: gRPC: RouteLookupService Loadbalancing plugin
Group: Development/Libraries/Java
BuildArch: noarch
%description rls
A high performance, open source universal RPC framework.
This package contains the artifact io.grpc:grpc-rls.
%package services
Summary: gRPC: Services
Group: Development/Libraries/Java
BuildArch: noarch
%description services
A high performance, open source universal RPC framework.
This package contains the artifact io.grpc:grpc-services.
%package servlet
Summary: gRPC: Servlet
Group: Development/Libraries/Java
BuildArch: noarch
%description servlet
A high performance, open source universal RPC framework.
This package contains the artifact io.grpc:grpc-protobuf-servlet.
%package servlet-jakarta
Summary: gRPC: Jakarta Servlet
Group: Development/Libraries/Java
BuildArch: noarch
%description servlet-jakarta
A high performance, open source universal RPC framework.
This package contains the artifact io.grpc:grpc-servlet-jakarta.
%package stub
Summary: gRPC: Stub
Group: Development/Libraries/Java
BuildArch: noarch
%description stub
A high performance, open source universal RPC framework.
This package contains the artifact io.grpc:grpc-stub.
%package testing
Summary: gRPC: Testing
Group: Development/Libraries/Java
BuildArch: noarch
%description testing
A high performance, open source universal RPC framework.
This package contains the artifact io.grpc:grpc-testing.
%package util
Summary: gRPC: Util
Group: Development/Libraries/Java
BuildArch: noarch
%description util
A high performance, open source universal RPC framework.
This package contains the artifact io.grpc:grpc-util.
%package xds
Summary: gRPC: XDS Plugin
Group: Development/Libraries/Java
BuildArch: noarch
%description xds
A high performance, open source universal RPC framework.
This package contains the artifact io.grpc:grpc-xds.
%package javadoc
Summary: API documentation for %{name}
Group: Documentation/HTML
BuildArch: noarch
%description javadoc
API documentation for %{name}.
%prep
%setup -q
cp %{SOURCE100} pom.xml
cp %{SOURCE101} all/pom.xml
cp %{SOURCE102} alts/pom.xml
cp %{SOURCE103} api/pom.xml
cp %{SOURCE104} auth/pom.xml
cp %{SOURCE105} bom/pom.xml
cp %{SOURCE106} context/pom.xml
cp %{SOURCE107} core/pom.xml
cp %{SOURCE108} grpclb/pom.xml
cp %{SOURCE109} inprocess/pom.xml
cp %{SOURCE110} netty/shaded/pom.xml
cp %{SOURCE111} netty/pom.xml
cp %{SOURCE112} okhttp/pom.xml
cp %{SOURCE113} protobuf-lite/pom.xml
cp %{SOURCE114} protobuf/pom.xml
cp %{SOURCE115} rls/pom.xml
cp %{SOURCE116} services/pom.xml
cp %{SOURCE117} servlet/jakarta/pom.xml
cp %{SOURCE118} servlet/pom.xml
cp %{SOURCE119} stub/pom.xml
cp %{SOURCE120} testing/pom.xml
cp %{SOURCE121} util/pom.xml
cp %{SOURCE122} xds/pom.xml
%pom_xpath_inject pom:project "
<build>
<resources>
<resource>
<directory>src/main/proto</directory>
</resource>
</resources>
</build>" grpclb rls services
#pom_xpath_set "pom:project/pom:artifactId" "grpc-netty-shaded" netty/shaded
%pom_add_plugin "org.apache.maven.plugins:maven-shade-plugin:3.1.1" netty/shaded "
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/maven/io.netty/**</exclude>
<exclude>META-INF/maven/io.grpc/grpc-netty/**</exclude>
</excludes>
</filter>
</filters>
<artifactSet>
<includes>
<include>io.grpc:grpc-netty</include>
<include>io.netty:*</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>io.grpc.netty</pattern>
<shadedPattern>io.grpc.netty.shaded.io.grpc.netty</shadedPattern>
</relocation>
<relocation>
<pattern>io.netty</pattern>
<shadedPattern>io.grpc.netty.shaded.io.netty</shadedPattern>
</relocation>
<relocation>
<pattern>META-INF/native/libnetty</pattern>
<shadedPattern>META-INF/native/libio_grpc_netty_shaded_netty</shadedPattern>
</relocation>
<relocation>
<pattern>META-INF/native/netty</pattern>
<shadedPattern>META-INF/native/io_grpc_netty_shaded_netty</shadedPattern>
</relocation>
</relocations>
<transformers>
<transformer implementation=\"org.apache.maven.plugins.shade.resource.ServicesResourceTransformer\"/>
<transformer implementation=\"com.github.fridrich.maven.shade.transformer.NettyResourceTransformer\"/>
<transformer implementation=\"com.github.fridrich.maven.shade.transformer.NettyResourceRenamer\"/>
</transformers>
<shadedArtifactAttached>false</shadedArtifactAttached>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.github.fridrich</groupId>
<artifactId>netty-resource-transformers</artifactId>
<version>0.0.0</version>
</dependency>
</dependencies>"
%pom_add_dep "io.grpc:grpc-netty:1.68.1:runtime" netty/shaded
%pom_add_dep "io.netty:netty-tcnative:2.0.68.Final:runtime:linux-%{protoc_arch}" netty/shaded
%pom_add_dep "org.apache.maven.plugins:maven-shade-plugin:3.1.1:provided" netty/shaded
protoc --java_out grpclb/src/main/java \
grpclb/src/main/proto/grpc/lb/v1/load_balancer.proto
protoc --grpc-java_out grpclb/src/main/java \
grpclb/src/main/proto/grpc/lb/v1/load_balancer.proto
protoc --java_out rls/src/main/java \
rls/src/main/proto/grpc/lookup/v1/rls_config.proto \
rls/src/main/proto/grpc/lookup/v1/rls.proto
protoc --grpc-java_out rls/src/main/java \
rls/src/main/proto/grpc/lookup/v1/rls.proto
protoc --java_out services/src/main/java \
services/src/main/proto/grpc/binlog/v1/binarylog.proto \
services/src/main/proto/grpc/health/v1/health.proto \
services/src/main/proto/grpc/channelz/v1/channelz.proto \
services/src/main/proto/grpc/reflection/v1/reflection.proto \
services/src/main/proto/grpc/reflection/v1alpha/reflection.proto
protoc --grpc-java_out services/src/main/java \
services/src/main/proto/grpc/health/v1/health.proto \
services/src/main/proto/grpc/channelz/v1/channelz.proto \
services/src/main/proto/grpc/reflection/v1/reflection.proto \
services/src/main/proto/grpc/reflection/v1alpha/reflection.proto
# Clone the servlet sources for jakarta. namespace
mkdir -p servlet/jakarta/src/main/java/io/grpc/servlet/jakarta
cp -r servlet/src/main/java/io/grpc/servlet/* servlet/jakarta/src/main/java/io/grpc/servlet/jakarta/
sed -i -e s/javax.servlet/jakarta.servlet/ -e s/io.grpc.servlet/io.grpc.servlet.jakarta/\
$(find servlet/jakarta/src/main/java/io/grpc/servlet/jakarta -name \*.java | sort -u)
%pom_change_dep -r :::runtime :::compile
%pom_remove_dep -r org.codehaus.mojo:animal-sniffer-annotations
%{java_remove_annotations} core -p "org.codehaus.mojo.animal_sniffer"
%{java_remove_annotations} util -p "org.codehaus.mojo.animal_sniffer"
%pom_remove_dep -r com.google.android:annotations
%{java_remove_annotations} core -p "android.annotation"
cp -r api/src/context/* api/src/main/
%pom_add_dep javax.servlet:javax.servlet-api:4.0.1:provided servlet
%pom_add_dep jakarta.servlet:jakarta.servlet-api:6.1.0:provided servlet/jakarta
%pom_add_dep com.google.auto.value:auto-value-annotations:1.11.0:provided rls
%pom_add_dep com.google.auto.value:auto-value:1.11.0:provided rls
%pom_disable_module all # many modules
%pom_remove_dep -rf :grps-all
%pom_disable_module alts # com.google.auth:google-auth-library-oauth2-http auth
%pom_remove_dep -rf :grps-alts
%pom_disable_module auth # com.google.auth:google-auth-library-credentials
%pom_remove_dep -rf :grps-auth
%pom_disable_module okhttp # com.squareup.okio:okio
%pom_remove_dep -rf :grps-okhttp
%pom_disable_module testing # opencensus
%pom_remove_dep -rf :grps-testing
%pom_disable_module xds # com.google.re2j:re2j auth alts
%pom_remove_dep -rf :grps-xds
%{mvn_file} :grpc-{*} %{base_name}/@1
%{mvn_package} :aggregator __noinstall
%{mvn_package} :grpc-{*} @1
%build
%{mvn_build} -f -- -Dmaven.compiler.release=8
%install
%mvn_install
%fdupes -s %{buildroot}%{_javadocdir}
#files all -f .mfiles-all
#license LICENSE what
#doc README.md
#files alts -f .mfiles-alts
%files api -f .mfiles-api
#files auth -f .mfiles-auth
%files bom -f .mfiles-bom
%files context -f .mfiles-context
%files core -f .mfiles-core
%files grpclb -f .mfiles-grpclb
%files inprocess -f .mfiles-inprocess
%files netty -f .mfiles-netty
%files netty-shaded -f .mfiles-netty-shaded
#files okhttp -f .mfiles-okhttp
%files protobuf -f .mfiles-protobuf
%files protobuf-lite -f .mfiles-protobuf-lite
%files rls -f .mfiles-rls
%files services -f .mfiles-services
%files servlet -f .mfiles-servlet
%files servlet-jakarta -f .mfiles-servlet-jakarta
%files stub -f .mfiles-stub
#files testing -f .mfiles-testing
%files util -f .mfiles-util
#files xds -f .mfiles-xds
%files javadoc -f .mfiles-javadoc
%license LICENSE
%changelog