diff --git a/build-all.ps1 b/build-all.ps1 index 964fc524..a3f80810 100644 --- a/build-all.ps1 +++ b/build-all.ps1 @@ -4,31 +4,29 @@ # Setting PYTHONIOENCODING avoids an obscure crash related to code page mismatch $env:PYTHONIOENCODING="utf-8" -$envsave = $env:PLATFORMIO_BUILD_FLAGS Function BuildMachine($names) { - $basename = $names[0] - $addname = $names[1] - $env:PLATFORMIO_BUILD_FLAGS = "-DMACHINE_FILENAME=$basename" - $displayname = $basename - if ($addname -ne "") { - $env:PLATFORMIO_BUILD_FLAGS += " -DMACHINE_FILENAME2=$addname" - $displayname += " + $addname" - } - Write-Output "Building machine $displayname" - platformio run 2>&1 | Select-String error,Took - Write-Output " " + $basename = $names[0] + $addname = $names[1] + $env:PLATFORMIO_BUILD_FLAGS = "-DMACHINE_FILENAME=$basename" + $displayname = $basename + if ($addname -ne "") { + $env:PLATFORMIO_BUILD_FLAGS += " -DMACHINE_FILENAME2=$addname" + $displayname += " + $addname" + } + Write-Output "Building machine $displayname" + platformio run 2>&1 | Select-String error,Took + Write-Output " " } # First build all the base configurations with names that do not start with add_ foreach ($filepath in Get-ChildItem -file .\Grbl_Esp32\Machines\* -Exclude add_*) { - BuildMachine($filepath.name, "") + BuildMachine($filepath.name, "") } # Then build all of the add-ons on top of a single base $base="3axis_v4.h" foreach ($filepath in Get-ChildItem -file .\Grbl_Esp32\Machines\add_*) { - BuildMachine($base, $filepath.name) + BuildMachine($base, $filepath.name) } - -$env:PLATFORMIO_BUILD_FLAGS=$envsave \ No newline at end of file +Remove-Item env:PLATFORMIO_BUILD_FLAGS diff --git a/clear-flags.ps1 b/clear-flags.ps1 new file mode 100644 index 00000000..cd4528f1 --- /dev/null +++ b/clear-flags.ps1 @@ -0,0 +1,7 @@ +# Remove the override of PLATFORMIO_BUILD_FLAGS +# This is useful if you were running build-all.ps1 and +# had to kill it with Ctrl-C, thus leaving +# PLATFORMIO_BUILD_FLAGS set to override the machine type. +# A clear-flags.sh equivalent is unnecessary, as build-all.sh +# does not set PLATFORMIO_BUILD_FLAGS globally +Remove-Item Env:PLATFORMIO_BUILD_FLAGS \ No newline at end of file