File: build_proto_toolchain.sh

package info (click to toggle)
swiftlang 6.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,791,532 kB
  • sloc: cpp: 9,901,743; ansic: 2,201,431; asm: 1,091,827; python: 308,252; objc: 82,166; f90: 80,126; lisp: 38,358; pascal: 25,559; sh: 20,429; ml: 5,058; perl: 4,745; makefile: 4,484; awk: 3,535; javascript: 3,018; xml: 918; fortran: 664; cs: 573; ruby: 396
file content (28 lines) | stat: -rwxr-xr-x 1,148 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash -eu
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2020 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See http://swift.org/LICENSE.txt for license information
# See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors

PROTOC_ZIP=protoc-27.2-osx-universal_binary.zip
PROTOC_URL="https://github.com/protocolbuffers/protobuf/releases/download/v27.2/$PROTOC_ZIP"

UTILITIES_DIR="$(dirname "$0")"
TOOLS_DIR="$UTILITIES_DIR/tools"

mkdir -p "$TOOLS_DIR"

if [[ ! -f "$UTILITIES_DIR/tools/$PROTOC_ZIP" ]]; then
    curl -L "$PROTOC_URL" --output "$TOOLS_DIR/$PROTOC_ZIP"
    unzip -o "$TOOLS_DIR/$PROTOC_ZIP" -d "$TOOLS_DIR"
fi

# Use swift build instead of cloning the repo to make sure that the generated code matches the SwiftProtobuf library
# being used as a dependency in the build. This might be a bit slower, but it's correct.
swift build -c release --product protoc-gen-swift --package-path "$UTILITIES_DIR/../thirdparty/swift-protobuf"

cp "$UTILITIES_DIR"/../.build/release/protoc-gen-swift "$TOOLS_DIR/bin"