Compare commits
13 Commits
620ad5425a
...
d01497ee93
Author | SHA1 | Date | |
---|---|---|---|
![]() |
d01497ee93 | ||
![]() |
e1ff513d03 | ||
f15cc23ab0 | |||
239194abf5 | |||
56a3891b99 | |||
4fff24ea42 | |||
![]() |
b2268129be | ||
![]() |
077e9d050f | ||
![]() |
05bc0da89e | ||
792c4e102a | |||
5db772df02 | |||
ea2f35ce8c | |||
1ddccb7c1b |
71
CODE_OF_CONDUCT.md
Normal file
71
CODE_OF_CONDUCT.md
Normal file
@@ -0,0 +1,71 @@
|
||||
# Code of Conduct - Architectural Standards
|
||||
|
||||
## Our Pledge
|
||||
In the interest of fostering a clear and consistent development environment, we pledge to maintain architectural integrity across all programming languages and implementations within this project.
|
||||
|
||||
## Fundamental Principle
|
||||
- **Architectural names remain consistent and unchanging regardless of programming language implementation. Whether written in Python, Java, C++, or any other language, the architectural pattern's name and core principles remain identical and immutable.**
|
||||
|
||||
## Our Standards
|
||||
|
||||
### Architectural Consistency
|
||||
We recognize that architectural patterns and their nomenclature remain constant regardless of the programming language used for implementation. This means:
|
||||
|
||||
1. Architectural pattern names shall remain consistent across all programming languages
|
||||
2. The fundamental principles of each architectural pattern shall be preserved regardless of implementation
|
||||
3. Documentation must reference architectural patterns using their standard industry names
|
||||
|
||||
### Examples of Name Preservation
|
||||
- A **Repository Pattern** remains a "Repository Pattern" whether implemented in:
|
||||
- Java
|
||||
- Python
|
||||
- C#
|
||||
- JavaScript
|
||||
- Go
|
||||
- Any other programming language
|
||||
|
||||
- An **Event Sourcing** architecture remains "Event Sourcing" whether built in:
|
||||
- Rust
|
||||
- Kotlin
|
||||
- TypeScript
|
||||
- PHP
|
||||
- Any other technology stack
|
||||
|
||||
- **Regardless of the programming language used, the name ‘Bellande’ remains consistent across all architectures and code**
|
||||
|
||||
### Implementation Guidelines
|
||||
1. When implementing architectural patterns:
|
||||
- Always use the standard architectural name
|
||||
- Never rename patterns based on language preferences
|
||||
- Document implementations using consistent architectural terminology
|
||||
- Maintain pattern names even when adapting to language-specific features
|
||||
|
||||
2. Code organization must:
|
||||
- Use standard architectural pattern names in all documentation
|
||||
- Maintain consistent naming across different services/modules
|
||||
- Reflect the chosen architecture's established terminology
|
||||
- Preserve architectural names in comments and documentation
|
||||
|
||||
## Enforcement
|
||||
Project maintainers are responsible for:
|
||||
1. Enforcing consistent architectural naming across all implementations
|
||||
2. Reviewing code to ensure architectural pattern names remain standard
|
||||
3. Providing guidance on proper architectural pattern naming
|
||||
4. Maintaining documentation that reflects these naming standards
|
||||
|
||||
## Questions and Clarifications
|
||||
If you have questions about:
|
||||
- How to properly name architectural patterns in your implementation
|
||||
- Whether your naming conventions align with architectural standards
|
||||
- How to maintain naming consistency across different services
|
||||
|
||||
Please reach out to the project maintainers or consult the architecture documentation.
|
||||
|
||||
## Version and Updates
|
||||
- Version: 1.0
|
||||
- Last Updated: October 26, 2024
|
||||
|
||||
This Code of Conduct is a living document and may be updated to better serve the project's needs while maintaining its core principle of architectural naming consistency.
|
||||
|
||||
## Organization Code of Conduct
|
||||
The latest uptodate Code of Conduct will be distributed under the [CODE_OF_CONDUCT](https://github.com/Architecture-Mechanism/CODE_OF_CONDUCT)
|
13
README.md
13
README.md
@@ -1,7 +1,10 @@
|
||||
# Bellande Rust Executable
|
||||
|
||||
## Bellande Rust Executable is a library that makes rust code into an executable (BRE) library
|
||||
|
||||
- "-d", "--dep-file", required=True, help="Path to the dependencies file (dependencies.bellande)"
|
||||
- "-s", "--src-dir", required=True, help="Source directory containing Rust files"
|
||||
- "-m", "--main-file", required=True, help="Main Rust file name (e.g., main.rs)"
|
||||
- "-o", "--output", required=True, help="Output path for the compiled executable"
|
||||
|
||||
## Website PYPI
|
||||
- https://pypi.org/project/bellande_rust_executable
|
||||
@@ -14,16 +17,16 @@
|
||||
|
||||
```
|
||||
Name: bellande_rust_executable
|
||||
Version: 0.1.0
|
||||
Summary: File type Formats
|
||||
Home-page: github.com/RonaldsonBellande/bellande_rust_executable
|
||||
Author: Ronaldson Bellande
|
||||
Author-email: ronaldsonbellande@gmail.com
|
||||
License: GNU General Public License v3.0
|
||||
Requires: numpy
|
||||
Required-by:
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
Bellande Rust Executable Packages is distributed under the [GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.en.html), see [LICENSE](https://github.com/Algorithm-Model-Research/bellande_rust_executable/blob/main/LICENSE) and [NOTICE](https://github.com/Algorithm-Model-Research/bellande_rust_executable/blob/main/LICENSE) for more information.
|
||||
Bellande Rust Executable Packages is distributed under the [GNU General Public License v3.0](https://www.gnu.org/licenses/gpl-3.0.en.html), see [LICENSE](https://github.com/Architecture-Mechanism/bellande_rust_executable/blob/main/LICENSE) and [NOTICE](https://github.com/Architecture-Mechanism/bellande_rust_executable/blob/main/LICENSE) for more information.
|
||||
|
||||
## Code of Conduct
|
||||
Bellande Rust Executable Packages is distributed under the [CODE_OF_CONDUCT](https://github.com/Architecture-Mechanism/bellande_rust_executable/blob/main/CODE_OF_CONDUCT.md) and [NOTICE](https://github.com/Architecture-Mechanism/bellande_rust_executable/blob/main/CODE_OF_CONDUCT.md) for more information.
|
||||
|
@@ -20,6 +20,7 @@ import os
|
||||
import shutil
|
||||
import argparse
|
||||
import toml
|
||||
from bellande_parser.bellande_parser import Bellande_Format
|
||||
|
||||
def ensure_directory(path):
|
||||
"""Ensure a directory exists and create one if it does not"""
|
||||
@@ -33,7 +34,7 @@ def copy_source_files(src_dir, dest_dir):
|
||||
dest_src_dir = os.path.join(dest_dir, 'src')
|
||||
ensure_directory(dest_src_dir)
|
||||
|
||||
for root, dirs, files in os.walk(src_dir):
|
||||
for root, _, files in os.walk(src_dir):
|
||||
for file in files:
|
||||
src_path = os.path.join(root, file)
|
||||
rel_path = os.path.relpath(src_path, src_dir)
|
||||
@@ -52,7 +53,6 @@ def create_cargo_toml(project_dir, main_file, binary_name):
|
||||
'dependencies': {}
|
||||
}
|
||||
|
||||
# If the main file isn't main.rs, we need to specify the path
|
||||
if main_file != 'main.rs':
|
||||
cargo_config['bin'] = [{
|
||||
'name': binary_name,
|
||||
@@ -64,19 +64,22 @@ def create_cargo_toml(project_dir, main_file, binary_name):
|
||||
toml.dump(cargo_config, f)
|
||||
|
||||
def parse_dependencies(dep_file):
|
||||
"""Parse dependencies from the specified dependencies file."""
|
||||
dependencies = {}
|
||||
if os.path.exists(dep_file):
|
||||
with open(dep_file, 'r') as file:
|
||||
for line in file:
|
||||
line = line.strip()
|
||||
if line and not line.startswith('#'):
|
||||
try:
|
||||
name, version = line.split('=')
|
||||
dependencies[name.strip()] = version.strip().strip('"')
|
||||
except ValueError:
|
||||
print(f"Warning: Skipping invalid dependency line: {line}")
|
||||
return dependencies
|
||||
"""Parse dependencies from the specified .bellande file using Bellande_Format."""
|
||||
bellande_parser = Bellande_Format()
|
||||
parsed_data = bellande_parser.parse_bellande(dep_file)
|
||||
|
||||
# Convert the string representation to a Python dictionary
|
||||
dependencies = eval(parsed_data)
|
||||
|
||||
# Process the dependencies to match Cargo.toml format
|
||||
processed_dependencies = {}
|
||||
for name, value in dependencies.items():
|
||||
if isinstance(value, str):
|
||||
processed_dependencies[name] = value
|
||||
elif isinstance(value, dict):
|
||||
processed_dependencies[name] = value
|
||||
|
||||
return processed_dependencies
|
||||
|
||||
def update_cargo_toml_dependencies(project_dir, dependencies):
|
||||
"""Update the dependencies in Cargo.toml."""
|
||||
@@ -95,18 +98,11 @@ def build_project(project_dir, output_path, binary_name):
|
||||
result = subprocess.run(cargo_command, cwd=project_dir, capture_output=True, text=True)
|
||||
|
||||
if result.returncode == 0:
|
||||
# Determine the correct executable name based on platform
|
||||
if os.name == 'nt': # Windows
|
||||
exe_extension = '.exe'
|
||||
else: # Unix-like systems
|
||||
exe_extension = ''
|
||||
|
||||
# Copy the built executable to the specified output location
|
||||
exe_extension = '.exe' if os.name == 'nt' else ''
|
||||
built_exe = os.path.join(project_dir, 'target', 'release', f"{binary_name}{exe_extension}")
|
||||
ensure_directory(os.path.dirname(output_path))
|
||||
shutil.copy2(built_exe, output_path)
|
||||
|
||||
# Make the output file executable on Unix-like systems
|
||||
if os.name != 'nt':
|
||||
os.chmod(output_path, 0o755)
|
||||
|
||||
@@ -119,17 +115,14 @@ def build_project(project_dir, output_path, binary_name):
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="Universal Rust Executable Builder")
|
||||
parser.add_argument("-d", "--dep-file", required=True, help="Path to the dependencies file")
|
||||
parser.add_argument("-d", "--dep-file", required=True, help="Path to the .bellande dependencies file")
|
||||
parser.add_argument("-s", "--src-dir", required=True, help="Source directory containing Rust files")
|
||||
parser.add_argument("-m", "--main-file", required=True, help="Main Rust file name (e.g., main.rs)")
|
||||
parser.add_argument("-o", "--output", required=True, help="Output path for the compiled executable")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
# Extract binary name from the file name (removing .rs extension)
|
||||
binary_name = os.path.splitext(args.main_file)[0]
|
||||
|
||||
# Create unique build directory based on binary name
|
||||
build_dir = f"build_{binary_name}"
|
||||
ensure_directory(build_dir)
|
||||
|
||||
@@ -137,17 +130,11 @@ def main():
|
||||
copy_source_files(args.src_dir, build_dir)
|
||||
create_cargo_toml(build_dir, args.main_file, binary_name)
|
||||
|
||||
# Parse and update dependencies
|
||||
dependencies = parse_dependencies(args.dep_file)
|
||||
update_cargo_toml_dependencies(build_dir, dependencies)
|
||||
|
||||
# Determine the correct output path based on platform
|
||||
if os.name == 'nt': # Windows
|
||||
output_path = f"{args.output}.exe"
|
||||
else: # Unix-like systems
|
||||
output_path = args.output
|
||||
output_path = f"{args.output}.exe" if os.name == 'nt' else args.output
|
||||
|
||||
# Build the project
|
||||
if build_project(build_dir, output_path, binary_name):
|
||||
print(f"Successfully built and copied to {output_path}")
|
||||
return 0
|
||||
@@ -156,7 +143,6 @@ def main():
|
||||
return 1
|
||||
|
||||
finally:
|
||||
# Clean up build directory
|
||||
shutil.rmtree(build_dir, ignore_errors=True)
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Reference in New Issue
Block a user