44
55# Linting
66
7- When contributing, ensure your changes to python code have a valid
8- format.
7+ When contributing, ensure your changes to python code have a valid format.
98
109```
1110python -m pip install black
@@ -30,9 +29,9 @@ python -m unittest test/integration_tests.py
3029# Running the unit tests
3130
3231The unit tests of the hermetic build scripts are contained in several scripts,
33- corresponding to a specific component. Every unit test script ends with
34- ` unit_tests.py ` . To avoid them specifying them
35- individually, we can use the following command:
32+ corresponding to a specific component.
33+ Every unit test script ends with ` unit_tests.py ` .
34+ To avoid them specifying them individually, we can use the following command:
3635
3736``` bash
3837python -m unittest discover -s test/ -p " *unit_tests.py"
@@ -45,35 +44,41 @@ python -m unittest discover -s test/ -p "*unit_tests.py"
4544# Running the scripts in your local environment
4645
4746Although the scripts are designed to be run in a Docker container, you can also
48- run them directly. This section explains how to run the entrypoint script
47+ run them directly.
48+ This section explains how to run the entrypoint script
4949(` library_generation/cli/entry_point.py ` ).
5050
51- ## Installing prerequisites
51+ ## Assumptions made by the scripts
52+ ### The Hermetic Build's well-known folder
53+ Located in ` ${HOME}/.library_generation ` , this folder is assumed by the scripts
54+ to contain the generator JAR.
55+ Please note that this is a recent feature and only this jar is expected to be
56+ there.
57+ Developers must make sure this folder is properly configured before running the
58+ scripts locally.
59+ Note that this relies on the ` HOME ` en var which is always defined as per
60+ [ POSIX env var definition] ( https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap08.html ) .
5261
53- In order to run the generation scripts directly, there are a few tools we
54- need to install beforehand.
62+ #### Put the gapic-generator-java jar in its well-known location
5563
56- ### Install synthtool
64+ Run `cd sdk-platform-java && mvn install -DskipTests -Dclirr.skip
65+ -Dcheckstyle.skip`.
66+ This will generate a jar located in
67+ ` ~/.m2/repository/com/google/api/gapic-generator-java/{version}/gapic-generator-java-{version}.jar `
5768
58- It requires python 3.x to be installed.
59- You will need to specify a committish of the synthtool repo in order to have
60- your generation results matching exactly what the docker image would produce.
61- You can achieve this by inspecting ` SYNTHTOOL_COMMITISH ` in
62- ` .cloudbuild/library_generation/library_generation.Dockerfile ` .
69+ Then ` mv ` the jar into the well-known location of the jar.
70+ The generation scripts will assume the jar is there.
6371
64- ``` bash
65- # obtained from .cloudbuild/library_generation/library_generation.Dockerfile
66- export SYNTHTOOL_COMMITTISH=6612ab8f3afcd5e292aecd647f0fa68812c9f5b5
72+ ``` shell
73+ mv /path/to/jar " ${HOME} /.library_generation/gapic-generator-java.jar"
6774```
6875
69- ``` bash
70- git clone https://github.com/googleapis/synthtool
71- cd synthtool
72- git checkout " ${SYNTHTOOL_COMMITTISH} "
73- python -m pip install --require-hashes -r requirements.txt
74- python -m pip install --no-deps -e .
75- python -m synthtool --version
76- ```
76+
77+
78+ ## Installing prerequisites
79+
80+ In order to run the generation scripts directly, there are a few tools we
81+ need to install beforehand.
7782
7883### Install the owl-bot CLI
7984
@@ -93,6 +98,7 @@ owl-bot copy-code --version
9398The key step is ` npm link ` , which will make the command available in you current
9499shell session.
95100
101+
96102## Running the script
97103The entrypoint script (` library_generation/cli/entry_point.py ` ) allows you to
98104update the target repository with the latest changes starting from the
@@ -132,9 +138,9 @@ This will create an `image-id` file at the root of the repo with the hash ID of
132138the image.
133139
134140## Run the docker image
135- The docker image will perform changes on its internal ` /workspace ` folder, to which you
136- need to map a folder on your host machine (i.e. map your downloaded repo to this
137- folder).
141+ The docker image will perform changes on its internal ` /workspace ` folder,
142+ to which you need to map a folder on your host machine (i.e. map your downloaded
143+ repo to this folder).
138144
139145To run the docker container on the google-cloud-java repo, you must run:
140146``` bash
@@ -151,9 +157,9 @@ docker run -u "$(id -u)":"$(id -g)" -v/path/to/google-cloud-java:/workspace $(c
151157
152158## Debug the created containers
153159If you are working on changing the way the containers are created, you may want
154- to inspect the containers to check the setup. It would be convenient in such
155- case to have a text editor/viewer available. You can achieve this by modifying
156- the Dockerfile as follows:
160+ to inspect the containers to check the setup.
161+ It would be convenient in such case to have a text editor/viewer available.
162+ You can achieve this by modifying the Dockerfile as follows:
157163
158164``` docker
159165# install OS tools
0 commit comments