summaryrefslogtreecommitdiff
path: root/dev-java/protobuf-java/protobuf-java-3.20.3.ebuild
diff options
context:
space:
mode:
authorVolkmar W. Pogatzki <gentoo@pogatzki.net>2022-06-24 13:11:13 +0200
committerSam James <sam@gentoo.org>2022-10-25 22:55:00 +0100
commit8d5369b6275cb384c0e8bd6e1efcd3107d110c1f (patch)
treedd51f47f4ea171cc334e1eb556f2aa993da1b285 /dev-java/protobuf-java/protobuf-java-3.20.3.ebuild
parent8929b050d9b094018f94ef597276c01a5626136a (diff)
downloadgentoo-8d5369b6275cb384c0e8bd6e1efcd3107d110c1f.tar.gz
gentoo-8d5369b6275cb384c0e8bd6e1efcd3107d110c1f.tar.bz2
gentoo-8d5369b6275cb384c0e8bd6e1efcd3107d110c1f.zip
dev-java/protobuf-java: add 3.19.6, 3.20.3, 3.21.8 (bug #876903)
* Adding Java team to maintainers since the only known consumer of this package is dev-java/jdbc-mysql which is maintained by Java team. (cherry-picked from PR 26066) * Also respond to CVE-2022-3171 (bug 876903). Bug: https://bugs.gentoo.org/876903 Signed-off-by: Thibaud CANALE <thican@thican.net> Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net> Closes: https://github.com/gentoo/gentoo/pull/26066 Closes: https://github.com/gentoo/gentoo/pull/26888 (cherry picked from commit a119081e17f64f19094278220680e449e01da386) Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'dev-java/protobuf-java/protobuf-java-3.20.3.ebuild')
-rw-r--r--dev-java/protobuf-java/protobuf-java-3.20.3.ebuild102
1 files changed, 102 insertions, 0 deletions
diff --git a/dev-java/protobuf-java/protobuf-java-3.20.3.ebuild b/dev-java/protobuf-java/protobuf-java-3.20.3.ebuild
new file mode 100644
index 000000000000..2e58b824d118
--- /dev/null
+++ b/dev-java/protobuf-java/protobuf-java-3.20.3.ebuild
@@ -0,0 +1,102 @@
+# Copyright 2008-2022 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:${PN}:${PV}"
+# Tests not enabled, depend on com.google.truth which is not packaged
+# https://github.com/protocolbuffers/protobuf/blob/v3.20.3/java/core/pom.xml#L35-L40
+# JAVA_TESTING_FRAMEWORKS="junit-4"
+
+inherit java-pkg-2 java-pkg-simple
+
+PARENT_PN="${PN/-java/}"
+PARENT_PV="${PV}"
+PARENT_P="${PARENT_PN}-${PARENT_PV}"
+
+if [[ "${PV}" == *9999 ]]; then
+ inherit git-r3
+
+ EGIT_REPO_URI="https://github.com/protocolbuffers/protobuf.git"
+ EGIT_SUBMODULES=()
+ EGIT_CHECKOUT_DIR="${WORKDIR}/${PARENT_P}"
+else
+ SRC_URI="
+ https://github.com/protocolbuffers/protobuf/archive/v${PARENT_PV}.tar.gz
+ -> ${PARENT_P}.tar.gz
+ "
+ KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86 ~amd64-linux ~x86-linux ~x64-macos"
+fi
+
+DESCRIPTION="Google's Protocol Buffers - Java bindings"
+HOMEPAGE="
+ https://developers.google.com/protocol-buffers/
+"
+
+LICENSE="BSD"
+SLOT="0/31"
+
+S="${WORKDIR}/${PARENT_P}/java"
+
+BDEPEND="
+ dev-libs/protobuf:${SLOT}
+"
+DEPEND="
+ >=virtual/jdk-1.8:*
+ test? (
+ dev-java/guava:0
+ dev-java/mockito:4
+ )
+"
+RDEPEND="
+ >=virtual/jre-1.8:*
+"
+
+JAVA_AUTOMATIC_MODULE_NAME="com.google.protobuf"
+JAVA_JAR_FILENAME="protobuf.jar"
+JAVA_RESOURCE_DIRS="core/src/main/resources"
+JAVA_SRC_DIR="core/src/main/java"
+
+JAVA_TEST_GENTOO_CLASSPATH="guava,junit-4,mockito-4"
+JAVA_TEST_RESOURCE_DIRS="../src"
+JAVA_TEST_SRC_DIR="core/src/test/java"
+
+# Same than PATCHES but from repository's root directory,
+# please see function `src_prepare` below.
+# Simplier for users IMHO.
+PARENT_PATCHES=(
+)
+
+# Here for patches within "java/" subdirectory.
+PATCHES=(
+)
+
+src_prepare() {
+ pushd "${WORKDIR}/${PARENT_P}" > /dev/null || die
+ [[ -n "${PARENT_PATCHES[@]}" ]] && eapply "${PARENT_PATCHES[@]}"
+ eapply_user
+ popd > /dev/null || die
+
+ # Remove bundled jars
+ java-pkg_clean
+
+ java-pkg-2_src_prepare
+
+ # There is also compiler/plugin, but not in this list because in a subdirectory
+ core_protos=( any api descriptor duration empty field_mask source_context struct timestamp type wrappers )
+
+ # Copy resources from ../src/google/protobuf according to
+ # https://github.com/protocolbuffers/protobuf/blob/v3.20.2/java/core/pom.xml#L45-L61
+ mkdir -p "${JAVA_RESOURCE_DIRS}/google/protobuf/compiler" || die
+ cp "../src/google/protobuf/${core_protos[@]}.proto" \
+ "${JAVA_RESOURCE_DIRS}/google/protobuf" || die
+ cp {../src,"${JAVA_RESOURCE_DIRS}"}/google/protobuf/compiler/plugin.proto || die
+
+ # Generate 146 .java files according to
+ # https://github.com/protocolbuffers/protobuf/blob/v3.20.3/java/core/generate-sources-build.xml
+ for proto in "${core_protos[@]}" compiler/plugin; do
+ "${BROOT}/usr/bin/protoc" \
+ --java_out="${JAVA_SRC_DIR}" -I../src ../src/google/protobuf/"${proto}".proto || die
+ done
+}