代码拉取完成,页面将自动刷新
From 11c8f77c101385119e34d0961e4203c6eb27c52d Mon Sep 17 00:00:00 2001
From: Dingli Zhang <dingli@iscas.ac.cn>
Date: Fri, 5 Jul 2024 03:48:20 +0000
Subject: [PATCH] Added support for building the riscv64 protoc-gen-grpc-java
binaries with Kokoro
diff --git a/build.gradle b/build.gradle
index ed4baab82..c5bed1026 100644
--- a/build.gradle
+++ b/build.gradle
@@ -23,6 +23,8 @@ subprojects {
version = "1.56.0" // CURRENT_GRPC_VERSION
repositories {
+ maven { url 'file://@HOME@/.m2/repository'}
+ maven { url "https://mirrors.huaweicloud.com/repository/maven/"}
maven { // The google mirror is less flaky than mavenCentral()
url "https://maven-central.storage-download.googleapis.com/maven2/" }
mavenCentral()
diff --git a/buildscripts/kokoro/linux_artifacts.sh b/buildscripts/kokoro/linux_artifacts.sh
index c80d3436f..49a15a457 100755
--- a/buildscripts/kokoro/linux_artifacts.sh
+++ b/buildscripts/kokoro/linux_artifacts.sh
@@ -56,6 +56,8 @@ cp -r "$LOCAL_MVN_TEMP"/* "$MVN_ARTIFACT_DIR"/
SKIP_TESTS=true ARCH=aarch_64 /grpc-java/buildscripts/kokoro/unix.sh
"$GRPC_JAVA_DIR"/buildscripts/run_in_docker.sh grpc-java-artifacts-multiarch env \
SKIP_TESTS=true ARCH=ppcle_64 /grpc-java/buildscripts/kokoro/unix.sh
+"$GRPC_JAVA_DIR"/buildscripts/run_in_docker.sh grpc-java-artifacts-multiarch env \
+ SKIP_TESTS=true ARCH=risv64 /grpc-java/buildscripts/kokoro/unix.sh
# Use a newer GCC version. GCC 7 in multiarch has a bug:
# internal compiler error: output_operand: invalid %-code
"$GRPC_JAVA_DIR"/buildscripts/run_in_docker.sh grpc-java-artifacts-ubuntu2004 env \
diff --git a/buildscripts/kokoro/unix.sh b/buildscripts/kokoro/unix.sh
index 1e6af6cfc..048aef9e8 100755
--- a/buildscripts/kokoro/unix.sh
+++ b/buildscripts/kokoro/unix.sh
@@ -48,7 +48,7 @@ GRADLE_FLAGS+=" -Pcheckstyle.ignoreFailures=false"
GRADLE_FLAGS+=" -PfailOnWarnings=true"
GRADLE_FLAGS+=" -PerrorProne=true"
GRADLE_FLAGS+=" -PskipAndroid=true"
-GRADLE_FLAGS+=" -Dorg.gradle.parallel=true"
+GRADLE_FLAGS+=" -Dorg.gradle.parallel=false"
export GRADLE_OPTS="-Dorg.gradle.jvmargs='-Xmx1g'"
# Make protobuf discoverable by :grpc-compiler
@@ -90,7 +90,7 @@ fi
LOCAL_MVN_TEMP=$(mktemp -d)
# Note that this disables parallel=true from GRADLE_FLAGS
if [[ -z "${ALL_ARTIFACTS:-}" ]]; then
- if [[ "$ARCH" = "aarch_64" || "$ARCH" = "ppcle_64" || "$ARCH" = "s390_64" ]]; then
+ if [[ $ARCH == "aarch_64" || $ARCH == "riscv64" ]]; then
GRADLE_FLAGS+=" -x grpc-compiler:generateTestProto -x grpc-compiler:generateTestLiteProto"
GRADLE_FLAGS+=" -x grpc-compiler:testGolden -x grpc-compiler:testLiteGolden"
GRADLE_FLAGS+=" -x grpc-compiler:testDeprecatedGolden -x grpc-compiler:testDeprecatedLiteGolden"
diff --git a/buildscripts/kokoro/upload_artifacts.sh b/buildscripts/kokoro/upload_artifacts.sh
index 39e27eff5..bc47d4b50 100644
--- a/buildscripts/kokoro/upload_artifacts.sh
+++ b/buildscripts/kokoro/upload_artifacts.sh
@@ -34,6 +34,9 @@ LOCAL_OTHER_ARTIFACTS="$KOKORO_GFILE_DIR"/github/grpc-java/artifacts/
# for linux aarch64 platform
[[ "$(find "$LOCAL_MVN_ARTIFACTS" -type f -iname 'protoc-gen-grpc-java-*-linux-aarch_64.exe' | wc -l)" != '0' ]]
+# for linux riscv64 platform
+[[ "$(find "$LOCAL_MVN_ARTIFACTS" -type f -iname 'protoc-gen-grpc-java-*-linux-riscv64.exe' | wc -l)" != '0' ]]
+
# for linux ppc64le platform
[[ "$(find "$LOCAL_MVN_ARTIFACTS" -type f -iname 'protoc-gen-grpc-java-*-linux-ppcle_64.exe' | wc -l)" != '0' ]]
diff --git a/buildscripts/make_dependencies.sh b/buildscripts/make_dependencies.sh
index 3d02a72f4..0427d47e1 100755
--- a/buildscripts/make_dependencies.sh
+++ b/buildscripts/make_dependencies.sh
@@ -7,8 +7,8 @@ PROTOBUF_VERSION=21.7
# ARCH is x86_64 bit unless otherwise specified.
ARCH="${ARCH:-x86_64}"
-DOWNLOAD_DIR=/tmp/source
-INSTALL_DIR="/tmp/protobuf-cache/$PROTOBUF_VERSION/$(uname -s)-$ARCH"
+DOWNLOAD_DIR=/var/tmp/source
+INSTALL_DIR="/var/tmp/protobuf-cache/$PROTOBUF_VERSION/$(uname -s)-$ARCH"
mkdir -p $DOWNLOAD_DIR
# Start with a sane default
@@ -36,6 +36,8 @@ else
--prefix="$INSTALL_DIR"
elif [[ "$ARCH" == aarch* ]]; then
./configure --disable-shared --host=aarch64-linux-gnu --prefix="$INSTALL_DIR"
+ elif [[ "$ARCH" == riscv* ]]; then
+ ./configure --disable-shared --host=riscv64-linux-gnu --prefix="$INSTALL_DIR"
elif [[ "$ARCH" == ppc* ]]; then
./configure --disable-shared --host=powerpc64le-linux-gnu --prefix="$INSTALL_DIR"
elif [[ "$ARCH" == s390* ]]; then
diff --git a/compiler/build.gradle b/compiler/build.gradle
index 12798208c..7960642cd 100644
--- a/compiler/build.gradle
+++ b/compiler/build.gradle
@@ -58,6 +58,7 @@ model {
cppCompiler.executable = 'aarch64-linux-gnu-g++'
linker.executable = 'aarch64-linux-gnu-g++'
}
+ target("riscv64")
target("s390_64") {
cppCompiler.executable = 's390x-linux-gnu-g++'
linker.executable = 's390x-linux-gnu-g++'
@@ -73,6 +74,7 @@ model {
x86_64 { architecture "x86_64" }
ppcle_64 { architecture "ppcle_64" }
aarch_64 { architecture "aarch_64" }
+ riscv64 { architecture "riscv64" }
s390_64 { architecture "s390_64" }
loongarch_64 { architecture "loongarch_64" }
}
@@ -84,6 +86,7 @@ model {
'x86_64',
'ppcle_64',
'aarch_64',
+ 'riscv64',
's390_64',
'loongarch_64'
]) {
diff --git a/compiler/check-artifact.sh b/compiler/check-artifact.sh
index a5f33a35b..ebe9dc4a1 100755
--- a/compiler/check-artifact.sh
+++ b/compiler/check-artifact.sh
@@ -61,6 +61,8 @@ checkArch ()
assertEq "$format" "elf64-x86-64" $LINENO
elif [[ "$ARCH" == aarch_64 ]]; then
assertEq "$format" "elf64-little" $LINENO
+ elif [[ "$ARCH" == riscv64 ]]; then
+ assertEq $format "elf64-littleriscv" $LINENO
elif [[ "$ARCH" == loongarch_64 ]]; then
echo $format
assertEq "$format" "elf64-loongarch" $LINENO
@@ -119,6 +121,9 @@ checkDependencies ()
elif [[ "$ARCH" == aarch_64 ]]; then
dump_cmd='aarch64-linux-gnu-objdump -x '"$1"' |grep "NEEDED"'
white_list="linux-vdso\.so\.1\|libpthread\.so\.0\|libm\.so\.6\|libc\.so\.6\|ld-linux-aarch64\.so\.1"
+ elif [[ "$ARCH" == riscv64 ]]; then
+ dump_cmd='objdump -p '"$1"' | grep NEEDED'
+ white_list="libm\.so\.6\|libc\.so\.6\|ld-linux-riscv64-lp64d\.so\.1"
elif [[ "$ARCH" == loongarch_64 ]]; then
dump_cmd='objdump -x '"$1"' | grep NEEDED'
white_list="linux-vdso\.so\.1\|libpthread\.so\.0\|libm\.so\.6\|libc\.so\.6\|ld\.so\.1"
--
2.41.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。