blob: 71da5e15cf360d05398f8025881950500a613f58 [file] [log] [blame]
Joey Armstronga144ef32024-01-11 11:26:41 -05001.. howto_code_voltha-protos:
2
Joey Armstrong7bfe29c2023-10-25 13:47:00 -04003Modifying repository voltha-protos
4==================================
5
6#. Clone repository `voltha-protos <https://gerrit.opencord.org/plugins/gitiles/voltha-protos/+/refs/heads/master>`_
7#. Modify structures, sources & makefiles as needed.
8#. Build, test and lint locally to validate sources.
9#. Commit changes, code review, jenins build and deploy.
10#. Update external dependent repositories to use the new version.
11
12Clone, edit, build & test
13-------------------------
14
15.. code:: bash
16
17 git clone ssh://gerrit.opencord.org:29418/voltha-protos.git
18 cd voltha-protos
19 vi ...
20
Joey Armstronga144ef32024-01-11 11:26:41 -050021 % make lint
22 % make build
23 % make test
Joey Armstrong7bfe29c2023-10-25 13:47:00 -040024
25.. list-table:: Build & Test locally
26 :widths: 30, 80
27 :header-rows: 1
28
29 * - Command
30 - Description
31 * - make sterile
32 - Remove previously generated targets
33 * - make protos
34 - Generate prototypes for go, java & python (dependency for target:build)
35 * - make build
36 - make protos; compile: go, java & python
37 * - make test
38 - Validate proto changes
39 * - make lint
40 - Syntax check sources prior to commit.
41
42Update all external repositories to consume the new repo:voltha-protos version
43------------------------------------------------------------------------------
44
45- Each external VOLTHA repository will need to have dependencies mentioned in
46 the file go.mod updated.
47- Rebuild each repository in hierarchial order also updating external libs as
48 they are rebuilt.
49
50.. list-table:: External repositories to modify
51 :widths: 30, 80
52 :header-rows: 1
53
54 * - Repository
55 - File(s) to edit
56 * - bbsim
57 - `go.mod <https://gerrit.opencord.org/plugins/gitiles/bbsim/+/refs/heads/master/go.mod>`_
58 * - ofagent-go
59 - `go.mod <https://gerrit.opencord.org/plugins/gitiles/ofagent-go/+/refs/heads/master/go.mod>`__
60 * - voltctl
61 - `go.mod <https://gerrit.opencord.org/plugins/gitiles/voltctl/+/refs/heads/master/go.mod>`__
62 * - voltha-go
63 - `go.mod <https://gerrit.opencord.org/plugins/gitiles/voltha-go/+/refs/heads/master/go.mod>`__
64 * - voltha-go-controller
65 - `go.mod <https://gerrit.opencord.org/plugins/gitiles/voltha-go-controller/+/refs/heads/master/go.mod>`__
66 * - voltha-lib-go
67 - `go.mod <https://gerrit.opencord.org/plugins/gitiles/voltha-lib-go/+/refs/heads/master/go.mod>`__
68 * - voltha-openolt-adapter
69 - `go.mod <https://gerrit.opencord.org/plugins/gitiles/voltha-openolt-adapter/+/refs/heads/master/go.mod>`__
70 * - voltha-openonu-adapter-go
71 - `go.mod <https://gerrit.opencord.org/plugins/gitiles/voltha-openonu-adapter-go/+/refs/heads/master/go.mod>`__
72 * - voltha-system-tests
73 - `requirements.txt <https://gerrit.opencord.org/plugins/gitiles/voltha-system-tests/+/refs/heads/master/requirements.txt>`_ (virtualenv/testing)
74
75.. list-table:: Foreach external repository
76 :widths: 30, 80
77 :header-rows: 1
78
79 * - Command
80 - Description
81 * - vi {repo}/go.mod
82 - Bump version of repo:voltha-proto to latest published
83 * - vi {repo}/go.mod
84 - Bump external module version(s) during hierarcical build.
85 * - go mod edit -replace [...]
86 - Use the go mod tool to update version of voltha-protos and friends.
87 * - go mod tidy
88 - Cleanup syntax issues in golang source that will fail your pending commit
89 * - go mod vendor
90 - | Update sources and dependencies beneath the vendor/ directory.
91 | See also `go-mod-vendor <https://go.dev/ref/mod#go-mod-vendor>`_, `Packages & Modules <https://golangbyexample.com/packages-modules-go-second/>`_
92 * - make build
93 - Compile with updated module dependencies.
94 * - make test
95 - Sanity check everything is still working.
96 * - make lint LOCAL_FIX_PERMS=1
97 - | Syntax check sources for problems prior to checkin.
98 | LOCAL_FIX_PERMS=1 (optional) can workaround docker related permission problems.