The open source OpenXR runtime
1# Copyright 2022, 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@gitlab.freedesktop.org:rpavlik/monado.git"
7author = "Rylie Pavlik <rylie.pavlik@collabora.com>"
8
9# update-stb: Update STB libraries
10core.workflow(
11 name = "update-stb",
12 origin = git.github_origin(
13 url = "https://github.com/nothings/stb.git",
14 ref = "master",
15 ),
16 destination = git.destination(
17 url = gitlab_url,
18 fetch = "main",
19 push = "update-stb",
20 ),
21 destination_files = glob(["src/external/stb/*.h"]),
22 origin_files = glob(["stb_image_write.h"]),
23 authoring = authoring.pass_thru(author),
24 transformations = [
25 metadata.replace_message("external/stb: Update stb libraries from upstream"),
26 core.move("", "src/external/stb/"),
27 ],
28)
29
30# Custom transformation that writes the COMMIT file in the nanopb directory
31def write_nanopb_commit(ctx):
32 return ctx.write_path(
33 ctx.new_path("src/external/nanopb/COMMIT.txt"),
34 core.format("%s\n", [ctx.find_label("GIT_DESCRIBE_CHANGE_VERSION")]),
35 )
36
37# update-nanopb: Update NanoPB library
38# WARNING: Also requires update of the generated .pb.h and .pb.c files,
39# not currently done by this code!
40core.workflow(
41 name = "update-nanopb",
42 origin = git.github_origin(
43 url = "https://github.com/nanopb/nanopb.git",
44 # ref = "master",
45 describe_version = True,
46 version_selector = core.latest_version(
47 format = "refs/tags/nanopb-${n0}.${n1}.${n2}",
48 regex_groups = {
49 "n0": "[0-9]+",
50 "n1": "[0-9]+",
51 "n2": "[0-9]+",
52 },
53 ),
54 ),
55 destination = git.destination(
56 url = gitlab_url,
57 fetch = "main",
58 push = "update-nanopb",
59 ),
60 destination_files = glob(["src/external/nanopb/*.{h,c,txt}"], exclude = ["src/external/nanopb/monado_metrics.pb.{c,h}"]),
61 origin_files = glob(["*.{h,c,txt}"], exclude = ["CMakeLists.txt", "CHANGELOG.txt"]),
62 authoring = authoring.pass_thru(author),
63 transformations = [
64 metadata.expose_label("GIT_DESCRIBE_CHANGE_VERSION"),
65 metadata.replace_message("external/nanopb: Update nanopb from upstream ${GIT_DESCRIBE_CHANGE_VERSION}"),
66 core.move("", "src/external/nanopb/"),
67 # core.format()
68 write_nanopb_commit,
69 ],
70)
71
72# update-cjson: Update cJSON library
73core.workflow(
74 name = "update-cjson",
75 origin = git.github_origin(
76 url = "https://github.com/DaveGamble/cJSON.git",
77 # ref = "master",
78 describe_version = True,
79 version_selector = core.latest_version(
80 format = "refs/tags/v${n0}.${n1}.${n2}",
81 regex_groups = {
82 "n0": "[0-9]+",
83 "n1": "[0-9]+",
84 "n2": "[0-9]+",
85 },
86 ),
87 ),
88 destination = git.destination(
89 url = gitlab_url,
90 fetch = "main",
91 push = "update-cjson",
92 ),
93 destination_files = glob(["src/external/cjson/cjson/*"]),
94 origin_files = glob(["cJSON.{h,c}", "{CHANGELOG,CONTRIBUTORS}.md", "LICENSE"]),
95 authoring = authoring.pass_thru(author),
96 transformations = [
97 metadata.expose_label("GIT_DESCRIBE_CHANGE_VERSION"),
98 metadata.replace_message("external/cjson: Update cJSON from upstream ${GIT_DESCRIBE_CHANGE_VERSION}"),
99 core.move("", "src/external/cjson/cjson/"),
100 ],
101)
102
103# update-catch2: Update Catch2 library, in case there's another 2.x release
104core.workflow(
105 name = "update-catch2",
106 origin = git.github_origin(
107 url = "https://github.com/catchorg/Catch2.git",
108 # ref = "master",
109 describe_version = True,
110 version_selector = core.latest_version(
111 format = "refs/tags/v${n0}.${n1}.${n2}",
112 regex_groups = {
113 "n0": "2",
114 "n1": "[0-9]+",
115 "n2": "[0-9]+",
116 },
117 ),
118 ),
119 destination = git.destination(
120 url = gitlab_url,
121 fetch = "main",
122 push = "update-catch2",
123 ),
124 destination_files = glob(["src/external/Catch2/*"]),
125 origin_files = glob(["single_include/catch2/catch.hpp"]),
126 authoring = authoring.pass_thru(author),
127 transformations = [
128 metadata.expose_label("GIT_DESCRIBE_CHANGE_VERSION"),
129 metadata.replace_message("external/Catch2: Update Catch2 from upstream ${GIT_DESCRIBE_CHANGE_VERSION}"),
130 core.move("single_include/catch2/catch.hpp", "src/external/Catch2/catch/"),
131 ],
132)
133
134# update-renderdoc: Update RenderDoc API
135core.workflow(
136 name = "update-renderdoc",
137 origin = git.github_origin(
138 url = "https://github.com/baldurk/renderdoc.git",
139 ref = "v1.x",
140 ),
141 destination = git.destination(
142 url = gitlab_url,
143 fetch = "main",
144 push = "update-renderdoc",
145 ),
146 destination_files = glob(["src/external/renderdoc_api/*.h"]),
147 origin_files = glob(["renderdoc/api/app/*.h"]),
148 authoring = authoring.pass_thru(author),
149 transformations = [
150 metadata.replace_message("external/renderdoc_api: Update RenderDoc API from upstream"),
151 core.move("renderdoc/api/app/", "src/external/renderdoc_api/"),
152 ],
153)