Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smart contract projects cleanup #348

Merged
merged 1 commit into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading