summaryrefslogtreecommitdiff
path: root/dev-java/protobuf-java
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-06-28 13:37:56 +0100
committerV3n3RiX <venerix@koprulu.sector>2023-06-28 13:37:56 +0100
commit1919539ec916b166ea3a7b6c5778c40d5bccad70 (patch)
tree8d03694e000aa8e1d2f84456dadbad899b3dbbd6 /dev-java/protobuf-java
parent1a39e197a344b8ec7e3ed6c173bdf2a1ccba5b6b (diff)
gentoo auto-resync : 28:06:2023 - 13:37:56
Diffstat (limited to 'dev-java/protobuf-java')
-rw-r--r--dev-java/protobuf-java/Manifest5
-rw-r--r--dev-java/protobuf-java/files/protobuf-java-3.23.0-unittest_retention.proto.patch35
-rw-r--r--dev-java/protobuf-java/metadata.xml8
-rw-r--r--dev-java/protobuf-java/protobuf-java-3.23.0.ebuild165
4 files changed, 209 insertions, 4 deletions
diff --git a/dev-java/protobuf-java/Manifest b/dev-java/protobuf-java/Manifest
index 6bd30d1d21d1..ee8c9bb0a7fa 100644
--- a/dev-java/protobuf-java/Manifest
+++ b/dev-java/protobuf-java/Manifest
@@ -1,4 +1,7 @@
+AUX protobuf-java-3.23.0-unittest_retention.proto.patch 2122 BLAKE2B b7c7297efaf11291809c46452291419482775e9cca712e000d8a1a604c01fe1bd1df3d076c56154c37ec6d32731a9384bcce1deb23b06dcaa26e0a00b4438160 SHA512 18e9da72f5fca6f1585836c37a3040c43c1db84f617f78ad91d642e9db2811953e30e8a676011ddb5e2c273698527c89487606c0428cfdcbb7c3e7d6d782832f
DIST protobuf-21.12.tar.gz 5141166 BLAKE2B 33500612d103afb817062486a741e8e5503f82c42c70054d47d1899e6bb79f3fdde2666cad5b8eff6e1bc539c3b0cdf9f2b125ce7e5d3a459a69e84d67ab535e SHA512 2dc8f552388438268d8b9f7a9e84c6abf1736be3d5031438c789c317410c9f4b5cedd25bf7da6d67b3ba32ca890869f9ddaab2284d6ac0e734a5b135ffbb1346
+DIST protobuf-23.0.tar.gz 5039837 BLAKE2B 63e02590b03fd9206cdfc4a26edeb2fa55dac902f5365c33c9e9340a722f552e4a5c82d1a0b25b84fcb675d5d06b768fd92cf472743d2361295129ae9faa02f3 SHA512 46c263fab189fdc310c7310d1a3d9e76472e5d96f16228bc4b946d4211afc64188d563ec70250c11a3dd05d18158b72ccf173567bd59aa45310eff62cd5f194d
DIST truth-1.1.3.jar 243021 BLAKE2B a59149038c62ef5dd352b13d4b393e1b7715fbafe5ed86ec2d16d722c738a31dcdca10132fc73b17b367ac4309e5407ba2e489f8d4c8fbca60ce5f35ae75d1e3 SHA512 f29a9fb070aff8a32358a7b6c8998c0095de5d8d68afa7f7bac759c7050309deff929e767657ecbbefd96163460f10255ca01bc567ab30df4834b9d916a4fae8
EBUILD protobuf-java-3.21.12.ebuild 4452 BLAKE2B d18bf0098fa38c538fd4852d4dc585040cbbd56ad17fbd02a18b1a4292008cdcf3307dc580ab5a5f3c95e4bb3e9025377bc524959f59df3ebb94f49c189b40f9 SHA512 5494d4060782c81d04f45f5184ac304ab846fd3fa375d0513d1481b7f99c85ebdaf6219ee170256fe7d7828121d3d44b790b23c9250aa4fc8a093d97a9d4773e
-MISC metadata.xml 625 BLAKE2B 13394b9a2148b9117ce719954591e79088f845ac1ceb667bbdd2645b989daadcfea09525f9dde68c405e3f1cce5cc1af32de9fb4dff629e4745e13fa92727dd7 SHA512 47f693db57dbde04f419ed65494d81b0a800c9ac49d790c9b794baef34fb1f876da29c5a0662c45aa3c01cecd34af648e196fb76110fcc0066198c59543049b3
+EBUILD protobuf-java-3.23.0.ebuild 5007 BLAKE2B fdf28abbd24a0259167abc53a62e7699b69c3a528eebcd50a866baed6517a60f09a237e5500ae2c9b488b3407a4f55abc3fbf35ddfc459535e1e5af3d428837b SHA512 83b1a6da9f7461419e206551a1810fa491ab9b32f6a32a829f3c76a85f52c296b7743be8680f2733a65aff7bef4704489aa7a2e554786ca526146c0ad4666b66
+MISC metadata.xml 777 BLAKE2B 70de12bad5be3c8278834a4a8444c7485470c0f1822ff50f8d44280ac3c1e7150c4428cc417b59e834004cc92574a7016c90acf96728abc0b86c17ac14826df1 SHA512 7addbf4ecf146a11ab301c0e0657ec0572dfa84d4fccdd0bccb3248cab7f09956758041be670f8e22f114292447e3e00c7cd7d251c29e39b2e57eb5dd3a022c5
diff --git a/dev-java/protobuf-java/files/protobuf-java-3.23.0-unittest_retention.proto.patch b/dev-java/protobuf-java/files/protobuf-java-3.23.0-unittest_retention.proto.patch
new file mode 100644
index 000000000000..c838bf3cede2
--- /dev/null
+++ b/dev-java/protobuf-java/files/protobuf-java-3.23.0-unittest_retention.proto.patch
@@ -0,0 +1,35 @@
+java/core/src/test/java/com/google/protobuf/DescriptorsTest.java:68: error: cannot find symbol
+import protobuf_unittest.UnittestRetention;
+ ^
+ symbol: class UnittestRetention
+ location: package protobuf_unittest
+java/core/src/test/java/com/google/protobuf/DescriptorsTest.java:402: error: cannot find symbol
+ FileOptions options = UnittestRetention.getDescriptor().getOptions();
+ ^
+ symbol: variable UnittestRetention
+ location: class DescriptorsTest
+java/core/src/test/java/com/google/protobuf/DescriptorsTest.java:403: error: cannot find symbol
+ assertThat(options.hasExtension(UnittestRetention.plainOption)).isTrue();
+ ^
+ symbol: variable UnittestRetention
+ location: class DescriptorsTest
+java/core/src/test/java/com/google/protobuf/DescriptorsTest.java:404: error: cannot find symbol
+ assertThat(options.hasExtension(UnittestRetention.runtimeRetentionOption)).isTrue();
+ ^
+ symbol: variable UnittestRetention
+ location: class DescriptorsTest
+java/core/src/test/java/com/google/protobuf/DescriptorsTest.java:405: error: cannot find symbol
+ assertThat(options.hasExtension(UnittestRetention.sourceRetentionOption)).isFalse();
+ ^
+ symbol: variable UnittestRetention
+ location: class DescriptorsTest
+--- a/java/core/generate-test-sources-build.xml
++++ b/java/core/generate-test-sources-build.xml
+@@ -19,6 +19,7 @@
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_optimize_for.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_proto3.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_proto3_optional.proto"/>
++ <arg value="${protobuf.source.dir}/google/protobuf/unittest_retention.proto"/>
+ <arg value="${protobuf.source.dir}/google/protobuf/unittest_well_known_types.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/any_test.proto"/>
+ <arg value="${test.proto.dir}/com/google/protobuf/cached_field_size_test.proto"/>
diff --git a/dev-java/protobuf-java/metadata.xml b/dev-java/protobuf-java/metadata.xml
index 5fdb33c1c7c3..20b09444fc60 100644
--- a/dev-java/protobuf-java/metadata.xml
+++ b/dev-java/protobuf-java/metadata.xml
@@ -12,10 +12,12 @@
<maintainer type="project">
<email>java@gentoo.org</email>
</maintainer>
- <slots>
- <subslots>Soname version number of Protobuf</subslots>
- </slots>
<upstream>
+ <bugs-to>https://github.com/protocolbuffers/protobuf/issues</bugs-to>
+ <doc>https://protobuf.dev/getting-started/javatutorial/</doc>
<remote-id type="github">protocolbuffers/protobuf</remote-id>
</upstream>
+ <use>
+ <flag name="system-protoc">Use protoc provided by dev-libs/protobuf</flag>
+ </use>
</pkgmetadata>
diff --git a/dev-java/protobuf-java/protobuf-java-3.23.0.ebuild b/dev-java/protobuf-java/protobuf-java-3.23.0.ebuild
new file mode 100644
index 000000000000..aaf13ce4b65e
--- /dev/null
+++ b/dev-java/protobuf-java/protobuf-java-3.23.0.ebuild
@@ -0,0 +1,165 @@
+# Copyright 2008-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+JAVA_PKG_IUSE="doc source test"
+MAVEN_ID="com.google.protobuf:protobuf-java:3.23.0"
+JAVA_TESTING_FRAMEWORKS="junit-4"
+
+inherit java-pkg-2 java-pkg-simple cmake
+
+DESCRIPTION="Core Protocol Buffers library"
+HOMEPAGE="https://protobuf.dev"
+# Currently we bundle the binary version of truth.jar used only for tests, we don't install it.
+# And we build artifact 3.23.0 from the 23.0 tarball in order to allow sharing the tarball with
+# dev-libs/protobuf.
+SRC_URI="https://github.com/protocolbuffers/protobuf/archive/v${PV#3.}.tar.gz -> protobuf-${PV#3.}.tar.gz
+ test? ( https://repo1.maven.org/maven2/com/google/truth/truth/1.1.3/truth-1.1.3.jar )"
+S="${WORKDIR}/protobuf-${PV#3.}"
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86 ~amd64-linux ~x86-linux ~x64-macos"
+IUSE="system-protoc"
+
+DEPEND="
+ >=virtual/jdk-1.8:*
+ test? (
+ dev-java/guava:0
+ dev-java/mockito:4
+ )
+"
+RDEPEND=">=virtual/jre-1.8:*"
+
+BDEPEND="
+ system-protoc? ( ~dev-libs/protobuf-${PV#3.}:0 )
+ !system-protoc? ( >=dev-cpp/abseil-cpp-20230125.2 )
+"
+
+PATCHES=(
+ "${FILESDIR}/protobuf-java-3.23.0-unittest_retention.proto.patch"
+)
+
+JAVA_AUTOMATIC_MODULE_NAME="com.google.protobuf"
+JAVA_JAR_FILENAME="protobuf.jar"
+JAVA_RESOURCE_DIRS="java/core/src/main/resources"
+JAVA_SRC_DIR="java/core/src/main/java"
+
+JAVA_TEST_GENTOO_CLASSPATH="guava,junit-4,mockito-4"
+JAVA_TEST_SRC_DIR="java/core/src/test/java"
+
+run-protoc() {
+ if use system-protoc; then
+ protoc $1
+ else
+ "${BUILD_DIR}"/protoc $1
+ fi
+}
+
+src_prepare() {
+ # If the corrsponding version of system-protoc is not available we build protoc locally
+ if use system-protoc; then
+ :
+ else
+ cmake_src_prepare
+ fi
+ java-pkg-2_src_prepare
+
+ mkdir "${JAVA_RESOURCE_DIRS}" || die
+ # https://github.com/protocolbuffers/protobuf/blob/v23.0/java/core/pom.xml#L43-L62
+ PROTOS=( $(sed \
+ -n '/google\/protobuf.*\.proto/s:.*<include>\(.*\)</include>:\1:p' \
+ "${S}/java/core/pom.xml") ) || die
+ pushd src > /dev/null || die
+ cp --parents -v "${PROTOS[@]}" ../"${JAVA_RESOURCE_DIRS}" || die
+ popd > /dev/null || die
+
+ # https://github.com/protocolbuffers/protobuf/blob/v23.0/java/core/generate-sources-build.xml
+ einfo "Replace variables in generate-sources-build.xml"
+ sed \
+ -e 's:${generated.sources.dir}:java/core/src/main/java:' \
+ -e 's:${protobuf.source.dir}:src:' \
+ -e 's:^.*value="::' -e 's:\"/>::' \
+ -e '/project\|echo\|mkdir\|exec/d' \
+ -i java/core/generate-sources-build.xml || die "sed to sources failed"
+
+ # https://github.com/protocolbuffers/protobuf/blob/v23.0/java/core/generate-test-sources-build.xml
+ einfo "Replace variables in generate-test-sources-build.xml"
+ sed \
+ -e 's:${generated.testsources.dir}:java/core/src/test/java:' \
+ -e 's:${protobuf.source.dir}:src:' \
+ -e 's:${test.proto.dir}:java/core/src/test/proto:' \
+ -e 's:^.*value="::' -e 's:\"/>::' \
+ -e '/project\|mkdir\|exec\|Also generate/d' \
+ -i java/core/generate-test-sources-build.xml || die "sed to test sources failed"
+
+ # Split the file in two parts, one for each run-protoc call
+ awk '/--java_out/{x="test-sources-build-"++i;}{print > x;}' \
+ java/core/generate-test-sources-build.xml || die
+}
+
+src_configure() {
+ local mycmakeargs=(
+ -Dprotobuf_BUILD_TESTS=OFF
+ -Dprotobuf_ABSL_PROVIDER=package
+ )
+ if use system-protoc; then
+ :
+ else
+ cmake_src_configure
+ fi
+}
+
+src_compile() {
+ if use system-protoc; then
+ :
+ else
+ cmake_src_compile
+ fi
+
+ einfo "Run protoc to generate sources"
+ run-protoc \
+ @java/core/generate-sources-build.xml \
+ || die "protoc sources failed"
+
+ java-pkg-simple_src_compile
+}
+
+src_test() {
+ # https://github.com/protocolbuffers/protobuf/blob/v23.0/java/core/pom.xml#L63-L71
+ jar cvf testdata.jar \
+ -C src google/protobuf/testdata/golden_message_oneof_implemented \
+ -C src google/protobuf/testdata/golden_packed_fields_message || die
+
+ JAVA_GENTOO_CLASSPATH_EXTRA="${DISTDIR}/truth-1.1.3.jar:testdata.jar"
+
+ einfo "Running protoc on first part of generate-test-sources-build.xml"
+ run-protoc @test-sources-build-1 \
+ || die "run-protoc test-sources-build-1 failed"
+
+ einfo "Running protoc on second part of generate-test-sources-build.xml"
+ run-protoc @test-sources-build-2 \
+ || die "run-protoc test-sources-build-2 failed"
+
+ einfo "Running tests"
+ # Invalid test class 'map_test.MapInitializationOrderTest':
+ # 1. Test class should have exactly one public constructor
+ # Invalid test class 'protobuf_unittest.CachedFieldSizeTest':
+ # 1. Test class should have exactly one public constructor
+ pushd "${JAVA_TEST_SRC_DIR}" || die
+ local JAVA_TEST_RUN_ONLY=$(find * \
+ -path "**/*Test.java" \
+ ! -path "**/Abstract*Test.java" \
+ ! -name "MapInitializationOrderTest.java" \
+ ! -path '*protobuf_unittest/CachedFieldSizeTest.java'
+ )
+ popd
+ JAVA_TEST_RUN_ONLY="${JAVA_TEST_RUN_ONLY//.java}"
+ JAVA_TEST_RUN_ONLY="${JAVA_TEST_RUN_ONLY//\//.}"
+ java-pkg-simple_src_test
+}
+
+src_install() {
+ java-pkg-simple_src_install
+}