The open source OpenXR runtime
1# Copyright 2022-2025, Collabora, Ltd.
2#
3# SPDX-License-Identifier: BSL-1.0
4"""Configuration for "copybara" <https://github.com/google/copybara> to update vendored source."""
5
6gitlab_url = "git@ssh.gitlab.freedesktop.org:rpavlik/monado.git"
7author = "Rylie Pavlik <rylie.pavlik@collabora.com>"
8
9# Helpful flag when working on these workflows:
10# --git-destination-non-fast-forward
11
12# update-stb: Update STB libraries
13core.workflow(
14 name="update-stb",
15 custom_rev_id="STB_REV_ID",
16 origin=git.github_origin(
17 url="https://github.com/nothings/stb.git",
18 ref="master",
19 ),
20 destination=git.destination(
21 url=gitlab_url,
22 fetch="main",
23 push="update-stb",
24 ),
25 destination_files=glob(["src/external/stb/*.h"]),
26 origin_files=glob(["stb_image_write.h"]),
27 authoring=authoring.pass_thru(author),
28 transformations=[
29 metadata.replace_message("external/stb: Update stb libraries from upstream"),
30 core.move("", "src/external/stb/"),
31 ],
32)
33
34
35# Custom transformation that writes the COMMIT file in the nanopb directory
36def write_nanopb_commit(ctx):
37 return ctx.write_path(
38 ctx.new_path("src/external/nanopb/COMMIT.txt"),
39 core.format("%s\n", [ctx.find_label("GIT_DESCRIBE_CHANGE_VERSION")]),
40 )
41
42
43# update-nanopb: Update NanoPB library
44# WARNING: May also require update of the generated .pb.h and .pb.c files,
45# not currently done by this code!
46core.workflow(
47 name="update-nanopb",
48 custom_rev_id="NANOPB_REV_ID",
49 origin=git.github_origin(
50 url="https://github.com/nanopb/nanopb.git",
51 # ref = "master",
52 describe_version=True,
53 version_selector=core.latest_version(
54 format="refs/tags/nanopb-${n0}.${n1}.${n2}",
55 regex_groups={
56 "n0": "[0-9]+",
57 "n1": "[0-9]+",
58 "n2": "[0-9]+",
59 },
60 ),
61 ),
62 destination=git.destination(
63 url=gitlab_url,
64 fetch="main",
65 push="update-nanopb",
66 ),
67 destination_files=glob(
68 ["src/external/nanopb/*.{h,c,txt}"],
69 exclude=["src/external/nanopb/monado_metrics.pb.{c,h}"],
70 ),
71 origin_files=glob(["*.{h,c,txt}"], exclude=["CMakeLists.txt", "requirements.txt"]),
72 authoring=authoring.pass_thru(author),
73 transformations=[
74 metadata.expose_label("GIT_DESCRIBE_CHANGE_VERSION"),
75 metadata.replace_message(
76 "external/nanopb: Update nanopb from upstream ${GIT_DESCRIBE_CHANGE_VERSION}"
77 ),
78 core.move("", "src/external/nanopb/"),
79 # core.format()
80 write_nanopb_commit,
81 ],
82)
83
84# update-cjson: Update cJSON library
85core.workflow(
86 name="update-cjson",
87 custom_rev_id="CJSON_REV_ID",
88 origin=git.github_origin(
89 url="https://github.com/DaveGamble/cJSON.git",
90 # ref = "master",
91 describe_version=True,
92 version_selector=core.latest_version(
93 format="refs/tags/v${n0}.${n1}.${n2}",
94 regex_groups={
95 "n0": "[0-9]+",
96 "n1": "[0-9]+",
97 "n2": "[0-9]+",
98 },
99 ),
100 ),
101 destination=git.destination(
102 url=gitlab_url,
103 fetch="main",
104 push="update-cjson",
105 ),
106 destination_files=glob(["src/external/cjson/cjson/*"]),
107 origin_files=glob(["cJSON.{h,c}", "{CHANGELOG,CONTRIBUTORS}.md", "LICENSE"]),
108 authoring=authoring.pass_thru(author),
109 transformations=[
110 metadata.expose_label("GIT_DESCRIBE_CHANGE_VERSION"),
111 metadata.replace_message(
112 "external/cjson: Update cJSON from upstream ${GIT_DESCRIBE_CHANGE_VERSION}"
113 ),
114 core.move("", "src/external/cjson/cjson/"),
115 ],
116)
117
118# update-catch2: Update Catch2 library (amalgamated version)
119core.workflow(
120 name="update-catch2",
121 custom_rev_id="CATCH2_REV_ID",
122 origin=git.github_origin(
123 url="https://github.com/catchorg/Catch2.git",
124 describe_version=True,
125 version_selector=core.latest_version(
126 format="refs/tags/v${n0}.${n1}.${n2}",
127 regex_groups={
128 "n0": "3",
129 "n1": "[0-9]+",
130 "n2": "[0-9]+",
131 },
132 ),
133 ),
134 destination=git.destination(
135 url=gitlab_url,
136 fetch="main",
137 push="update-catch2",
138 ),
139 destination_files=glob(["src/external/Catch2/*"]),
140 origin_files=glob(["extras/catch_amalgamated.*", "LICENSE.txt"]),
141 authoring=authoring.pass_thru(author),
142 transformations=[
143 metadata.expose_label("GIT_DESCRIBE_CHANGE_VERSION"),
144 metadata.replace_message(
145 "external/Catch2: Update Catch2 from upstream ${GIT_DESCRIBE_CHANGE_VERSION}"
146 ),
147 core.move("extras/", "src/external/Catch2/"),
148 core.move("LICENSE.txt", "src/external/Catch2/LICENSE.txt"),
149 ],
150)
151
152# update-renderdoc: Update RenderDoc API
153core.workflow(
154 name="update-renderdoc",
155 custom_rev_id="RENDERDOC_REV_ID",
156 origin=git.github_origin(
157 url="https://github.com/baldurk/renderdoc.git",
158 ref="v1.x",
159 ),
160 destination=git.destination(
161 url=gitlab_url,
162 fetch="main",
163 push="update-renderdoc",
164 ),
165 destination_files=glob(["src/external/renderdoc_api/*.h"]),
166 origin_files=glob(["renderdoc/api/app/*.h"]),
167 authoring=authoring.pass_thru(author),
168 transformations=[
169 metadata.expose_label("GIT_DESCRIBE_CHANGE_VERSION"),
170 metadata.replace_message(
171 "external/renderdoc_api: Update RenderDoc API from upstream ${GIT_DESCRIBE_CHANGE_VERSION}"
172 ),
173 core.move("renderdoc/api/app/", "src/external/renderdoc_api/"),
174 ],
175)
176
177# update-jnipp: Update jnipp library (used on Android)
178core.workflow(
179 name="update-jnipp",
180 custom_rev_id="JNIPP_REV_ID",
181 origin=git.github_origin(
182 url="https://github.com/mitchdowd/jnipp.git",
183 describe_version=True,
184 ref="master",
185 ),
186 destination=git.destination(
187 url=gitlab_url,
188 fetch="main",
189 push="update-jnipp",
190 ),
191 destination_files=glob(["src/external/jnipp/**"]),
192 origin_files=glob(["**"], exclude=[".*", ".*/**", "*.sln"]),
193 authoring=authoring.pass_thru(author),
194 transformations=[
195 metadata.expose_label("GIT_DESCRIBE_CHANGE_VERSION"),
196 metadata.replace_message(
197 "Update jnipp from upstream ${GIT_DESCRIBE_CHANGE_VERSION}"
198 ),
199 core.move("", "src/external/jnipp/"),
200 ],
201)
202
203
204# update-openxr: Update OpenXR headers
205core.workflow(
206 name="update-openxr",
207 custom_rev_id="OPENXR_REV_ID",
208 origin=git.github_origin(
209 url="https://github.com/KhronosGroup/OpenXR-SDK.git",
210 ref="main",
211 describe_version=True,
212 # version_selector=core.latest_version(
213 # format="refs/tags/release-${n0}.${n1}.${n2}",
214 # regex_groups={
215 # "n0": "1",
216 # "n1": "[0-9]+",
217 # "n2": "[0-9]+",
218 # },
219 # ),
220 ),
221 destination=git.destination(
222 url=gitlab_url,
223 fetch="main",
224 push="update-openxr",
225 ),
226 destination_files=glob(
227 ["src/external/openxr_includes/openxr/openxr*.h"],
228 exclude=["src/external/openxr_includes/openxr/openxr_extension_helpers.h"],
229 ),
230 origin_files=glob(["include/openxr/*.h"]),
231 mode="SQUASH",
232 authoring=authoring.pass_thru(author),
233 transformations=[
234 metadata.expose_label("GIT_DESCRIBE_CHANGE_VERSION"),
235 metadata.replace_message(
236 "external/openxr_includes: Update OpenXR headers from upstream ${GIT_DESCRIBE_CHANGE_VERSION}"
237 ),
238 core.move("include/openxr/", "src/external/openxr_includes/openxr/"),
239 ],
240)