From c4ea7aea0a3926a434c6fb7f4a4735163722f767 Mon Sep 17 00:00:00 2001 From: rschoene <rene.schoene@tu-dresden.de> Date: Mon, 28 Feb 2022 09:27:39 +0100 Subject: [PATCH] Some ideas. - replace project_gitlab_id with $System.env.CI_PROJECT_ID, update readme - cache gradle distro - fix diagram creation - add git remote after init --- README.md | 4 ++-- cookiecutter.json | 1 - hooks/post_gen_project.py | 4 +++- {{cookiecutter.repo_name}}/.gitlab-ci.yml | 11 ++++++++++- {{cookiecutter.repo_name}}/build.gradle | 4 ++-- 5 files changed, 17 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index b675252..fef7bda 100644 --- a/README.md +++ b/README.md @@ -6,5 +6,5 @@ Requirements: Usage: -1. Create a [new project](https://git-st.inf.tu-dresden.de/projects/new). Note the URL to clone the project and its project ID. -2. Run `cookiecutter https://git-st.inf.tu-dresden.de/jastadd/project-templates/relast` and put in your information, especially the URL from step 1 as `project_url` and the project ID from step 1 as `project_gitlab_id`. +1. Create a [new project](https://git-st.inf.tu-dresden.de/projects/new). Note the URL to clone the project. +2. Run `cookiecutter https://git-st.inf.tu-dresden.de/jastadd/project-templates/relast` and put in your information, especially the URL from step 1 as `project_url`. diff --git a/cookiecutter.json b/cookiecutter.json index 470aade..3620b46 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -3,7 +3,6 @@ "project_name": "My New Relational RAG Project", "project_short_name": "NewRelAST", "project_slug": "{{cookiecutter.project_name|replace(' ','_')|lower}}", - "project_gitlab_id": "001", "package": "jastadd", "project_url": "git@git-st.inf.tu-dresden.de:{{cookiecutter.package}}/{{cookiecutter.repo_name}}.git", "repo_url": "https://git-st.inf.tu-dresden.de/{{cookiecutter.package}}/{{cookiecutter.repo_name}}", diff --git a/hooks/post_gen_project.py b/hooks/post_gen_project.py index 2bb163c..a9731af 100644 --- a/hooks/post_gen_project.py +++ b/hooks/post_gen_project.py @@ -1,10 +1,12 @@ -import sys import subprocess PROJECT_URL = '{{cookiecutter.project_url}}' + def main(): subprocess.call(['git', 'init']) + subprocess.call(['git', 'remote', 'add', 'origin', PROJECT_URL]) + if __name__ == '__main__': main() diff --git a/{{cookiecutter.repo_name}}/.gitlab-ci.yml b/{{cookiecutter.repo_name}}/.gitlab-ci.yml index 37aae9f..890a62b 100644 --- a/{{cookiecutter.repo_name}}/.gitlab-ci.yml +++ b/{{cookiecutter.repo_name}}/.gitlab-ci.yml @@ -1,6 +1,14 @@ variables: GIT_SUBMODULE_STRATEGY: recursive +before_script: + - export GRADLE_USER_HOME=`pwd`/.gradle + +cache: + paths: + - .gradle/wrapper + - .gradle/caches + stages: - build - test @@ -89,7 +97,8 @@ pages: before_script: - pip install -r pages/requirements.txt script: - - cp -r src/gen/resources/{{cookiecutter.project_short_name}}Grammar.png pages/docs/diagrams + - mkdir pages/docs/diagrams + - cp src/gen/resources/{{cookiecutter.project_short_name}}Grammar.png pages/docs/diagrams/ - cd pages && mkdocs build artifacts: paths: diff --git a/{{cookiecutter.repo_name}}/build.gradle b/{{cookiecutter.repo_name}}/build.gradle index 3c6bff3..8e768bb 100644 --- a/{{cookiecutter.repo_name}}/build.gradle +++ b/{{cookiecutter.repo_name}}/build.gradle @@ -169,7 +169,7 @@ jastadd { } -// publish gitlab project {{cookiecutter.project_gitlab_id}} +// publish gitlab project publishing { publications { maven(MavenPublication) { @@ -182,7 +182,7 @@ publishing { } repositories { maven { - url "https://git-st.inf.tu-dresden.de/api/v4/projects/{{cookiecutter.project_gitlab_id}}/packages/maven" + url "https://git-st.inf.tu-dresden.de/api/v4/projects/$System.env.CI_PROJECT_ID/packages/maven" // Uncomment the following lines to publish manually (and comment out the other credentials section) // credentials(HttpHeaderCredentials) { // name = "Private-Token" -- GitLab