@@ -34,44 +34,57 @@ functions:
34
34
params :
35
35
working_dir : src/go.mongodb.org/mongo-driver
36
36
script : |
37
- if [ "Windows_NT" = "$OS" ]; then
38
- export GOPATH=$(cygpath -w $(dirname $(dirname $(dirname `pwd`))))
39
- else
40
- export GOPATH=$(dirname $(dirname $(dirname `pwd`)))
41
- fi;
42
-
43
- # Get the current unique version of this checkout
37
+ # Get the current unique version of this checkout.
44
38
if [ "${is_patch}" = "true" ]; then
45
39
CURRENT_VERSION=$(git describe)-patch-${version_id}
46
40
else
47
41
CURRENT_VERSION=latest
48
42
fi
49
43
50
- export DRIVERS_TOOLS="$(pwd)/../drivers-tools"
51
- export PROJECT_DIRECTORY="$(pwd)"
44
+ # Set Golang environment vars. GOROOT is wherever current Go distribution is; GOPATH is always 3
45
+ # directories up from pwd; GOCACHE is under .cache in the pwd.
46
+ export GOROOT="${GO_DIST}"
47
+ export GOPATH="$(dirname $(dirname $(dirname `pwd`)))"
52
48
export GOCACHE="$(pwd)/.cache"
53
49
54
- # Python has cygwin path problems on Windows. Detect prospective mongo-orchestration home directory
55
- if [ "Windows_NT" = "$OS" ]; then # Magic variable in cygwin
56
- export DRIVERS_TOOLS=$(cygpath -m $DRIVERS_TOOLS)
57
- export PROJECT_DIRECTORY=$(cygpath -m $PROJECT_DIRECTORY)
58
- export GOCACHE=$(cygpath -m $GOCACHE)
59
- fi
60
-
50
+ # Set other relevant variables for Evergreen processes.
51
+ export DRIVERS_TOOLS="$(pwd)/../drivers-tools"
52
+ export PROJECT_DIRECTORY="$(pwd)"
61
53
export MONGO_ORCHESTRATION_HOME="$DRIVERS_TOOLS/.evergreen/orchestration"
62
54
export MONGODB_BINARIES="$DRIVERS_TOOLS/mongodb/bin"
63
55
export UPLOAD_BUCKET="${project}"
64
- export PATH="${GO_DIST}/bin:${GCC_PATH}:$GOPATH/bin:$MONGODB_BINARIES:$PATH"
65
56
export PROJECT="${project}"
66
57
58
+ # If on Windows, convert paths with cygpath. GOROOT should not be converted as Windows expects it
59
+ # to be separated with '\'.
67
60
if [ "Windows_NT" = "$OS" ]; then
61
+ export GOPATH=$(cygpath -m $GOPATH)
62
+ export GOCACHE=$(cygpath -m $GOCACHE)
63
+ export DRIVERS_TOOLS=$(cygpath -m $DRIVERS_TOOLS)
64
+ export PROJECT_DIRECTORY=$(cygpath -m $PROJECT_DIRECTORY)
65
+ export MONGO_ORCHESTRATION_HOME=$(cygpath -m $MONGO_ORCHESTRATION_HOME)
66
+ export MONGODB_BINARIES=$(cygpath -m $MONGODB_BINARIES)
67
+ export UPLOAD_BUCKET=$(cygpath -m $UPLOAD_BUCKET)
68
+ export PROJECT=$(cygpath -m $PROJECT)
69
+
70
+ # Set home variables for Windows, too.
68
71
export USERPROFILE=$(cygpath -w $(dirname $(dirname $(dirname `pwd`))))
69
- export HOME=$(cygpath -w $(dirname $(dirname $(dirname `pwd`))))
72
+ export HOME=$USERPROFILE
73
+ fi
74
+
75
+ # Set actual PATH. PATH should contain binaries from GOROOT, GOPATH, GCC_PATH and mongodb.
76
+ # Adding GOROOT's bin to PATH on Windows requires a cygpath conversion.
77
+ export GOROOTBIN="$GOROOT/bin"
78
+ if [ "Windows_NT" = "$OS" ]; then
79
+ export GOROOTBIN=$(cygpath -m $GOROOTBIN)
70
80
fi
81
+ export PATH="$GOROOTBIN:$GOPATH/bin:${GCC_PATH}:$MONGODB_BINARIES:$PATH"
71
82
83
+ # Check Go installation.
72
84
go version
73
85
go env
74
86
87
+ # Install libmongocrypt based on OS.
75
88
if [ "Windows_NT" = "$OS" ]; then
76
89
mkdir -p c:/libmongocrypt/include
77
90
mkdir -p c:/libmongocrypt/bin
@@ -94,21 +107,21 @@ functions:
94
107
PROJECT_DIRECTORY: "$PROJECT_DIRECTORY"
95
108
PREPARE_SHELL: |
96
109
set -o errexit
110
+ export GOROOT="$GOROOT"
97
111
export GOPATH="$GOPATH"
98
- export GOROOT="${GO_DIST}"
99
112
export GOCACHE="$GOCACHE"
100
113
export DRIVERS_TOOLS="$DRIVERS_TOOLS"
114
+ export PROJECT_DIRECTORY="$PROJECT_DIRECTORY"
101
115
export MONGO_ORCHESTRATION_HOME="$MONGO_ORCHESTRATION_HOME"
102
116
export MONGODB_BINARIES="$MONGODB_BINARIES"
103
117
export UPLOAD_BUCKET="$UPLOAD_BUCKET"
104
- export PROJECT_DIRECTORY="$PROJECT_DIRECTORY"
105
- export TMPDIR="$MONGO_ORCHESTRATION_HOME/db"
106
- export PATH="$PATH"
107
118
export PROJECT="$PROJECT"
119
+ export TMPDIR="$MONGO_ORCHESTRATION_HOME/db"
108
120
export PKG_CONFIG_PATH=$(pwd)/install/libmongocrypt/lib/pkgconfig:$(pwd)/install/mongo-c-driver/lib/pkgconfig
109
121
export LD_LIBRARY_PATH=$(pwd)/install/libmongocrypt/lib
122
+ export PATH="$PATH"
110
123
EOT
111
- # See what we've done
124
+ # See what we variables we 've set.
112
125
cat expansion.yml
113
126
# Load the expansion file to make an evergreen variable with the current unique version
114
127
- command : expansions.update
0 commit comments