Skip to content

Commit c776fe0

Browse files
committed
Add Vagrant build option
1 parent 430f10a commit c776fe0

File tree

7 files changed

+187
-11
lines changed

7 files changed

+187
-11
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,5 @@
55
.vscode/ipch
66

77
.vscode/
8+
9+
tools/vagrant/.vagrant/

platformio.ini

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,14 @@ platform = https://github.com/platformio/platform-espressif8266
5555
build_flags = ${esp82xx_2_6_x.build_flags} -DARDUINO_ESP8266_RELEASE='"2.6.0-dev stage"'
5656

5757

58-
[core_2_6_1_wifimesh]
58+
[core_2_6_2_packages]
5959
platform = espressif8266
6060
platform_packages =
61-
framework-arduinoespressif8266 @ https://github.com/TD-er/Arduino.git#wifi_mesh_update_2.2
61+
framework-arduinoespressif8266 @ https://github.com/esp8266/Arduino.git#2.6.2
6262
build_flags = ${esp82xx_2_6_x.build_flags}
6363
-DPIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x_190703
6464

65+
6566
[common]
6667
board_build.f_cpu = 80000000L
6768
build_flags = -DHTTPCLIENT_1_1_COMPATIBLE=0
@@ -99,11 +100,11 @@ build_unflags =
99100
build_flags = ${core_stage.build_flags} ${common.build_flags}
100101
platform = ${core_stage.platform}
101102

102-
[mesh_platform]
103+
[packages_platform]
103104
build_unflags =
104-
build_flags = ${core_2_6_1_wifimesh.build_flags} ${common.build_flags}
105-
platform = ${core_2_6_1_wifimesh.platform}
106-
platform_packages = ${core_2_6_1_wifimesh.platform_packages}
105+
build_flags = ${core_2_6_2_packages.build_flags} ${common.build_flags}
106+
platform = ${core_2_6_2_packages.platform}
107+
platform_packages = ${core_2_6_2_packages.platform_packages}
107108

108109

109110

