Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scons generate dbc files #1329

Closed
wants to merge 9 commits into from

Conversation

bongbui321
Copy link
Contributor

@bongbui321 bongbui321 commented Oct 2, 2024

resolve #1309

SConstruct Outdated Show resolved Hide resolved
opendbc/dbc/generator/SConscript Outdated Show resolved Hide resolved
@adeebshihadeh adeebshihadeh marked this pull request as draft October 3, 2024 17:38
@bongbui321
Copy link
Contributor Author

Abstracted out the fuzzy find for generators in generator.py into two functions to be used to declare targets and build sources (python generator + source dbc files) within SConscript

@bongbui321 bongbui321 marked this pull request as ready for review October 4, 2024 13:43
from opendbc.dbc.generator.generator import (generated_suffix, generator_path, opendbc_root, \
get_python_generator_scripts, get_source_dbc_files)
Import('env')

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks way too complicated. why not just glob everything in generator/*?

Copy link
Contributor Author

@bongbui321 bongbui321 Oct 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not all .dbc within generator dir being the sources for the generated DBCs :(

if filename.startswith('_') or not filename.endswith('.dbc'):
)

glob.glob(f"{generated_path//.dbc}" with added conditional statements and replacing the .dbc suffix with _generated.dbc would be the same as what you referenced. All generated dbcs will be put into generator/../ while the source dbc could be from anywhere within the generator path

it's easier abstract out the search functions to get the paths to generated dbcs, and to delete them when run with scons -c

for f in glob.glob(f"{generator_path}/*/*.py"):
subprocess.check_call(f)

def get_source_dbc_files(generator_path: str) -> defaultdict[str, list[str]]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, shouldn't need to touch this script

opendbc/dbc/generator/SConscript Outdated Show resolved Hide resolved
@bongbui321 bongbui321 closed this Oct 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build generated DBCs with SCons
2 participants