Skip to content

Commit 15ed051

Browse files
authored
Update builder (#83)
* Update GH actions * Update python * CONFIG_SPI_FLASH_YIELD_DURING_ERASE=y * Use MacOS ARM * Update push.yml * Update push.yml * add lib Builder branch * add env * add comments * CONFIG_ETH_TRANSMIT_MUTEX * Fix build of build Platformio manifest (fail in second run) * fix manifest script build error * rm outdated code * don't know why it needs to be restored?!? * Build Pio framework manifest (#78) * Update build.sh * Update gen_pio_frmwk_manifest.py * Delete core_version.h * generate core version.h * Update build.sh
1 parent 6b1ee5a commit 15ed051

10 files changed

+116
-38
lines changed

.github/workflows/push.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ on:
55
jobs:
66
build-libs:
77
name: Build Arduino Libs
8-
runs-on: ubuntu-22.04
8+
runs-on: macos-14
99
steps:
1010
- uses: actions/checkout@v4
1111
- name: Set up Python

core_version.h

-4
This file was deleted.

package.json

-17
This file was deleted.

tools/archive-build.sh

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/bin/bash
22

3-
IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD || echo "")
4-
IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD || echo "")
53
idf_version_string=${IDF_BRANCH//\//_}"-$IDF_COMMIT"
64

75
archive_path="dist/arduino-esp32-libs-$idf_version_string.tar.gz"

tools/config.sh

+12-7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ if [ -z $IDF_PATH ]; then
66
fi
77

88
if [ -z $IDF_BRANCH ]; then
9-
IDF_BRANCH="release/v5.1"
9+
export IDF_BRANCH="release/v5.1"
1010
fi
1111

1212
# Arduino branch to use
@@ -60,17 +60,20 @@ TOOLS_JSON_OUT="$AR_TOOLS/esp32-arduino-libs"
6060
IDF_LIBS_DIR="$AR_ROOT/../esp32-arduino-libs"
6161

6262
if [ "$IDF_COMMIT" ]; then
63-
echo "Using IDF commit $IDF_COMMIT"
6463
export IDF_COMMIT
65-
elif [ -d "$IDF_PATH" ]; then
66-
export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD)
67-
export IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD)
6864
fi
6965

66+
if [ -d "$IDF_PATH" ]; then
67+
export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD)
68+
fi
69+
70+
echo "Using IDF branch $IDF_BRANCH"
71+
echo "Using IDF commit $IDF_COMMIT"
72+
7073
if [ "$AR_COMMIT" ]; then
71-
echo "Using commit $AR_COMMIT for Arduino"
74+
echo "Using Arduino commit $AR_COMMIT"
7275
else
73-
AR_COMMIT=$(git -C "$AR_COMPS/arduino" rev-parse --short HEAD || echo "")
76+
export AR_COMMIT=$(git -C "$AR_COMPS/arduino" rev-parse --short HEAD || echo "")
7477
fi
7578