@@ -124,11 +125,11 @@ build_flags = ${esp8266_4M1M.build_flags} ${beta_platform.build_fl
124125
lib_ignore = ESP32_ping, ESP32WebServer, IRremoteESP8266, HeatpumpIR, SD(esp8266), SDFS
125126
extra_scripts = pre:pre_extra_script_mcve.py
126127

127-
[env:spec_wifimesh_ESP8266_4M1M]
128-
platform = ${mesh_platform.platform}
129-
platform_packages = ${mesh_platform.platform_packages}
128+
[env:Failing_platform_ESP8266_4M1M]
129+
platform = ${packages_platform.platform}
130+
platform_packages = ${packages_platform.platform_packages}
130131
extends = esp8266_4M1M
131-
build_unflags = ${esp8266_4M1M.build_unflags} ${mesh_platform.build_unflags}
132-
build_flags = ${esp8266_4M1M.build_flags} ${mesh_platform.build_flags} -DPLUGIN_BUILD_CUSTOM
132+
build_unflags = ${esp8266_4M1M.build_unflags} ${packages_platform.build_unflags}
133+
build_flags = ${esp8266_4M1M.build_flags} ${packages_platform.build_flags} -DPLUGIN_BUILD_CUSTOM
133134
lib_ignore = ESP32_ping, ESP32WebServer, IRremoteESP8266, HeatpumpIR, SD(esp8266), SDFS
134135
extra_scripts = pre:pre_extra_script_mcve.py

tools/vagrant/README.txt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Installing Vagrant:
2+
3+
Vagrantup.com site: https://www.vagrantup.com/docs/installation/
4+
VirtualBox: https://www.virtualbox.org/
5+
6+
Great tutorial: https://www.sitepoint.com/getting-started-vagrant-windows/
7+
8+
9+
10+
You can also provide a Custom.h file in this directory, next to the Vagrantfile.
11+
See src/Custom-sample.h for an example.
12+
13+
After installing Vagrant and VirtualBox, open a shell in the tools/vagrant folder.
14+
Run:
15+
vagrant up
16+
17+
To halt the VM, type:
18+
vagrant halt

tools/vagrant/Vagrantfile

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#GIT_REPO = 'https://github.com/letscontrolit/ESPEasy.git'
2+
#GIT_DIR = ~/GitHub/letscontrolit/ESPEasy
3+
4+
5+
# -*- mode: ruby -*-
6+
# vi: set ft=ruby :
7+
8+
# All Vagrant configuration is done below. The "2" in Vagrant.configure
9+
# configures the configuration version (we support older styles for
10+
# backwards compatibility). Please don't change it unless you know what
11+
# you're doing.
12+
Vagrant.configure("2") do |config|
13+
# The most common configuration options are documented and commented below.
14+
# For a complete reference, please see the online documentation at
15+
# https://docs.vagrantup.com.
16+
17+
# Every Vagrant development environment requires a box. You can search for
18+
# boxes at https://vagrantcloud.com/search.
19+
config.vm.box = "bento/ubuntu-18.04"
20+
21+
# Disable automatic box update checking. If you disable this, then
22+
# boxes will only be checked for updates when the user runs
23+
# `vagrant box outdated`. This is not recommended.
24+
# config.vm.box_check_update = false
25+
26+
# Create a forwarded port mapping which allows access to a specific port
27+
# within the machine from a port on the host machine. In the example below,
28+
# accessing "localhost:8080" will access port 80 on the guest machine.
29+
# NOTE: This will enable public access to the opened port
30+
# config.vm.network "forwarded_port", guest: 80, host: 8080
31+
32+
# Create a forwarded port mapping which allows access to a specific port
33+
# within the machine from a port on the host machine and only allow access
34+
# via 127.0.0.1 to disable public access
35+
# config.vm.network "forwarded_port", guest: 80, host: 8080, host_ip: "127.0.0.1"
36+
37+
# Create a private network, which allows host-only access to the machine
38+
# using a specific IP.
39+
# config.vm.network "private_network", ip: "192.168.33.10"
40+
41+
# Create a public network, which generally matched to bridged network.
42+
# Bridged networks make the machine appear as another physical device on
43+
# your network.
44+
# config.vm.network "public_network"
45+
46+
# Share an additional folder to the guest VM. The first argument is
47+
# the path on the host to the actual folder. The second argument is
48+
# the path on the guest to mount the folder. And the optional third
49+
# argument is a set of non-required options.
50+
# config.vm.synced_folder "../data", "/vagrant_data"
51+
52+
# Provider-specific configuration so you can fine-tune various
53+
# backing providers for Vagrant. These expose provider-specific options.
54+
# Example for VirtualBox:
55+
#
56+
# config.vm.provider "virtualbox" do |vb|
57+
# # Display the VirtualBox GUI when booting the machine
58+
# vb.gui = true
59+
#
60+
# # Customize the amount of memory on the VM:
61+
# vb.memory = "1024"
62+
# end
63+
#
64+
# View the documentation for the provider you are using for more
65+
# information on available options.
66+
67+
# Enable provisioning with a shell script. Additional provisioners such as
68+
# Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
69+
# documentation for more information about their specific syntax and use.
70+
config.vm.provision "shell", inline: <<-SHELL
71+
apt-get update
72+
apt-get install -y python-minimal virtualenv build-essential zip binutils
73+
SHELL
74+
# Clone the repo as the default user. (privileged: false)
75+
config.vm.provision "shell", run: "always", privileged: false do |s|
76+
# replace Windows line endings with Unix line endings
77+
s.inline = "sed 's/\r$//g' /vagrant/bootstrap.sh > ~/bootstrap.sh; /bin/bash --login ~/bootstrap.sh"
78+
end
79+
end

tools/vagrant/bootstrap.sh

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
VENV=~/.venv/python2.7
2+
SRC=~/GitHub/TD-er/MCVE_ESPxx
3+
REPO=https://github.com/TD-er/MCVE_ESPxx.git
4+
BRANCH=mega
5+
6+
PIO_BUILDENV=Failing_platform_ESP8266_4M1M
7+
8+
PULL_REQ=0
9+
DESCRIPTION=""
10+
11+
VAGRANT_FOLDER="/vagrant"
12+
BUILD_FOLDER=`echo "${VAGRANT_FOLDER}/build"`
13+
CUSTOM_H_FILE="Custom.h"
14+
ENV_LIST_FILE="pio_envlist.txt"
15+
16+
while getopts p:d: option
17+
do
18+
case "${option}"
19+
in
20+
p)
21+
# get a specific pull request
22+
PULL_REQ=${OPTARG}
23+
;;
24+
d) DESCRIPTION=${OPTARG};;
25+
esac
26+
done
27+
28+
29+
30+
# If virtualenv does not exist, make it.
31+
if [ ! -d ${VENV} ]; then
32+
mkdir -p ${VENV}
33+
virtualenv -p python2.7 ${VENV}
34+
fi
35+
36+
# if repository directory does not exist, make it and clone repository
37+
if [ ! -d ${SRC} ]; then
38+
mkdir -p ${SRC}
39+
git clone --depth=50 --branch=${BRANCH} ${REPO} ${SRC}
40+
fi
41+
42+
# Activate Python virtual environment and install/upgrade packages
43+
source ${VENV}/bin/activate
44+
pip install -U platformio
45+
#pip install -r ${SRC}/docs/requirements.txt
46+
47+
48+
# Update platformio
49+
cd ${SRC}
50+
platformio update
51+
52+
VAGRANT_CUSTOM_H_FILE=`echo "${VAGRANT_FOLDER}/${CUSTOM_H_FILE}"`
53+
VAGRANT_PIO_ENVLIST_FILE=`echo "${VAGRANT_FOLDER}/${ENV_LIST_FILE}"`
54+
SRC_CUSTOM_H_FILE=`echo "${SRC}/src/${CUSTOM_H_FILE}"`
55+
SRC_PIO_ENVLIST_FILE=`echo "${SRC}/src/${ENV_LIST_FILE}"`
56+
if [ -f ${VAGRANT_CUSTOM_H_FILE} ]; then
57+
# replace Windows line endings with Unix line endings
58+
sed 's/\r$//g' ${VAGRANT_CUSTOM_H_FILE} > ${SRC_CUSTOM_H_FILE}
59+
echo "Copy ${VAGRANT_CUSTOM_H_FILE} > ${SRC_CUSTOM_H_FILE}"
60+
fi
61+
if [ -f ${VAGRANT_PIO_ENVLIST_FILE} ]; then
62+
# replace Windows line endings with Unix line endings
63+
sed 's/\r$//g' ${VAGRANT_PIO_ENVLIST_FILE} > ${SRC_PIO_ENVLIST_FILE}
64+
input=`echo "${SRC_PIO_ENVLIST_FILE}"`
65+
while IFS= read -r line
66+
do
67+
PLATFORMIO_BUILD_FLAGS="-D CONTINUOUS_INTEGRATION" platformio run -e $line
68+
done < "$input"
69+
else
70+
# Build custom_ESP8266_4M target in the platformio.ini file
71+
PLATFORMIO_BUILD_FLAGS="-D CONTINUOUS_INTEGRATION" platformio run -e ${PIO_BUILDENV}
72+
fi

tools/vagrant/pio_envlist.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
MCVE_ESP8266_4M1M
2+
Failing_platform_ESP8266_4M1M

tools/vagrant/pio_envlist.txt.sample

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
MCVE_ESP8266_4M1M
2+
Failing_platform_ESP8266_4M1M

0 commit comments

Comments
 (0)