forked from letscontrolit/ESPEasy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PIO] Generate filename at build, not in post processing
Generate filename, included in the build Use post Python scripts to move files to the right directory Use post Python scripts to generate .bin.gz files.
- Loading branch information
Showing
20 changed files
with
190 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,3 +46,5 @@ tools/vagrant/Custom.h | |
.buildcache/ | ||
tools/vagrant/pio_envlist.txt | ||
|
||
build_output/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#include "CompiletimeDefines.h" | ||
|
||
#ifndef BUILD_BINARY_FILENAME | ||
// FIXME TD-er: Commented out to check if all PIO environments include the pre:tools/pio/generate-compiletime-defines.py | ||
//#define BUILD_BINARY_FILENAME "ThisIsTheDummyPlaceHolderForTheBinaryFilename64ByteLongFilenames" | ||
#endif | ||
|
||
String get_build_filename() { | ||
return F(BUILD_BINARY_FILENAME); | ||
} | ||
|
||
String get_build_time() { | ||
return __TIME__; | ||
} | ||
|
||
String get_build_date() { | ||
return __DATE__; | ||
} | ||
|
||
bool official_build() { | ||
#ifdef CONTINUOUS_INTEGRATION | ||
return true; | ||
#else | ||
return false; | ||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#ifndef HELPERS_COMPILETIMEDEFINES_H | ||
#define HELPERS_COMPILETIMEDEFINES_H | ||
|
||
#include <Arduino.h> | ||
|
||
String get_build_filename(); | ||
String get_build_time(); | ||
String get_build_date(); | ||
bool official_build(); | ||
|
||
|
||
#endif // HELPERS_COMPILETIMEDEFINES_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
|
||
Import('env') | ||
import os | ||
import shutil | ||
from datetime import date | ||
|
||
|
||
def get_build_filename(): | ||
today = date.today() | ||
d1 = today.strftime("%Y%m%d") | ||
return 'ESP_Easy_mega_{}_{}'.format(d1, env["PIOENV"]) | ||
|
||
|
||
def gen_compiletime_defines(node): | ||
""" | ||
`node.name` - a name of File System Node | ||
`node.get_path()` - a relative path | ||
`node.get_abspath()` - an absolute path | ||
""" | ||
|
||
# do not modify node if file name does not contain "CRCStruct" | ||
if "CompiletimeDefines.cpp" not in node.name: | ||
return node | ||
|
||
# now, we can override ANY SCons variables (CPPDEFINES, CCFLAGS, etc.,) for the specific file | ||
# pass SCons variables as extra keyword arguments to `env.Object()` function | ||
# p.s: run `pio run -t envdump` to see a list with SCons variables | ||
|
||
return env.Object( | ||
node, | ||
CPPDEFINES=env["CPPDEFINES"] | ||
+ [("BUILD_BINARY_FILENAME", '\"\"\"{}\"\"\"'.format(get_build_filename()))], | ||
CCFLAGS=env["CCFLAGS"] | ||
) | ||
|
||
#return node | ||
|
||
|
||
env.AddBuildMiddleware(gen_compiletime_defines) |
Oops, something went wrong.