From 0b00bec9d3a7ba7b7b9ea928cb3af0192d1ec00c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4ger?= Date: Sat, 18 Jun 2022 14:21:38 +0200 Subject: [PATCH] Fixed build.cmd and made a best effort for build.sh --- build.cmd | 20 +++----------------- build.sh | 45 ++++++++++++++++++++++++++++++++++++--------- 2 files changed, 39 insertions(+), 26 deletions(-) diff --git a/build.cmd b/build.cmd index 62be08b..5a2922b 100644 --- a/build.cmd +++ b/build.cmd @@ -1,20 +1,7 @@ @echo off -cls +SET PATH=%LOCALAPPDATA%\Microsoft\dotnet;%PATH% .paket\paket.bootstrapper.exe -if errorlevel 1 ( - exit /b %errorlevel% -) - -.paket\paket.exe restore -if errorlevel 1 ( - exit /b %errorlevel% -) - -IF NOT EXIST build.fsx ( - .paket\paket.exe update - packages\FAKE\tools\FAKE.exe init.fsx -) SET BuildTarget= if "%BuildRunner%" == "MyGet" ( @@ -25,6 +12,5 @@ if "%BuildRunner%" == "MyGet" ( echo * git build >> RELEASE_NOTES.md ) -dotnet restore - -packages\FAKE\tools\FAKE.exe build.fsx %* %BuildTarget% \ No newline at end of file +dotnet tool restore +dotnet fake run build.fsx %* diff --git a/build.sh b/build.sh index 576d97e..37615cc 100644 --- a/build.sh +++ b/build.sh @@ -1,9 +1,39 @@ -#!/usr/bin/env bash +#!/bin/bash + +set -e -o + +function version_compare() { + ver1=(${1//./ }) + ver2=(${2//./ }) + + len1=${#ver1[@]} + len2=${#ver2[@]} + + vlen=$(($len1 < $len2 ? $len1 : $len2)) + + for ((i=0;i /dev/null) || EXIT_CODE=$? -cd `dirname $0` +if (($EXIT_CODE == 0)) && version_compare "$MINIMAL_DOTNET_VERSION" "$CURRENT_DOTNET_VERSION"; then + echo "dotnet command already installed" +else + # Install .NET Core (https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-install-script) + curl -sSL https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version 3.1.100 + + PATH="~/.dotnet:$PATH" +fi FSIARGS="" OS=${OS:-"unknown"} @@ -29,8 +59,5 @@ then mozroots --import --sync --quiet fi -run .paket/paket.exe restore - -[ ! -e build.fsx ] && run .paket/paket.exe update -[ ! -e build.fsx ] && run packages/FAKE/tools/FAKE.exe init.fsx -run packages/FAKE/tools/FAKE.exe "$@" $FSIARGS build.fsx \ No newline at end of file +dotnet tool restore +dotnet fake run $FSIARGS build.fsx $@ \ No newline at end of file