diff options
| author | Amlal El Mahrouss <amlal@nekernel.org> | 2025-04-21 08:47:04 +0200 |
|---|---|---|
| committer | Amlal El Mahrouss <amlal@nekernel.org> | 2025-04-21 08:47:04 +0200 |
| commit | 00e314410e6049c2ddbcb4861c04af6b06eeeea3 (patch) | |
| tree | be4ee060de121ac0b825b5b0263deb3a0ac74619 /tooling/mk_app.py | |
| parent | f00211b6023ad406553a6bf9208092f834a44cdd (diff) | |
dev, kernel, tools, tooling, tex: add mk_app tool, see details.
- Patch HeFS implementation file, working on a allocation
function now.
- Generated LaTeX specs from source code.
- Add mk.{hefs, nefs} tools for future formatting (with diutil
first)
- Add python tool to generate user apps for NeKernel.
Signed-off-by: Amlal El Mahrouss <amlal@nekernel.org>
Diffstat (limited to 'tooling/mk_app.py')
| -rwxr-xr-x | tooling/mk_app.py | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/tooling/mk_app.py b/tooling/mk_app.py new file mode 100755 index 00000000..34a7702e --- /dev/null +++ b/tooling/mk_app.py @@ -0,0 +1,67 @@ +#! /usr/bin/env python3 +# -*- coding: utf-8 -*- + +import os +import json +import sys + +def create_directory_structure(base_path, project_name): + # Define the directory structure + structure = { + project_name: { + "src": { + ".keep": None + }, + "vendor": { + ".keep": None + }, + ".keep": None, + f"{project_name}.json": {} + } + } + + def create_structure(path, structure): + for name, content in structure.items(): + current_path = os.path.join(path, name) + # Create directories or files based on the content type + if isinstance(content, dict) and current_path.endswith(".json") == False: + os.makedirs(current_path, exist_ok=True) + create_structure(current_path, content) + elif content is None: + # Create an empty file + with open(current_path, 'w') as f: + pass + + # Create the base directory + os.makedirs(base_path, exist_ok=True) + create_structure(base_path, structure) + + # Create the JSON file + diutil_json_path = os.path.join(base_path, project_name, f"{project_name}.json") + manifest = { + "compiler_path": "g++", + "compiler_std": "c++20", + "headers_path": ["./", "../../../dev/kernel", "../../../public/frameworks/", "../../../dev/", "./"], + "sources_path": [ + + ], + "output_name": f"./dist/{project_name}", + "cpp_macros": [ + "kSampleVersion=0x0100", + "kSampleVersionHighest=0x0100", + "kSampleVersionLowest=0x0100", + "__NE_SDK__" + ] + } + + with open(diutil_json_path, 'w') as json_file: + json.dump(manifest, json_file, indent=4) + +if __name__ == "__main__": + if len(sys.argv) != 2: + print("Usage: mk_app.py <project_name>") + sys.exit(1) + + base_path = os.getcwd() # Use the current working directory as the base path + create_directory_structure(base_path, sys.argv[1]) + print("Ne application created successfully.")
\ No newline at end of file |
