-
Notifications
You must be signed in to change notification settings - Fork 0
Add build helper script #4
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 = "" |
There was a problem hiding this comment.
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")): |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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
No description provided.