Skip to content

Conversation

@simhue
Copy link

@simhue simhue commented Sep 25, 2024

No description provided.

@simhue simhue requested a review from akomii September 25, 2024 13:53
Copy link
Member

@akomii akomii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add an overall description what the purpose of this script is. Dont make me think.

# minimizes build time
# alternatively if the start project is empty and the script is called from a project folder, it uses that project as entry point
# otherwise it builds every project
start_project = ""
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont understand this. What is the purpose of this script and how do I use it. Does it need to be in a specific folder? Does it need to be configured? If yes, it would be easier to provide the configuration as input arguments, like

python build_projects.py <dwh_projects_root> <start_project>

os.makedirs(dwh_projects_root)

# get DWH central project if not exists and get the names of all child projects
if not os.path.exists(os.path.join(aktin_project_path, "pom.xml")):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, the context is missing. Why does the script do that?

project_path = os.path.join(dwh_projects_root, project)
if not os.path.exists(os.path.join(dwh_projects_root, project)):
subprocess.run(["git", "clone", github_url_template.format(aktin_project_name, project)],
cwd=dwh_projects_root)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So it builds each project starting from starting_project. Move code into methods to make the script more readable like:

def clone_github_project_if_missing(repo_name: str, dest_path: Path):
    if not (dest_path / "pom.xml").exists():
        subprocess.check_call(["git", "clone", github_url_template.format(aktin_project_name, repo_name), str(dest_path)])
        
def build_project(project_path: Path):
    completed_process: CompletedProcess = subprocess.run(["mvn", "clean", "install"], cwd=project_path)
    if completed_process.returncode != 0:
        raise SystemExit(f"Build failed for project: {project_path.name}")

And so on

@akomii akomii added the enhancement New feature or request label Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

3 participants