mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-12 01:53:07 +03:00
Add Win32 build to CI system (#6493)
Build a single INO under a Windows VM on Travis to ensure that the Win32 toolchain works properly. In build.py, instead of making a string with spaces and then splitting on " ", just make the list itself with individual parameters. This will allow spaces in paths to be supported properly.
This commit is contained in:
committed by
GitHub
parent
4f74ed8408
commit
1f86311d79
@ -24,28 +24,42 @@ from __future__ import print_function
|
||||
import sys
|
||||
import os
|
||||
import argparse
|
||||
import platform
|
||||
import subprocess
|
||||
import tempfile
|
||||
import shutil
|
||||
|
||||
|
||||
# Arduino-builder needs forward-slash paths for passed in params or it cannot
|
||||
# launch the needed toolset.
|
||||
def windowsize_paths(l):
|
||||
"""Convert forward-slash paths to backslash paths referenced from C:"""
|
||||
out = []
|
||||
for i in l:
|
||||
if i.startswith('/'):
|
||||
i = 'C:' + i
|
||||
out += [i.replace('/', '\\')]
|
||||
return out
|
||||
|
||||
def compile(tmp_dir, sketch, cache, tools_dir, hardware_dir, ide_path, f, args):
|
||||
cmd = ide_path + '/arduino-builder '
|
||||
cmd += '-compile -logger=human '
|
||||
cmd += '-build-path "' + tmp_dir + '" '
|
||||
cmd += '-tools "' + ide_path + '/tools-builder" '
|
||||
cmd = []
|
||||
cmd += [ide_path + '/arduino-builder']
|
||||
cmd += ['-compile', '-logger=human']
|
||||
cmd += ['-build-path', tmp_dir]
|
||||
cmd += ['-tools', ide_path + '/tools-builder']
|
||||
if cache != "":
|
||||
cmd += '-build-cache "' + cache + '" '
|
||||
cmd += ['-build-cache', cache ]
|
||||
if args.library_path:
|
||||
for lib_dir in args.library_path:
|
||||
cmd += '-libraries "' + lib_dir + '" '
|
||||
cmd += '-hardware "' + ide_path + '/hardware" '
|
||||
cmd += ['-libraries', lib_dir]
|
||||
cmd += ['-hardware', ide_path + '/hardware']
|
||||
if args.hardware_dir:
|
||||
for hw_dir in args.hardware_dir:
|
||||
cmd += '-hardware "' + hw_dir + '" '
|
||||
cmd += ['-hardware', hw_dir]
|
||||
else:
|
||||
cmd += '-hardware "' + hardware_dir + '" '
|
||||
cmd += ['-hardware', hardware_dir]
|
||||
# Debug=Serial,DebugLevel=Core____
|
||||
cmd += '-fqbn=esp8266com:esp8266:{board_name}:' \
|
||||
fqbn = '-fqbn=esp8266com:esp8266:{board_name}:' \
|
||||
'xtal={cpu_freq},' \
|
||||
'FlashFreq={flash_freq},' \
|
||||
'FlashMode={flash_mode},' \
|
||||
@ -54,20 +68,22 @@ def compile(tmp_dir, sketch, cache, tools_dir, hardware_dir, ide_path, f, args):
|
||||
'ip={lwIP},' \
|
||||
'ResetMethod=nodemcu'.format(**vars(args))
|
||||
if args.debug_port and args.debug_level:
|
||||
cmd += 'dbg={debug_port},lvl={debug_level}'.format(**vars(args))
|
||||
cmd += ' '
|
||||
cmd += '-built-in-libraries "' + ide_path + '/libraries" '
|
||||
cmd += '-ide-version=10607 '
|
||||
cmd += '-warnings={warnings} '.format(**vars(args))
|
||||
fqbn += 'dbg={debug_port},lvl={debug_level}'.format(**vars(args))
|
||||
cmd += [fqbn]
|
||||
cmd += ['-built-in-libraries', ide_path + '/libraries']
|
||||
cmd += ['-ide-version=10607']
|
||||
cmd += ['-warnings={warnings}'.format(**vars(args))]
|
||||
if args.verbose:
|
||||
cmd += '-verbose '
|
||||
cmd += sketch
|
||||
cmd += ['-verbose']
|
||||
cmd += [sketch]
|
||||
|
||||
if platform.system() == "Windows":
|
||||
cmd = windowsize_paths(cmd)
|
||||
|
||||
if args.verbose:
|
||||
print('Building: ' + cmd, file=f)
|
||||
print('Building: ' + " ".join(cmd), file=f)
|
||||
|
||||
cmds = cmd.split(' ')
|
||||
p = subprocess.Popen(cmds, stdout=f, stderr=subprocess.STDOUT)
|
||||
p = subprocess.Popen(cmd, stdout=f, stderr=subprocess.STDOUT)
|
||||
p.wait()
|
||||
return p.returncode
|
||||
|
||||
@ -127,6 +143,7 @@ def main():
|
||||
hardware_dir = os.path.dirname(os.path.realpath(__file__)) + '/../cores'
|
||||
|
||||
output_name = tmp_dir + '/' + os.path.basename(sketch_path) + '.bin'
|
||||
|
||||
if args.verbose:
|
||||
print("Sketch: ", sketch_path)
|
||||
print("Build dir: ", tmp_dir)
|
||||
|
Reference in New Issue
Block a user