]> git.lizzy.rs Git - rust.git/blobdiff - src/ci/shared.sh
Do not complain about missing `fn main()` in some cases
[rust.git] / src / ci / shared.sh
index 323d53f2bec85d8f1debb4135bf8860ed7d2f911..37e45b5639dc9ae538253f27b0d291b6f87c6916 100644 (file)
@@ -4,6 +4,8 @@
 # `source shared.sh`, hence the invalid shebang and not being
 # marked as an executable file in git.
 
+export MIRRORS_BASE="https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc"
+
 # See http://unix.stackexchange.com/questions/82598
 # Duplicated in docker/dist-various-2/shared.sh
 function retry {
@@ -25,53 +27,42 @@ function retry {
 }
 
 function isCI {
-  [ "$CI" = "true" ] || [ "$TRAVIS" = "true" ] || [ "$TF_BUILD" = "True" ]
+  [ "$CI" = "true" ] || [ "$TF_BUILD" = "True" ]
+}
+
+function isMacOS {
+  [ "$AGENT_OS" = "Darwin" ]
 }
 
-function isOSX {
-  [ "$TRAVIS_OS_NAME" = "osx" ] || [ "$AGENT_OS" = "Darwin" ]
+function isWindows {
+  [ "$AGENT_OS" = "Windows_NT" ]
+}
+
+function isLinux {
+  [ "$AGENT_OS" = "Linux" ]
 }
 
 function getCIBranch {
-  if [ "$TRAVIS" = "true" ]; then
-    echo "$TRAVIS_BRANCH"
-  elif [ "$APPVEYOR" = "True" ]; then
-    echo "$APPVEYOR_REPO_BRANCH"
-  else
-    echo "$BUILD_SOURCEBRANCHNAME"
-  fi;
+  echo "$BUILD_SOURCEBRANCHNAME"
 }
 
-if ! declare -F travis_fold; then
-  if [ "${TRAVIS-false}" = 'true' ]; then
-    # This is a trimmed down copy of
-    # https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/templates/header.sh
-    travis_fold() {
-      echo -en "travis_fold:$1:$2\r\033[0K"
-    }
-    travis_time_start() {
-      travis_timer_id=$(printf %08x $(( RANDOM * RANDOM )))
-      travis_start_time=$(travis_nanoseconds)
-      echo -en "travis_time:start:$travis_timer_id\r\033[0K"
-    }
-    travis_time_finish() {
-      travis_end_time=$(travis_nanoseconds)
-      local duration=$(($travis_end_time-$travis_start_time))
-      local msg="travis_time:end:$travis_timer_id"
-      echo -en "\n$msg:start=$travis_start_time,finish=$travis_end_time,duration=$duration\r\033[0K"
-    }
-    if [ $(uname) = 'Darwin' ]; then
-      travis_nanoseconds() {
-        date -u '+%s000000000'
-      }
-    else
-      travis_nanoseconds() {
-        date -u '+%s%N'
-      }
+function ciCommandAddPath {
+    if [[ $# -ne 1 ]]; then
+        echo "usage: $0 <path>"
+        exit 1
     fi
-  else
-    travis_fold() { return 0; }
-    travis_time_start() { return 0; }
-    travis_time_finish() { return 0; }
-  fi
-fi
+    path="$1"
+
+    echo "##vso[task.prependpath]${path}"
+}
+
+function ciCommandSetEnv {
+    if [[ $# -ne 2 ]]; then
+        echo "usage: $0 <name> <value>"
+        exit 1
+    fi
+    name="$1"
+    value="$2"
+
+    echo "##vso[task.setvariable variable=${name}]${value}"
+}