th2_grpc_generator_template
Project description
gRPC Generator Template
Fork this project and follow instructions.
This tool generates code from .proto
files and upload constructed packages (.proto
files and generated code) to specified repositories.
How to use:
- Create a directory with the name same as project name (replace dashes with underscores) under
src/main/proto
directory (remove other files and directories if they exist). - Place your own
.proto
files in created directory. Pay attention topackage
specifier andimport
statements. - Edit paths in
python_service_generator
stage in Dockerfile. - Edit
rootProject.name
variable insettings.gradle
file. This will be the name of Java package. - Edit parameters of
setup.py
insetup
function invocation such as:author
,author_email
,url
. Do not edit the others.
Note that the name of created directory under src/main/proto
directory is used in Python (it's a package name) and Docker (in python_service_generator
stage), so it should be the same in all places.
Parameters
IMAGE_NAME
- name of Docker imageIMAGE_VERSION
- version of Docker imageAPP_VERSION
- version of Java packageARTIFACTORY_USER
- user for Java artifactoryARTIFACTORY_PASS
- password for Java artifactoryARTIFACTORY_REPO
- repository for Java artifactoryARTIFACTORY_URL
- URL for Java artifactoryNEXUS_URL
- URL for Nexus (Java)NEXUS_USER
- user for Nexus (Java)NEXUS_PASS
- password for Nexus (Java)PYPI_REPOSITORY_URL
- URL for Python package repositoryPYPI_USER
- user for Python package repositoryPYPI_PASSWORD
- password for Python package repositoryAPP_NAME
- name of Python packageAPP_VERSION
- version of Python package
Docker
You can run everything via Docker:
docker build --tag {IMAGE_NAME}:{IMAGE_VERSION} . --build-arg release_version=${APP_VERSION}
--build-arg artifactory_user=${ARTIFACTORY_USER}
--build-arg artifactory_password=${ARTIFACTORY_PASS}
--build-arg artifactory_deploy_repo_key=${ARTIFACTORY_REPO}
--build-arg artifactory_url=${ARTIFACTORY_URL}
--build-arg pypi_repository_url=${PYPI_REPOSITORY_URL}
--build-arg nexus_url=${NEXUS_URL}
--build-arg nexus_user=${NEXUS_USER}
--build-arg nexus_password=${NEXUS_PASS}
--build-arg pypi_user=${PYPI_USER}
--build-arg pypi_password=${PYPI_PASSWORD}
--build-arg app_name=${APP_NAME}
--build-arg app_version=${APP_VERSION}
See Parameters section.
Java
If you wish to manually create and publish package for Java, run these command:
gradle --no-daemon clean build publish artifactoryPublish \
-Prelease_version=${RELEASE_VERSION} \
-Partifactory_user=${ARTIFACTORY_USER} \
-Partifactory_password=${ARTIFACTORY_PASSWORD} \
-Partifactory_deploy_repo_key=${ARTIFACTORY_DEPLOY_REPO_KEY} \
-Partifactory_url=${ARTIFACTORY_URL} \
-Pnexus_url=${NEXUS_URL} \
-Pnexus_user=${NEXUS_USER} \
-Pnexus_password=${NEXUS_PASSWORD}
See Parameters section.
Python
If you wish to manually create and publish package for Python:
- Edit
package_info.json
file in order to specify name and version for package (create file if it's absent). - Run these commands:
pip install -r requirements.txt
python setup.py generate
python setup.py sdist
twine upload --repository-url ${PYPI_REPOSITORY_URL} --username ${PYPI_USER} --password ${PYPI_PASSWORD} dist/*
See Parameters section.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file th2_grpc_generator_template-1.2.2.tar.gz
.
File metadata
- Download URL: th2_grpc_generator_template-1.2.2.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.52.0 CPython/3.8.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5dc68101f4e3d760d6b7f40c20ef6ceb096f1d294289f18a1c573991abfe75af |
|
MD5 | d7cb42e216a96b777468e8235a22c786 |
|
BLAKE2b-256 | 390b736d8cb68ff28eb720a57e2648d35ef426545877519d1b0251800a094564 |