mirror of
https://github.com/Lore09/Tesi-Magistrale.git
synced 2025-12-19 04:14:35 +00:00
project setup
This commit is contained in:
3
.env.template
Normal file
3
.env.template
Normal file
@@ -0,0 +1,3 @@
|
||||
REGISTRY_URL=
|
||||
REGISTRY_USER=
|
||||
REGISTRY_PASSWORD=
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
||||
build/*
|
||||
__pycache__/
|
||||
.env
|
||||
51
main.py
51
main.py
@@ -1,16 +1,45 @@
|
||||
import src.task_splitter.code_processor as splitter
|
||||
import src.task_splitter.code_generator as generator
|
||||
import argparse
|
||||
import src
|
||||
|
||||
input_file = "source-code/tasks.c" # Replace this with your actual file name
|
||||
output_dir = "build/"
|
||||
|
||||
functions = splitter.extract_functions_from_file(input_file)
|
||||
print(f"Found {len(functions)} functions in the file.")
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Generate, build and deploy WASM components written in go"
|
||||
)
|
||||
|
||||
generator.build_code_from_functions(functions)
|
||||
print("Code has been generated for each function.")
|
||||
subparsers = parser.add_subparsers(dest="command", help="Command list")
|
||||
|
||||
splitter.create_independent_files(functions, output_dir)
|
||||
print("Functions have been split into separate files with their own main functions.")
|
||||
parser_generate = subparsers.add_parser("gen", help="Generate Go code")
|
||||
parser_generate.add_argument("dir", type=str, help="Project directory")
|
||||
|
||||
splitter.save_functions_to_yaml(functions, output_dir + "functions.yaml")
|
||||
parser_build = subparsers.add_parser("build", help="Build WASM component")
|
||||
parser_build.add_argument("dir", type=str, help="Project directory")
|
||||
|
||||
parser_deploy = subparsers.add_parser("deploy", help="Deploy WASM components")
|
||||
parser_deploy.add_argument("dir", type=str, help="Project directory")
|
||||
|
||||
parser_all = subparsers.add_parser("crazy", help="Everything above")
|
||||
parser_all.add_argument("dir", type=str, help="Project directory")
|
||||
|
||||
# Parsing degli argomenti
|
||||
args = parser.parse_args()
|
||||
|
||||
# Setup Pelato
|
||||
pelato = src.Pelato()
|
||||
|
||||
# Esecuzione del comando specificato
|
||||
if args.command == "gen":
|
||||
pelato.generate()
|
||||
elif args.command == "build":
|
||||
pelato.build()
|
||||
elif args.command == "deploy":
|
||||
pelato.deploy()
|
||||
elif args.command == "crazy":
|
||||
pelato.generate()
|
||||
pelato.build()
|
||||
pelato.deploy()
|
||||
else:
|
||||
parser.print_help()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
from dotenv import load_dotenv
|
||||
import os
|
||||
|
||||
class Pelato:
|
||||
def __init__(self, project_dir):
|
||||
|
||||
self.project_dir = project_dir
|
||||
|
||||
self.setup_vars()
|
||||
|
||||
def setup_vars(self):
|
||||
load_dotenv()
|
||||
|
||||
self.registry_url = os.getenv('REGISTRY_URL')
|
||||
self.reg_user = os.getenv('REGISTRY_USER')
|
||||
self.reg_pass = os.getenv('REGISTRY_PASSWORD')
|
||||
|
||||
def generate(self):
|
||||
print(f"Generating Go code for project {self.project_dir}")
|
||||
|
||||
def build(self):
|
||||
print(f"Building WASM component for project {self.project_dir}")
|
||||
|
||||
def deploy(self):
|
||||
print(f"Deploying WASM components for project {self.project_dir}")
|
||||
|
||||
def all(self):
|
||||
print(f"Doing everything for project {self.project_dir}")
|
||||
0
src/code_generator/__init__.py
Normal file
0
src/code_generator/__init__.py
Normal file
0
src/component_deploy/__init__.py
Normal file
0
src/component_deploy/__init__.py
Normal file
Reference in New Issue
Block a user