Merge commit '36bca61764984ff5395653cf8377ec5daa71b709' as 'libs/protobuf'

This commit is contained in:
Henry Winkel
2022-10-22 14:46:58 +02:00
2186 changed files with 838730 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
#!/bin/bash
set -ex
# change to repo root
cd $(dirname $0)/../../../..
source kokoro/release/ruby/linux/prepare_build.sh
# ruby environment
source kokoro/release/ruby/linux/ruby/ruby_build_environment.sh
# build artifacts
bash kokoro/release/ruby/linux/ruby/ruby_build.sh

View File

@@ -0,0 +1,8 @@
# Configuration for Linux release builds
build_file: "protobuf/kokoro/release/ruby/linux/build_artifacts.sh"
action {
define_artifacts {
regex: "github/protobuf/artifacts/**"
}
}

View File

@@ -0,0 +1 @@
# Keep this file empty! Use common.cfg instead.

View File

@@ -0,0 +1,12 @@
#!/bin/bash
# Move docker's storage location to scratch disk so we don't run out of space.
echo 'DOCKER_OPTS="${DOCKER_OPTS} --graph=/tmpfs/docker"' | sudo tee --append /etc/default/docker
# Use container registry mirror for pulling docker images (should make downloads faster)
# See https://cloud.google.com/container-registry/docs/using-dockerhub-mirroring
echo 'DOCKER_OPTS="${DOCKER_OPTS} --registry-mirror=https://mirror.gcr.io"' | sudo tee --append /etc/default/docker
sudo service docker restart
# All artifacts come here
mkdir artifacts
export ARTIFACT_DIR=$(pwd)/artifacts

View File

@@ -0,0 +1 @@
# Keep this file empty! Use common.cfg instead.

View File

@@ -0,0 +1,8 @@
# Configuration for Linux release builds
build_file: "protobuf/kokoro/release/ruby/linux/build_artifacts.sh"
action {
define_artifacts {
regex: "github/protobuf/artifacts/**"
}
}

View File

