Skip to content

Commit

Permalink
new docker container
Browse files Browse the repository at this point in the history
  • Loading branch information
RCMast3r committed Dec 25, 2023
1 parent 9472774 commit 091655e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 22 deletions.
35 changes: 14 additions & 21 deletions generator/pio_lib_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import subprocess

import docker
import SCons.Action
from platformio import fs

Expand All @@ -22,33 +23,25 @@
generated_src_dir = os.path.join(build_dir, 'dbcppp', 'generated-src')
generated_build_dir = os.path.join(build_dir, 'dbcppp', 'generated-build')

def install_dbcppp():
try:
print(subprocess.Popen(["./install-dbcppp.sh"], stdout=subprocess.PIPE))
except OSError as error:
print("ERROR occured while trying to install dep")
try:
subprocess.Popen(["cmake"], stdout = subprocess.PIPE)
print("you have cmake installed")
except OSError as error:
print("ERROR install cmake")

try:
subprocess.Popen([build_dir+"/dbcppp-bin/dbcppp"], stdout = subprocess.PIPE)
except OSError as error:
print("[pio_lib_gen] Installing dependencies");
install_dbcppp()



user_dbc_file = env.subst(env.GetProjectOption("user_dbc", ""))
dbc_file = fs.match_src_files(project_dir, user_dbc_file)
dir_dbc_path = os.path.dirname(os.path.realpath(user_dbc_file))
rel_dir_dbc_path = os.path.dirname(dbc_file[0])

dbc_file_name = os.path.basename(dbc_file[0])

if not len(dbc_file):
print("[nanopb] ERROR: No file matched pattern:")
print(f"user_dbcs: {user_dbc_file}")
exit(1)

print(subprocess.Popen(["docker run --rm -v "+dir_dbc_path+":/app/data /app/build/dbcppp /app/data/"+os.path.basename(dbc_file)], stdout=subprocess.PIPE))
print("yo")
print(user_dbc_file)

abs_path_to_dbc = project_dir+'/'+rel_dir_dbc_path

print(abs_path_to_dbc)
print(generated_src_dir)
client = docker.from_env()
client.containers.run('ghcr.io/rcmast3r/dbcppp:main', './gen_cpp.sh', volumes=[abs_path_to_dbc+":/data", os.getcwd()+":/work_dir", generated_src_dir+":/out"], working_dir='/work_dir')

print("hello from lib2")
2 changes: 1 addition & 1 deletion third-party/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ RUN apt-get update && apt-get install -y \

# Copy the CMake project files into the container
RUN git clone --recurse-submodules https://github.com/xR3b0rn/dbcppp.git /app

# Set working directory
WORKDIR /app
RUN git checkout v3.2.6

# Build the CMake project
RUN mkdir build && cd build && cmake .. && make -j && make install && ldconfig
Expand Down

0 comments on commit 091655e

Please sign in to comment.