• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3set -ex
4
5# Change to repo root.
6cd $(dirname $0)/../..
7
8# Initialize any submodules.
9git submodule update --init --recursive
10
11# The directory with all resulting artifacts
12mkdir -p artifacts
13
14# Artifacts from all predecessor jobs get copied to this directory by kokoro
15INPUT_ARTIFACTS_DIR="${KOKORO_GFILE_DIR}/github/protobuf"
16
17# TODO(jtattermusch): remove listing the files, but for now it make it easier
18# to iterate on the script.
19ls -R ${INPUT_ARTIFACTS_DIR}
20
21# ====================================
22# Copy to expose all the artifacts from the predecessor jobs to the output
23# TODO(jtattermusch): the directory layout of the artifact builds is pretty messy,
24# so will be the output artifacts of this job.
25cp -r ${INPUT_ARTIFACTS_DIR}/* artifacts
26
27# ====================================
28# Build Google.Protobuf.Tools C# nuget
29# The reason it's being done in this script is that we need access to protoc binaries
30# built on multiple platform (the build is performed by the "build artifact" step)
31# and adding and extra chained build just for building the Google.Protobuf.Tools
32# nuget seems like an overkill.
33cd csharp
34mkdir -p protoc/windows_x86
35mkdir -p protoc/windows_x64
36cp ${INPUT_ARTIFACTS_DIR}/build32/Release/protoc.exe protoc/windows_x86/protoc.exe
37cp ${INPUT_ARTIFACTS_DIR}/build64/Release/protoc.exe protoc/windows_x64/protoc.exe
38
39mkdir -p protoc/linux_x86
40mkdir -p protoc/linux_x64
41# Because of maven unrelated reasonse the linux protoc binaries have a dummy .exe extension.
42# For the Google.Protobuf.Tools nuget, we don't want that exception, so we just remove it.
43cp ${INPUT_ARTIFACTS_DIR}/protoc-artifacts/target/linux/x86_32/protoc.exe protoc/linux_x86/protoc
44cp ${INPUT_ARTIFACTS_DIR}/protoc-artifacts/target/linux/x86_64/protoc.exe protoc/linux_x64/protoc
45
46mkdir -p protoc/macosx_x64
47cp ${INPUT_ARTIFACTS_DIR}/build64/src/protoc protoc/macosx_x64/protoc
48
49# Install nuget (will also install  mono)
50# TODO(jtattermusch): use "mono:5.14" docker image instead so we don't have to apt-get install
51sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
52echo "deb https://download.mono-project.com/repo/ubuntu stable-xenial main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list
53# NVidia has stopped publishing Cuda packages for Ubuntu 16.04, so we need to
54# delete this file to allow the apt update to run successfully.
55sudo rm -f /etc/apt/sources.list.d/cuda.list
56sudo apt update
57sudo apt-get install -y nuget
58
59nuget pack Google.Protobuf.Tools.nuspec
60
61# Copy the nupkg to the output artifacts
62cp Google.Protobuf.Tools.*.nupkg ../artifacts
63