Skip to content

Commit

Permalink
Merge pull request #348 from multiversx/cpp-cleanup
Browse files Browse the repository at this point in the history
Smart contract projects cleanup
  • Loading branch information
popenta authored Oct 17, 2023
2 parents 3f40d78 + 226de84 commit 3ebee1a
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 500 deletions.
4 changes: 2 additions & 2 deletions CLI.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ COMMANDS summary
----------------
new Create a new Smart Contract project based on a template.
templates List the available Smart Contract templates.
build Build a Smart Contract project using the appropriate buildchain.
build Build a Smart Contract project.
clean Clean a Smart Contract project.
test Run scenarios (tests).
report Print a detailed report of the smart contracts.
Expand Down Expand Up @@ -114,7 +114,7 @@ options:
$ mxpy contract build --help
usage: mxpy contract build [-h] ...
Build a Smart Contract project using the appropriate buildchain.
Build a Smart Contract project.
options:
-h, --help show this help message and exit
Expand Down
2 changes: 1 addition & 1 deletion multiversx_sdk_cli/cli_contracts.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def setup_parser(args: List[str], subparsers: Any) -> Any:
sub.set_defaults(func=list_templates)

sub = cli_shared.add_command_subparser(subparsers, "contract", "build",
"Build a Smart Contract project using the appropriate buildchain.")
"Build a Smart Contract project.")
_add_build_options_sc_meta(sub)
sub.set_defaults(func=build)

Expand Down
6 changes: 1 addition & 5 deletions multiversx_sdk_cli/projects/__init__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
from multiversx_sdk_cli.projects.core import (build_project, clean_project,
get_projects_in_workspace,
load_project, run_tests)
from multiversx_sdk_cli.projects.project_base import Project
from multiversx_sdk_cli.projects.project_clang import ProjectClang
from multiversx_sdk_cli.projects.project_cpp import ProjectCpp
from multiversx_sdk_cli.projects.project_rust import ProjectRust
from multiversx_sdk_cli.projects.project_sol import ProjectSol
from multiversx_sdk_cli.projects.report.do_report import do_report
from multiversx_sdk_cli.projects.templates import Contract

__all__ = ["build_project", "clean_project", "do_report", "run_tests", "get_projects_in_workspace", "load_project", "Project", "ProjectClang", "ProjectCpp", "ProjectRust", "ProjectSol", "Contract"]
__all__ = ["build_project", "clean_project", "do_report", "run_tests", "load_project", "Project", "ProjectRust", "Contract"]
29 changes: 1 addition & 28 deletions multiversx_sdk_cli/projects/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,19 @@
from pathlib import Path
from typing import Any, List

from multiversx_sdk_cli import dependencies, errors, guards, utils
from multiversx_sdk_cli import dependencies, errors, guards
from multiversx_sdk_cli.projects import shared
from multiversx_sdk_cli.projects.constants import (OLD_PROJECT_CONFIG_FILENAME,
PROJECT_CONFIG_FILENAME)
from multiversx_sdk_cli.projects.project_base import Project
from multiversx_sdk_cli.projects.project_clang import ProjectClang
from multiversx_sdk_cli.projects.project_cpp import ProjectCpp
from multiversx_sdk_cli.projects.project_rust import ProjectRust
from multiversx_sdk_cli.projects.project_sol import ProjectSol

logger = logging.getLogger("projects.core")


def load_project(directory: Path) -> Project:
guards.is_directory(directory)

if shared.is_source_clang(directory):
return ProjectClang(directory)
if shared.is_source_cpp(directory):
return ProjectCpp(directory)
if shared.is_source_sol(directory):
return ProjectSol(directory)
if shared.is_source_rust(directory):
return ProjectRust(directory)
else:
Expand All @@ -35,7 +26,6 @@ def build_project(directory: Path, args: List[str]):

logger.info("build_project.directory: %s", directory)

guards.is_directory(directory)
project = load_project(directory)
outputs = project.build(args)
logger.info("Build ran.")
Expand Down Expand Up @@ -65,23 +55,6 @@ def run_tests(project_path: Path, args: Any):
project.run_tests(directory, wildcard)


def get_projects_in_workspace(workspace: Path) -> List[Project]:
guards.is_directory(workspace)
subfolders = utils.get_subfolders(workspace)
projects = []

for folder in subfolders:
project_directory = workspace / folder

try:
project = load_project(project_directory)
projects.append(project)
except Exception:
pass

return projects


def get_project_paths_recursively(base_path: Path) -> List[Path]:
guards.is_directory(base_path)
old_markers = list(base_path.glob(f"**/{OLD_PROJECT_CONFIG_FILENAME}"))
Expand Down
158 changes: 0 additions & 158 deletions multiversx_sdk_cli/projects/project_clang.py

This file was deleted.

114 changes: 0 additions & 114 deletions multiversx_sdk_cli/projects/project_cpp.py

This file was deleted.

Loading

0 comments on commit 3ebee1a

Please sign in to comment.