11#! /usr/bin/env bash
2- 
2+ set  -x 
33#  return 1 if this test should not be built in CI (for other archs, not needed, etc.)
44function  skip_ino() 
55{
@@ -64,11 +64,18 @@ function build_sketches()
6464    local  build_mod=$4 
6565    local  build_rem=$5 
6666    local  lwip=$6 
67+     export  ARDUINO_IDE_PATH=$arduino 
6768    mkdir -p $build_dir 
6869    local  build_cmd=" python3 tools/build.py -b generic -v -w all -s 4M1M -v -k --build_cache $cache_dir  -p $PWD /$build_dir  -n $lwip  $build_arg  " 
70+     if  [ " $WINDOWS " =  " 1" ;  then 
71+         #  Paths to the arduino builder need to be c:\ referenced, not our native ones
72+ 	local  pwd_win=$( realpath $PWD  |  sed ' s/\/c/C:/' ) 
73+ 	local  bar_win=$( echo $build_arg  |  sed ' s/\/c\//C:\//g' ) 
74+         export  ARDUINO_IDE_PATH=$( realpath $arduino  |  sed ' s/\/c/C:/' ) 
75+         build_cmd=" python3 tools/build.py -b generic -v -w all -s 4M1M -v -k -p $pwd_win /$build_dir  -n $lwip  $bar_win  " 
76+     fi 
6977    local  sketches=$( find $srcpath  -name * .ino |  sort) 
7078    print_size_info > size.log
71-     export  ARDUINO_IDE_PATH=$arduino 
7279    local  testcnt=0
7380    for  sketch  in  $sketches ;  do 
7481        testcnt=$((  ($testcnt  +  1 ) %  $build_mod  )) 
@@ -107,6 +114,9 @@ function build_sketches()
107114        fi 
108115        echo  -e " \n ------------ Building $sketch  ------------ \n" ; 
109116        #  $arduino --verify $sketch;
117+ 	if  [ " $WINDOWS " ==  " 1" ;  then 
118+             sketch=$( echo $sketch  |  sed ' s/\/c/C:/' ) 
119+         fi 
110120        echo  " $build_cmd  $sketch " 
111121        time  ($build_cmd  $sketch  > build.log)
112122        local  result=$? 
@@ -135,7 +145,7 @@ function install_libraries()
135145    pushd  $HOME /Arduino/libraries
136146
137147    #  install ArduinoJson library
138-     { test  -r ArduinoJson-v6.11.0.zip ||  wget https://github.com/bblanchon/ArduinoJson/releases/download/v6.11.0/ArduinoJson-v6.11.0.zip;  } &&  unzip ArduinoJson-v6.11.0.zip
148+     { test  -r ArduinoJson-v6.11.0.zip ||  wget -nv  https://github.com/bblanchon/ArduinoJson/releases/download/v6.11.0/ArduinoJson-v6.11.0.zip;  } &&  unzip -q  ArduinoJson-v6.11.0.zip
139149
140150    popd 
141151}
@@ -145,13 +155,28 @@ function install_ide()
145155    local  ide_path=$1 
146156    local  core_path=$2 
147157    local  debug=$3 
148-     test  -r arduino.tar.xz ||  wget -O arduino.tar.xz https://www.arduino.cc/download.php? f=/arduino-nightly-linux64.tar.xz
149-     tar xf arduino.tar.xz
158+     if  [ " $WINDOWS " =  " 1" ;  then 
159+         #  Acquire needed packages from Windows package manager
160+         choco install --no-progress python3
161+         export  PATH=" /c/Python37:$PATH " #  Ensure it's live from now on...
162+ 	cp /c/Python37/python.exe /c/Python37/python3.exe
163+         choco install --no-progress unzip
164+         choco install --no-progress sed
165+         test  -r arduino-nightly-windows.zip ||  wget -nv -O arduino-nightly-windows.zip https://www.arduino.cc/download.php? f=/arduino-nightly-windows.zip
166+         unzip -q arduino-nightly-windows.zip
167+     else 
168+         test  -r arduino.tar.xz ||  wget -nv -O arduino.tar.xz https://www.arduino.cc/download.php? f=/arduino-nightly-linux64.tar.xz
169+         tar xf arduino.tar.xz
170+     fi 
150171    mv arduino-nightly $ide_path 
151172    cd  $ide_path /hardware
152173    mkdir esp8266com
153174    cd  esp8266com
154-     ln -s $core_path  esp8266
175+     if  [ " $WINDOWS " =  " 1" ;  then 
176+         cp -a $core_path  esp8266
177+     else 
178+         ln -s $core_path  esp8266
179+     fi 
155180    local  debug_flags=" " 
156181    if  [ " $debug " =  " debug" ;  then 
157182        debug_flags=" -DDEBUG_ESP_PORT=Serial -DDEBUG_ESP_SSL -DDEBUG_ESP_TLS_MEM -DDEBUG_ESP_HTTP_CLIENT -DDEBUG_ESP_HTTP_SERVER -DDEBUG_ESP_CORE -DDEBUG_ESP_WIFI -DDEBUG_ESP_HTTP_UPDATE -DDEBUG_ESP_UPDATER -DDEBUG_ESP_OTA -DDEBUG_ESP_OOM" 
@@ -163,7 +188,7 @@ function install_ide()
163188    cat esp8266/platform.local.txt
164189    echo  -e " \n----\n" 
165190    cd  esp8266/tools
166-     python3 get.py
191+     python3 get.py -q 
167192    export  PATH=" $ide_path :$core_path /tools/xtensa-lx106-elf/bin:$PATH " 
168193}
169194
0 commit comments