7679
#rm -rf release-info.txt
@@ -103,6 +106,7 @@ function get_os(){
103106
AR_OS=`get_os`
104107

105108
export SED="sed"
109+
export AWK="awk"
106110
export SSTAT="stat -c %s"
107111

108112
if [[ "$AR_OS" == "macos" ]]; then
@@ -115,6 +119,7 @@ if [[ "$AR_OS" == "macos" ]]; then
115119
exit 1
116120
fi
117121
export SED="gsed"
122+
export AWK="gawk"
118123
export SSTAT="stat -f %z"
119124
fi
120125

tools/gen_pio_frmwk_manifest.py

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import argparse
2+
import json
3+
import os
4+
import re
5+
import sys
6+
7+
MANIFEST_DATA = {
8+
"name": "framework-arduinoespressif32",
9+
"description": "Platformio Tasmota Arduino framework for the Espressif ESP32 series of SoCs",
10+
"keywords": ["framework", "tasmota", "arduino", "espressif", "esp32"],
11+
"license": "LGPL-2.1-or-later",
12+
"repository": {
13+
"type": "git",
14+
"url": "https://github.com/tasmota/arduino-esp32",
15+
},
16+
}
17+
18+
19+
def convert_version(version_string):
20+
"""A helper function that converts a custom IDF version string
21+
extracted from a Git repository to a suitable SemVer alternative. For example:
22+
'release/v5.1' becomes '5.1.0',
23+
'v7.7.7' becomes '7.7.7'
24+
"""
25+
26+
regex_pattern = (
27+
r"v(?P<MAJOR>0|[1-9]\d*)\.(?P<MINOR>0|[1-9]\d*)\.*(?P<PATCH>0|[1-9]\d*)*"
28+
)
29+
match = re.search(regex_pattern, version_string)
30+
if not match:
31+
sys.stderr.write(
32+
f"Failed to find a regex match for '{regex_pattern}' in '{version_string}'\n"
33+
)
34+
return ""
35+
36+
major, minor, patch = match.groups()
37+
if not patch:
38+
patch = "0"
39+
40+
return ".".join((major, minor, patch))
41+
42+
43+
def main(dst_dir, version_string, commit_hash):
44+
45+
converted_version = convert_version(version_string)
46+
if not converted_version:
47+
sys.stderr.write(f"Failed to convert version '{version_string}'\n")
48+
return -1
49+
50+
manifest_file_path = os.path.join(dst_dir, "package.json")
51+
with open(manifest_file_path, "w", encoding="utf8") as fp:
52+
MANIFEST_DATA["version"] = f"{converted_version}+sha.{commit_hash}"
53+
json.dump(MANIFEST_DATA, fp, indent=2)
54+
55+
print(
56+
f"Generated PlatformIO framework manifest file '{manifest_file_path}' with '{converted_version}' version"
57+
)
58+
return 0
59+
60+
61+
if __name__ == "__main__":
62+
parser = argparse.ArgumentParser()
63+
parser.add_argument(
64+
"-o",
65+
"--dst-dir",
66+
dest="dst_dir",
67+
required=True,
68+
help="Destination folder where the 'package.json' manifest will be located",
69+
)
70+
parser.add_argument(
71+
"-s",
72+
"--version-string",
73+
dest="version_string",
74+
required=True,
75+
help="ESP-IDF version string used for compiling libraries",
76+
)
77+
parser.add_argument(
78+
"-c",
79+
"--commit-hash",
80+
dest="commit_hash",
81+
required=True,
82+
help="ESP-IDF revision in form of a commit hash",
83+
)
84+
args = parser.parse_args()
85+
86+
sys.exit(main(args.dst_dir, args.version_string, args.commit_hash))

tools/gen_platformio_manifest.py renamed to tools/gen_pio_lib_manifest.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
MANIFEST_DATA = {
88
"name": "framework-arduinoespressif32-libs",
99
"description": "Precompiled libraries for Arduino Wiring-based Framework for the Espressif ESP32 series of SoCs",
10-
"keywords": ["framework", "arduino", "espressif", "esp32"],
10+
"keywords": ["framework", "tasmota", "arduino", "espressif", "esp32"],
1111
"license": "LGPL-2.1-or-later",
1212
"repository": {
1313
"type": "git",
@@ -53,7 +53,7 @@ def main(dst_dir, version_string, commit_hash):
5353
json.dump(MANIFEST_DATA, fp, indent=2)
5454

5555
print(
56-
f"Generated PlatformIO manifest file '{manifest_file_path}' with '{converted_version}' version"
56+
f"Generated PlatformIO libraries manifest file '{manifest_file_path}' with '{converted_version}' version"
5757
)
5858
return 0
5959

tools/gen_tools_json.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
if tool_name.endswith('-elf'):
6060
tool_name += '-gcc'
6161
print('Found {0}, version: {1}'.format(tool_name, tool_version))
62-
62+
6363
if simple_output == False:
6464
dep_found = False
6565
dep_skip = False

tools/install-esp-idf.sh

-2
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,6 @@ fi
6363
if [ ! -x $idf_was_installed ] || [ ! -x $commit_predefined ]; then
6464
git submodule update --recursive
6565
$IDF_PATH/install.sh
66-
export IDF_COMMIT=$(git -C "$IDF_PATH" rev-parse --short HEAD)
67-
export IDF_BRANCH=$(git -C "$IDF_PATH" symbolic-ref --short HEAD || git -C "$IDF_PATH" tag --points-at HEAD)
6866

6967
# Temporarily patch the ESP32-S2 I2C LL driver to keep the clock source
7068
cd $IDF_PATH

tools/prepare-ci.sh

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
#!/bin/bash
22

3-
sudo apt-get install -y gperf cmake ninja-build
4-
pip3 install wheel future pyelftools
3+
# Ubuntu setup
4+
# Change in archive-build.sh gawk to awk
5+
#sudo apt-get install -y gperf cmake ninja-build
6+
#pip3 install wheel future pyelftools
7+
8+
# MacOS (ARM) setup
9+
# Change in archive-build.sh awk to gawk
10+
brew install gsed
11+
brew install gawk
12+
brew install gperf
13+
brew install ninja
14+
brew install ccache
15+
python -m pip install --upgrade pip
16+
pip install wheel future pyelftools

0 commit comments

Comments
 (0)