4 |
4 |
EAPI=8
|
5 |
5 |
|
6 |
6 |
JAVA_PKG_IUSE="doc source test"
|
7 |
|
MAVEN_ID="com.google.protobuf:protobuf-java:3.23.0"
|
|
7 |
MAVEN_ID="com.google.protobuf:protobuf-java:3.24.2"
|
8 |
8 |
JAVA_TESTING_FRAMEWORKS="junit-4"
|
9 |
9 |
|
10 |
10 |
inherit java-pkg-2 java-pkg-simple cmake
|
... | ... | |
12 |
12 |
DESCRIPTION="Core Protocol Buffers library"
|
13 |
13 |
HOMEPAGE="https://protobuf.dev"
|
14 |
14 |
# Currently we bundle the binary version of truth.jar used only for tests, we don't install it.
|
15 |
|
# And we build artifact 3.23.0 from the 23.0 tarball in order to allow sharing the tarball with
|
|
15 |
# And we build artifact 3.24.0 from the 24.0 tarball in order to allow sharing the tarball with
|
16 |
16 |
# dev-libs/protobuf.
|
17 |
|
SRC_URI="https://github.com/protocolbuffers/protobuf/archive/v${PV#3.}.tar.gz -> protobuf-${PV#3.}.tar.gz
|
|
17 |
MY_PV3="${PV#3.}"
|
|
18 |
MY_PV="${MY_PV3/_rc/-rc}"
|
|
19 |
SRC_URI="https://github.com/protocolbuffers/protobuf/archive/v${MY_PV}.tar.gz -> protobuf-${MY_PV}.tar.gz
|
18 |
20 |
test? ( https://repo1.maven.org/maven2/com/google/truth/truth/1.1.3/truth-1.1.3.jar )"
|
19 |
|
S="${WORKDIR}/protobuf-${PV#3.}"
|
|
21 |
S="${WORKDIR}/protobuf-${MY_PV}"
|
20 |
22 |
|
21 |
23 |
LICENSE="BSD"
|
22 |
24 |
SLOT="0"
|
23 |
|
KEYWORDS="amd64 ~arm ~arm64 ppc64 x86 ~amd64-linux ~x86-linux ~x64-macos"
|
|
25 |
KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86 ~amd64-linux ~x86-linux ~x64-macos"
|
24 |
26 |
IUSE="system-protoc"
|
25 |
27 |
|
26 |
28 |
DEPEND="
|
... | ... | |
33 |
35 |
RDEPEND=">=virtual/jre-1.8:*"
|
34 |
36 |
|
35 |
37 |
BDEPEND="
|
36 |
|
system-protoc? ( ~dev-libs/protobuf-${PV#3.}:0 )
|
37 |
|
!system-protoc? ( >=dev-cpp/abseil-cpp-20230125.2 )
|
|
38 |
system-protoc? ( ~dev-libs/protobuf-${MY_PV3}:0 )
|
|
39 |
!system-protoc? ( >=dev-cpp/abseil-cpp-20230125.3 )
|
38 |
40 |
"
|
39 |
41 |
|
40 |
42 |
PATCHES=(
|
... | ... | |
60 |
62 |
src_prepare() {
|
61 |
63 |
# If the corrsponding version of system-protoc is not available we build protoc locally
|
62 |
64 |
if use system-protoc; then
|
63 |
|
:
|
|
65 |
default # apply patches
|
64 |
66 |
else
|
65 |
67 |
cmake_src_prepare
|
66 |
68 |
fi
|
67 |
69 |
java-pkg-2_src_prepare
|
68 |
70 |
|
69 |
71 |
mkdir "${JAVA_RESOURCE_DIRS}" || die
|
70 |
|
# https://github.com/protocolbuffers/protobuf/blob/v23.0/java/core/pom.xml#L43-L62
|
|
72 |
# https://github.com/protocolbuffers/protobuf/blob/v24.2/java/core/pom.xml#L43-L62
|
71 |
73 |
PROTOS=( $(sed \
|
72 |
74 |
-n '/google\/protobuf.*\.proto/s:.*<include>\(.*\)</include>:\1:p' \
|
73 |
75 |
"${S}/java/core/pom.xml") ) || die
|
... | ... | |
75 |
77 |
cp --parents -v "${PROTOS[@]}" ../"${JAVA_RESOURCE_DIRS}" || die
|
76 |
78 |
popd > /dev/null || die
|
77 |
79 |
|
78 |
|
# https://github.com/protocolbuffers/protobuf/blob/v23.0/java/core/generate-sources-build.xml
|
|
80 |
# https://github.com/protocolbuffers/protobuf/blob/v24.2/java/core/generate-sources-build.xml
|
79 |
81 |
einfo "Replace variables in generate-sources-build.xml"
|
80 |
82 |
sed \
|
81 |
83 |
-e 's:${generated.sources.dir}:java/core/src/main/java:' \
|
... | ... | |
84 |
86 |
-e '/project\|echo\|mkdir\|exec/d' \
|
85 |
87 |
-i java/core/generate-sources-build.xml || die "sed to sources failed"
|
86 |
88 |
|
87 |
|
# https://github.com/protocolbuffers/protobuf/blob/v23.0/java/core/generate-test-sources-build.xml
|
|
89 |
# https://github.com/protocolbuffers/protobuf/blob/v24.2/java/core/generate-test-sources-build.xml
|
88 |
90 |
einfo "Replace variables in generate-test-sources-build.xml"
|
89 |
91 |
sed \
|
90 |
92 |
-e 's:${generated.testsources.dir}:java/core/src/test/java:' \
|
... | ... | |
127 |
129 |
}
|
128 |
130 |
|
129 |
131 |
src_test() {
|
130 |
|
# https://github.com/protocolbuffers/protobuf/blob/v23.0/java/core/pom.xml#L63-L71
|
|
132 |
# https://github.com/protocolbuffers/protobuf/blob/v24.2/java/core/pom.xml#L63-L71
|
131 |
133 |
jar cvf testdata.jar \
|
132 |
134 |
-C src google/protobuf/testdata/golden_message_oneof_implemented \
|
133 |
135 |
-C src google/protobuf/testdata/golden_packed_fields_message || die
|