@@ -0,0 +1,22 @@
#!/bin/bash
set -ex
# Build protoc
use_bazel.sh 5.1.1
bazel build //:protoc
# The java build setup expects protoc in the root directory.
cp bazel-bin/protoc .
export PROTOC=$PWD/protoc
# Pull in dependencies.
git submodule update --init --recursive
umask 0022
pushd ruby
gem install bundler -v 2.1.4
bundle update && bundle exec rake gem:native
ls pkg
mv pkg/* $ARTIFACT_DIR
popd

View File

@@ -0,0 +1,9 @@
#!/bin/bash
set +ex
[[ -s /etc/profile.d/rvm.sh ]] && . /etc/profile.d/rvm.sh
set -e # rvm commands are very verbose
rvm --default use ruby-2.4.1
# The version needs to be updated if the version specified in Gemfile.lock is changed
gem install bundler -v '1.17.3'
set -ex

View File

@@ -0,0 +1,16 @@
#!/bin/bash
set -ex
# change to repo root
cd $(dirname $0)/../../../..
# all artifacts come here
mkdir artifacts
export ARTIFACT_DIR=$(pwd)/artifacts
# ruby environment
bash kokoro/release/ruby/macos/ruby/ruby_build_environment.sh
# build artifacts
bash kokoro/release/ruby/macos/ruby/ruby_build.sh

View File

@@ -0,0 +1,8 @@
# Configuration for Mac OSX release builds
build_file: "protobuf/kokoro/release/ruby/macos/build_artifacts.sh"
action {
define_artifacts {
regex: "github/protobuf/artifacts/**"
}
}

View File

@@ -0,0 +1 @@
# Keep this file empty! Use common.cfg instead.

View File

@@ -0,0 +1 @@
# Keep this file empty! Use common.cfg instead.

View File

@@ -0,0 +1,8 @@
# Configuration for Mac OSX release builds
build_file: "protobuf/kokoro/release/ruby/macos/build_artifacts.sh"
action {
define_artifacts {
regex: "github/protobuf/artifacts/**"
}
}

View File

@@ -0,0 +1,17 @@
#!/bin/bash
set -ex
# Build protoc
bazel build //:protoc
export PROTOC=$PWD/bazel-bin/protoc
# Pull in dependencies.
git submodule update --init --recursive
umask 0022
pushd ruby
bundle update && bundle exec rake gem:native
ls pkg
mv pkg/* $ARTIFACT_DIR
popd

View File

@@ -0,0 +1,120 @@
#!/bin/bash
set -ex
# Fix permissions
sudo chown -R $(whoami) $HOME/.rvm/
sudo chown -R $(whoami) /Library/Ruby/
set +ex # rvm script is very verbose and exits with errorcode
# Fix permissions
sudo chown -R $(whoami) $HOME/.rvm/
sudo chown -R $(whoami) /Library/Ruby/
source $HOME/.rvm/scripts/rvm
set -e # rvm commands are very verbose
time rvm install 2.5.0
rvm use 2.5.0
gem install rake-compiler --no-document
gem install bundler --no-document
time rvm install 3.1.0
rvm use 3.1.0
gem install rake-compiler --no-document
gem install bundler --no-document
time rvm install 2.7.0
rvm use 2.7.0 --default
gem install rake-compiler --no-document
gem install bundler --no-document
rvm osx-ssl-certs status all
rvm osx-ssl-certs update all
set -ex
rm -rf ~/.rake-compiler
CROSS_RUBY=$(mktemp tmpfile.XXXXXXXX)
CROSS_RUBY31=$(mktemp tmpfile.XXXXXXXX)
curl https://raw.githubusercontent.com/rake-compiler/rake-compiler/72184e51779b6a3b9b8580b036a052fdc3181ced/tasks/bin/cross-ruby.rake > "$CROSS_RUBY"
# See https://github.com/grpc/grpc/issues/12161 for verconf.h patch details
patch "$CROSS_RUBY" << EOF
--- cross-ruby.rake 2020-12-11 11:17:53.000000000 +0900
+++ patched 2020-12-11 11:18:52.000000000 +0900
@@ -111,10 +111,12 @@
"--host=#{MINGW_HOST}",
"--target=#{MINGW_TARGET}",
"--build=#{RUBY_BUILD}",
- '--enable-shared',
+ '--enable-static',
+ '--disable-shared',
'--disable-install-doc',
+ '--without-gmp',
'--with-ext=',
- 'LDFLAGS=-pipe -s',
+ 'LDFLAGS=-pipe',
]
# Force Winsock2 for Ruby 1.8, 1.9 defaults to it
@@ -130,6 +132,7 @@
# make
file "#{build_dir}/ruby.exe" => ["#{build_dir}/Makefile"] do |t|
chdir File.dirname(t.prerequisites.first) do
+ sh "test -s verconf.h || rm -f verconf.h" # if verconf.h has size 0, make sure it gets re-built by make
sh MAKE
end
end
EOF
cp $CROSS_RUBY $CROSS_RUBY31
patch "$CROSS_RUBY31" << EOF
--- cross-ruby.rake 2022-03-04 11:49:52.000000000 +0000
+++ patched 2022-03-04 11:58:22.000000000 +0000
@@ -114,6 +114,7 @@
'--enable-static',
'--disable-shared',
'--disable-install-doc',
+ '--with-coroutine=ucontext',
'--without-gmp',
'--with-ext=',
'LDFLAGS=-pipe',
EOF
MAKE="make -j8"
set +x # rvm commands are very verbose
rvm use 3.1.0
set -x
ruby --version | grep 'ruby 3.1.0'
for v in 3.1.0 ; do
ccache -c
rake -f "$CROSS_RUBY31" cross-ruby VERSION="$v" HOST=x86_64-darwin MAKE="$MAKE"
# Disabled until it can be fixed: https://github.com/protocolbuffers/protobuf/issues/9804
# rake -f "$CROSS_RUBY31" cross-ruby VERSION="$v" HOST=aarch64-darwin MAKE="$MAKE"
done
set +x # rvm commands are very verbose
rvm use 2.7.0
set -x
ruby --version | grep 'ruby 2.7.0'
for v in 3.0.0 2.7.0 ; do
ccache -c
rake -f "$CROSS_RUBY" cross-ruby VERSION="$v" HOST=x86_64-darwin MAKE="$MAKE"
# Disabled until it can be fixed: https://github.com/protocolbuffers/protobuf/issues/9804
# rake -f "$CROSS_RUBY" cross-ruby VERSION="$v" HOST=aarch64-darwin MAKE="$MAKE"
done
set +x
rvm use 2.5.0
set -x
ruby --version | grep 'ruby 2.5.0'
for v in 2.6.0 2.5.1; do
ccache -c
rake -f "$CROSS_RUBY" cross-ruby VERSION="$v" HOST=x86_64-darwin MAKE="$MAKE"
# Disabled until it can be fixed: https://github.com/protocolbuffers/protobuf/issues/9804
# rake -f "$CROSS_RUBY" cross-ruby VERSION="$v" HOST=aarch64-darwin MAKE="$MAKE"
done
set +x
rvm use 2.7.0
set -x