4
4
5
5
# Linting
6
6
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.
9
8
10
9
```
11
10
python -m pip install black
@@ -30,9 +29,9 @@ python -m unittest test/integration_tests.py
30
29
# Running the unit tests
31
30
32
31
The 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:
36
35
37
36
``` bash
38
37
python -m unittest discover -s test/ -p " *unit_tests.py"
@@ -45,35 +44,41 @@ python -m unittest discover -s test/ -p "*unit_tests.py"
45
44
# Running the scripts in your local environment
46
45
47
46
Although 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
49
49
(` library_generation/cli/entry_point.py ` ).
50
50
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 ) .
52
61
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
55
63
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 `
57
68
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.
63
71
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"
67
74
```
68
75
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.
77
82
78
83
### Install the owl-bot CLI
79
84
@@ -93,6 +98,7 @@ owl-bot copy-code --version
93
98
The key step is ` npm link ` , which will make the command available in you current
94
99
shell session.
95
100
101
+
96
102
## Running the script
97
103
The entrypoint script (` library_generation/cli/entry_point.py ` ) allows you to
98
104
update 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
132
138
the image.
133
139
134
140
## 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).
138
144
139
145
To run the docker container on the google-cloud-java repo, you must run:
140
146
``` bash
@@ -151,9 +157,9 @@ docker run -u "$(id -u)":"$(id -g)" -v/path/to/google-cloud-java:/workspace $(c
151
157
152
158
## Debug the created containers
153
159
If 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:
157
163
158
164
``` docker
159
165
# install OS tools
0 commit comments