1 # Licensed to the Apache Software Foundation (ASF) under one 2 # or more contributor license agreements. See the NOTICE file 3 # distributed with this work for additional information 4 # regarding copyright ownership. The ASF licenses this file 5 # to you under the Apache License, Version 2.0 (the 6 # "License"); you may not use this file except in compliance 7 # with the License. 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, 12 # software distributed under the License is distributed on an 13 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 14 # KIND, either express or implied. See the License for the 15 # specific language governing permissions and limitations 16 # under the License. 17 18 7z x -y windows_package.7z 19 20 # set default output encoding to utf8 21 $PSDefaultParameterValues['Out-File:Encoding'] = 'utf8' 22 23 $env:MXNET_HOME = [System.IO.Path]::GetFullPath('.\windows_package') 24 $env:JULIA_URL = "https://julialang-s3.julialang.org/bin/winnt/x64/0.7/julia-0.7.0-win64.exe" 25 $env:JULIA_DEPOT_PATH = [System.IO.Path]::GetFullPath('.\julia-depot') 26 27 $JULIA_DIR = [System.IO.Path]::GetFullPath('.\julia07') 28 $JULIA = "$JULIA_DIR\bin\julia" 29 30 # Download most recent Julia Windows binary 31 [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 32 (New-Object System.Net.WebClient).DownloadFile($env:JULIA_URL, "julia-binary.exe") 33 if ($LastExitCode -ne 0) { Throw ("Error on downloading Julia Windows binary") } 34 35 # Run installer silently, output to C:\julia07\julia 36 Start-Process -Wait "julia-binary.exe" -ArgumentList "/S /D=$JULIA_DIR" 37 if ($LastExitCode -ne 0) { Throw ("Error on installing Julia") } 38 39 & $JULIA -e "using InteractiveUtils; versioninfo()" 40 41 dir 42 43 $src=' 44 using Pkg 45 Pkg.activate(".\\julia") 46 Pkg.build() 47 Pkg.test() 48 ' 49 50 $src > .\ci-build.jl 51 52 # Redirect all stderr output to stdout, 53 # since Julia loggers output stuffs to stderr. 54 # Then, stderr triggers powershell NativeCommandError. 55 & $JULIA .\ci-build.jl 2>&1 | %{ "$_" } 56 if ($LastExitCode -eq 1) { Throw ("Error") } 57