@@ -23,12 +23,14 @@ vars:
23
23
24
24
# DESTDIR
25
25
# The path, relative to the api dir, where the outputs should be rooted.
26
+ # * The common apis are exported to DESTDIR/api
27
+ # * The necessary upstream includes are exported to DESTDIR/proto-include
26
28
#
27
29
# When using DESTDIR to create output paths, do NOT insert '/' characters.
28
30
# Please do {{.DESTDIR}}{{.OUTDIR}} rather than {{.DESTDIR}}/{{.OUTDIR}}
29
31
# Note that making DESTDIR=. does not work (cp same file to same file)
30
- DESTDIR : ' {{.DESTDIR | default "../exported/api/"}} '
31
-
32
+ #
33
+ DESTDIR : ' {{.DESTDIR | default "../exported/"}} '
32
34
33
35
# see https://github.com/golang/protobuf/issues/143
34
36
# field_mask is a well known type that is recommend for use with UPDATE
72
74
rm -rf {{.PROTO_INC_ROOT}}/{{.GOOGLE_COMMON_INC_BASEDIR}}
73
75
mkdir -p {{.PROTO_INC_ROOT}}
74
76
tar -C {{.PROTO_INC_ROOT}} -xvzf {{.GOOGLE_COMMON_PROTOS_VERSION}}.tar.gz
75
- mv {{.PROTO_INC_ROOT}}/{{.GOOGLE_COMMON_INC_ARCHIVE_BASEDIR}}-{{.GOOGLE_COMMON_PROTOS_VERSION}} \
76
- {{.PROTO_INC_ROOT}}/{{.GOOGLE_COMMON_INC_BASEDIR}}
77
+ mkdir -p {{.PROTO_INC_ROOT}}/{{.GOOGLE_COMMON_INC_BASEDIR}}
78
+ mv {{.PROTO_INC_ROOT}}/{{.GOOGLE_COMMON_INC_ARCHIVE_BASEDIR}}-{{.GOOGLE_COMMON_PROTOS_VERSION}}/google \
79
+ {{.PROTO_INC_ROOT}}/{{.GOOGLE_COMMON_INC_BASEDIR}}/
77
80
rm -f {{.GOOGLE_COMMON_PROTOS_VERSION}}.tar.gz
78
81
find {{.GOOGLE_INC}} -type d
79
82
@@ -98,17 +101,29 @@ tasks:
98
101
attribute/v2/attribute
99
102
caps/v1/caps
100
103
filter/v1/filter
104
+ # The defaults match the expectations of .github/workflows/ci.yml
105
+ COMMON_GODIR : datatrails-common-api-gen
106
+ COMMON_PROTODIR : datatrails-common-api
101
107
cmds :
102
108
- |
103
- mkdir -p {{.DESTDIR}}
109
+ mkdir -p {{.DESTDIR}}{{.COMMON_GODIR}}
104
110
for name in {{.SOURCES}}; do
105
- cp -vr ${name} {{.DESTDIR}}
111
+ cp -vr ${name} {{.DESTDIR}}{{.COMMON_GODIR}}/
106
112
done
113
+
114
+ mkdir -p {{.DESTDIR}}/proto-include/{{.COMMON_PROTODIR}}
115
+ mkdir -p {{.DESTDIR}}/swagger
116
+
117
+ # The source protos are all gathered under a 'google' common top dir
118
+ cp -vr {{.GOOGLE_INC}}/* {{.DESTDIR}}proto-include/
119
+
107
120
for api in {{.APIS}}; do
108
- mkdir -vp {{.DESTDIR}}${api}
109
- cp -vr ${api}/*.go {{.DESTDIR}}${api}/
110
- cp -vr ${api}/*.swagger.json {{.DESTDIR}}${api}/
111
- cp -vr ${api}/*.proto {{.DESTDIR}}${api}/
121
+ mkdir -vp {{.DESTDIR}}{{.COMMON_GODIR}}/${api}
122
+ cp -vr ${api}/*.go {{.DESTDIR}}{{.COMMON_GODIR}}/${api}
123
+ mkdir -vp {{.DESTDIR}}swagger/${api}
124
+ cp -vr ${api}/*.swagger.json {{.DESTDIR}}swagger/${api}
125
+ mkdir -vp {{.DESTDIR}}proto-include/{{.COMMON_PROTODIR}}/${api}
126
+ cp -vr ${api}/*.proto {{.DESTDIR}}proto-include/{{.COMMON_PROTODIR}}/${api}
112
127
done
113
128
114
129
0 commit comments