• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2#
3# Copyright 2020 Google Inc. All rights reserved.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#     http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
17set -e
18set -x
19
20# install devtools
21install_languages() {
22  sudo apt update
23
24  # Install nodeJS and yarn
25  wget https://raw.githubusercontent.com/creationix/nvm/v0.31.0/nvm.sh -O ~/.nvm/nvm.sh
26  source ~/.nvm/nvm.sh
27  nvm install node
28  node --version
29  curl -o- -L https://yarnpkg.com/install.sh | bash
30  export PATH="$HOME/.yarn/bin:$PATH"
31  yarn config set prefix ~/.yarn -g
32  export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
33
34  # Install swift
35  sudo apt-get install \
36          binutils \
37          git \
38          libc6-dev \
39          libcurl3 \
40          libedit2 \
41          libgcc-5-dev \
42          libpython2.7 \
43          libsqlite3-0 \
44          libstdc++-5-dev \
45          libxml2 \
46          pkg-config \
47          tzdata \
48          zlib1g-dev
49
50  SWIFT_URL=https://swift.org/builds/swift-5.3.1-release/ubuntu1604/swift-5.3.1-RELEASE/swift-5.3.1-RELEASE-ubuntu16.04.tar.gz
51  curl -fSsL "$SWIFT_URL" -o swift.tar.gz
52
53  mkdir ~/swiftbuild
54  tar -xvzf swift.tar.gz -C ~/swiftbuild
55
56  export PATH="~/swiftbuild/swift-5.3.1-RELEASE-ubuntu16.04/usr/bin:$PATH"
57
58
59  mkdir ~/gobuild
60  wget -c https://golang.org/dl/go1.15.2.linux-amd64.tar.gz
61  tar -xvzf go1.15.2.linux-amd64.tar.gz -C ~/gobuild
62
63  export  PATH="~/gobuild/go/bin:$PATH"
64
65  swift --version
66  go version
67  yarn -v
68  node -v
69}
70
71install_formatters() {
72  # installing swift formatter
73  git clone --depth 1 --branch 0.47.4 https://github.com/nicklockwood/SwiftFormat.git
74  cd SwiftFormat
75  swift build -c release
76  sudo cp .build/release/swiftformat /usr/local/bin/swiftformat
77  cd ..
78
79  which yarn
80  which node
81  yarn -v
82  node -v
83
84  yarn install
85  pip install pylint
86}
87
88install_languages
89export PATH="~/swift/swift/usr/bin:$PATH"
90install_formatters