setconst global FOO = "bar"#!/bin/bash -e # Copyright 2015 Google Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. readonly GCS_BUCKET = '"gs://kythe-builds'" proc usage { echo "usage: $[basename $0]" > !2 } if [[ $# != 0 ]] { usage exit 1 } global REPO := $[readlink -e "$[dirname $0]/..] echo "Repository Root: $REPO" source tools/modules/versions.sh global NAME := ""llvm-$(FULL_SHA)"" echo "LLVM Version: $FULL_SHA" cd "$REPO/third_party/llvm" global TMP := $[mktemp -d] trap "rm -rf '$TMP'" EXIT ERR INT tar czf "$TMP/$NAME.tar.gz" llvm gsutil cp "$TMP/$NAME.tar.gz" "$(GCS_BUCKET)/" (CommandList children: [ (Assignment keyword: Assign_Readonly pairs: [ (assign_pair lhs: (LhsName name:GCS_BUCKET) op: Equal rhs: {(DQ ("gs://kythe-builds"))} spids: [45] ) ] spids: [43] ) (FuncDef name: usage body: (BraceGroup children: [ (SimpleCommand words: [ {(echo)} { (DQ ("usage: ") (CommandSubPart command_list: (CommandList children: [(C {(basename)} {(DQ ($ VSub_Number "$0"))})] ) left_token: spids: [62 68] ) ) } ] redirects: [(Redir op_id:Redir_GreatAnd fd:-1 arg_word:{(2)} spids:[71])] ) ] spids: [55] ) spids: [51 54] ) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id:BoolBinary_GlobNEqual left:{($ VSub_Pound "$#")} right:{(0)}) ) terminator: ) ] action: [(C {(usage)}) (C {(exit)} {(1)})] spids: [-1 90] ) ] spids: [-1 100] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:REPO) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children: [ (C {(readlink)} {(-e)} { (DQ (CommandSubPart command_list: (CommandList children: [(C {(dirname)} {(DQ ($ VSub_Number "$0"))})] ) left_token: spids: [111 117] ) (/..) ) } ) ] ) left_token: spids: [105 120] ) ) } spids: [103] ) ] spids: [103] ) (C {(echo)} {(DQ ("Repository Root: ") ($ VSub_Name "$REPO"))}) (C {(.)} {(tools/modules/versions.sh)}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:NAME) op: Equal rhs: {(DQ (llvm-) (${ VSub_Name FULL_SHA))} spids: [135] ) ] spids: [135] ) (C {(echo)} {(DQ ("LLVM Version: ") ($ VSub_Name "$FULL_SHA"))}) (C {(cd)} {(DQ ($ VSub_Name "$REPO") (/third_party/llvm))}) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:TMP) op: Equal rhs: { (DQ (CommandSubPart command_list: (CommandList children:[(C {(mktemp)} {(-d)})]) left_token: spids: [161 165] ) ) } spids: [159] ) ] spids: [159] ) (C {(trap)} {(DQ ("rm -rf '") ($ VSub_Name "$TMP") ("'"))} {(EXIT)} {(ERR)} {(INT)}) (C {(tar)} {(czf)} {(DQ ($ VSub_Name "$TMP") (/) ($ VSub_Name "$NAME") (.tar.gz))} {(llvm)}) (C {(gsutil)} {(cp)} {(DQ ($ VSub_Name "$TMP") (/) ($ VSub_Name "$NAME") (.tar.gz))} {(DQ (${ VSub_Name GCS_BUCKET) (/))} ) ] )