From 2eb4360922b9cfeb3d80221d87a845f0b01b0279 Mon Sep 17 00:00:00 2001 From: Milan Date: Thu, 19 Oct 2017 23:22:18 +0200 Subject: [PATCH] Shortened and Colorized Appveyor output (#120) * Console output compacted and colorized The installation info took too many lines and won't be revamped while working great as is, so I'd think that it's better to supress any logging. The quiet-mode of the installation doesn't really seem to work either. The installation part that sometimes errors is irrelevant to the part I've suppressed. --- appveyor.yml | 3 ++- build.sh | 65 +++++++++++++++++++++++++++++----------------------- 2 files changed, 38 insertions(+), 30 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index b19cf416..cfef552b 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -33,7 +33,8 @@ init: install: - ps: if (Test-Path Env:\CYG_ROOT) { Start-FileDownload "http://cygwin.com/$env:CYG_SETUP" -FileName "cygsetup.exe" -Timeout 30000 } - ps: if ((Get-Content "cygsetup.exe") -eq $Null) { Copy-Item "$env:CYG_SETUP" -Destination "cygsetup.exe" -Force } else { Copy-Item "cygsetup.exe" -Destination "$env:CYG_SETUP" -Force } - - if defined CYG_ROOT (%CYG_SETUP% --quiet-mode --no-shortcuts --only-site --root "%CYG_ROOT%" --site "%CYG_MIRROR%" --local-package-dir "%CYG_CACHE%" --packages "%CYG_PACKAGES%" --upgrade-also) + # Quiet-mode isn't really working but this does work. + - if defined CYG_ROOT ((%CYG_SETUP% --quiet-mode --no-shortcuts --only-site --root "%CYG_ROOT%" --site "%CYG_MIRROR%" --local-package-dir "%CYG_CACHE%" --packages "%CYG_PACKAGES%" --upgrade-also) > $null) build_script: - if defined BASH (%BASH% -lc "cd $(cygpath ${APPVEYOR_BUILD_FOLDER}) && dos2unix build.sh && sh build.sh") - xcopy %APPVEYOR_BUILD_FOLDER%\Enhancement %APPVEYOR_BUILD_FOLDER%\AppVeyor /E /I /Q diff --git a/build.sh b/build.sh index 4f935281..3b4e54f4 100644 --- a/build.sh +++ b/build.sh @@ -1,39 +1,45 @@ #!/bin/bash +BGREEN='\033[1;32m' +GREEN='\033[0;32m' +BCYAN='\033[1;36m' +RED='\033[0;31m' + +NC='\033[0m' # Removes Color + baseOutDir=$1 if [ -n "$baseOutDir" ]; then - if [ ! -d "$baseOutDir" ]; then - echo "Making base output directory $baseOutDir" - mkdir "$baseOutDir" - fi + if [ ! -d "$baseOutDir" ]; then + echo -e "${GREEN}Making base output directory ${BGREEN}$baseOutDir\n" + mkdir "$baseOutDir" + fi fi build_dir () { - srcDir=$1 - dstDir=$2 - if [ -n "$baseOutDir" ]; then - dstDir="$baseOutDir/$dstDir" - fi + srcDir=$1 + dstDir=$2 + if [ -n "$baseOutDir" ]; then + dstDir="$baseOutDir/$dstDir" + fi + params=( "$@" ) + rest=( "${params[@]:2}" ) - params=( "$@" ) - rest=( "${params[@]:2}" ) + if [ ! -d "$dstDir" ]; then + mkdir -p "$dstDir" + else + rm "$dstDir"/*.txt + fi - if [ ! -d "$dstDir" ]; then - echo "Making output directory $dstDir" - mkdir -p "$dstDir" - else - rm "$dstDir"/*.txt - fi + for f in "$srcDir"/*.txt + do + filename=`basename $f` + outName="$dstDir/$filename" + #echo "Building $f to $outName with params ${rest[@]}" + php "$f" "${rest[@]}" > "$outName" - for f in "$srcDir"/*.txt - do - filename=`basename $f` - outName="$dstDir/$filename" - echo "Building $f to $outName with params ${rest[@]}" - php "$f" "${rest[@]}" > "$outName" - if [ $? -ne 0 ]; then - rm "$outName" - fi - done + if [ $? -ne 0 ]; then + rm "$outName" + fi + done } res_360p=( "Performance" 640 360 ) @@ -57,7 +63,7 @@ std_respack () { params=( "$@" ) rest=( "${params[@]:1}" ) - #echo "std_respack $gameName" + echo -e "${GREEN}[Building] ${BCYAN}$gameName ${NC}to ${params[@]:1}" for arrg in "${rest[@]}" do resvarname="res_${arrg}[@]" @@ -77,7 +83,7 @@ std_respack () { #echo "$arrg w: $width h: $height inFolder: $inFolder outFolder: $outFolder" build_dir "$inFolder" "$outFolder" "${subparams[@]}" elif [ -n "$arrg" ]; then #only if requested resolution name not empty (which happens when you remove array elem naively) - echo "$arrg resolution not defined, define it in build.sh" + echo -e "${RED}$arrg resolution not defined, define it in build.sh" exit 1 fi done @@ -119,3 +125,4 @@ std_respack "WindWakerHD" "${res16by9[@]/$just1080p}" "${res21by9[@]}" std_respack "Wonderful101" "${res16by9[@]/$just720p}" std_respack "WoollyWorld" "${res16by9[@]/$just720p}" "${res21by9[@]}" std_respack "XenobladeX" "${res16by9[@]/$just720p}" "${res21by9[@]}" +echo -e "${NC}"