Merge lp:~zorba-coders/zorba/feature-gen_audit_props into lp:zorba
- feature-gen_audit_props
- Merge into trunk
Proposed by
Matthias Brantner
Status: | Merged |
---|---|
Approved by: | Matthias Brantner |
Approved revision: | 11340 |
Merged at revision: | 11340 |
Proposed branch: | lp:~zorba-coders/zorba/feature-gen_audit_props |
Merge into: | lp:zorba |
Diff against target: |
370 lines (+243/-34) 9 files modified
cmake_modules/ZorbaRuntimeGenerator.cmake (+33/-0) src/api/CMakeLists.txt (+24/-0) src/api/audit.xml (+30/-0) src/api/auditimpl.cpp (+2/-26) src/api/auditimpl.h (+2/-8) src/api/auditprops_cpp.xq (+74/-0) src/api/auditprops_h.xq (+55/-0) src/api/pregenerated/auditprops.cpp (+16/-0) src/api/pregenerated/auditprops.h (+7/-0) |
To merge this branch: | bzr merge lp:~zorba-coders/zorba/feature-gen_audit_props |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Matthias Brantner | Approve | ||
Till Westmann | Approve | ||
Review via email: mp+156994@code.launchpad.net |
Commit message
generate audit properties
Description of the change
To post a comment you must log in.
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : | # |
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue job feature-
All tests succeeded!
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : | # |
Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1, Needs Fixing < 1, Pending < 1, Needs Information < 1, Resubmit < 1. Got: 2 Pending.
Revision history for this message
Till Westmann (tillw) : | # |
review:
Approve
Revision history for this message
Matthias Brantner (matthias-brantner) : | # |
review:
Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue starting for merge proposal.
Log at: http://
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue job feature-
All tests succeeded!
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'cmake_modules/ZorbaRuntimeGenerator.cmake' |
2 | --- cmake_modules/ZorbaRuntimeGenerator.cmake 2013-03-04 16:17:30 +0000 |
3 | +++ cmake_modules/ZorbaRuntimeGenerator.cmake 2013-04-03 23:02:22 +0000 |
4 | @@ -127,3 +127,36 @@ |
5 | -D "test_only:BOOLEAN=TRUE" |
6 | -P "${GEN_SCRIPT}") |
7 | ENDMACRO(ZORBA_DIAGNOSTIC_GENERATOR) |
8 | + |
9 | +MACRO(ZORBA_AUDIT_GENERATOR GEN_QUERY EXTVARS EXTRA_DEPS OUTPUT) |
10 | + # CMake is annoyingly limited when it comes to lists. There's no way |
11 | + # (that I know of) to create a list where any item contains a |
12 | + # semicolon. Since some of our arguments contain semicolons, we |
13 | + # cannot create a variable to hold the arguments to CMake |
14 | + # here. Therefore, we must duplicate them. It is important for |
15 | + # testing purposes that the arguments to CMAKE_COMMAND in both |
16 | + # ADD_CUSTOM_COMMAND() and ADD_TEST() here be the same, except for |
17 | + # -Dtest_only. |
18 | + STRING(REPLACE " " "_" TEST_NAME "${OUTPUT}") |
19 | + ADD_CUSTOM_COMMAND(OUTPUT "${OUTPUT}" |
20 | + COMMAND "${CMAKE_COMMAND}" |
21 | + -D "source_dir=\"${CMAKE_SOURCE_DIR}\"" |
22 | + -D "binary_dir=\"${CMAKE_BINARY_DIR}\"" |
23 | + -D "ZORBA_EXE=\"${ZORBA_EXE}\"" |
24 | + -D "query=\"${GEN_QUERY}\"" |
25 | + -D "gen_file=\"${OUTPUT}\"" |
26 | + -D "extvars:STRING=${EXTVARS}" |
27 | + -P "${GEN_SCRIPT}" |
28 | + MAIN_DEPENDENCY ${GEN_QUERY} |
29 | + DEPENDS ${EXTRA_DEPS} |
30 | + ${GEN_SCRIPT} ${CMAKE_SOURCE_DIR}/cmake_modules/ZorbaRuntimeGenerator.cmake) |
31 | + ADD_TEST("RuntimeGeneratorTest-${TEST_NAME}" "${CMAKE_COMMAND}" |
32 | + -D "source_dir=${CMAKE_SOURCE_DIR}" |
33 | + -D "binary_dir=${CMAKE_BINARY_DIR}" |
34 | + -D "ZORBA_EXE=${ZORBA_EXE}" |
35 | + -D "query=${GEN_QUERY}" |
36 | + -D "gen_file=${OUTPUT}" |
37 | + -D "extvars:STRING=${EXTVARS}" |
38 | + -D "test_only:BOOLEAN=TRUE" |
39 | + -P "${GEN_SCRIPT}") |
40 | +ENDMACRO(ZORBA_AUDIT_GENERATOR) |
41 | |
42 | === modified file 'src/api/CMakeLists.txt' |
43 | --- src/api/CMakeLists.txt 2013-02-07 17:24:36 +0000 |
44 | +++ src/api/CMakeLists.txt 2013-04-03 23:02:22 +0000 |
45 | @@ -81,4 +81,28 @@ |
46 | ${CMAKE_CURRENT_BINARY_DIR}/api/version.cpp |
47 | ) |
48 | |
49 | +SET(AUDIT_HEADER_GENERATOR "${CMAKE_SOURCE_DIR}/src/api/auditprops_h.xq") |
50 | +SET(AUDIT_CPP_GENERATOR "${CMAKE_SOURCE_DIR}/src/api/auditprops_cpp.xq") |
51 | +SET(AUDIT_HEADER "${CMAKE_BINARY_DIR}/src/api/auditprops.h") |
52 | +SET(AUDIT_CPP "${CMAKE_BINARY_DIR}/src/api/auditprops.cpp") |
53 | +SET(AUDIT_PROPS_SPEC "${CMAKE_SOURCE_DIR}/src/api/audit.xml") |
54 | + |
55 | +ZORBA_AUDIT_GENERATOR( |
56 | + ${AUDIT_CPP_GENERATOR} |
57 | + "auditspecfile:=${AUDIT_PROPS_SPEC}" |
58 | + ${AUDIT_PROPS_SPEC} |
59 | + ${AUDIT_CPP}) |
60 | + |
61 | +ZORBA_AUDIT_GENERATOR( |
62 | + ${AUDIT_HEADER_GENERATOR} |
63 | + "auditspecfile:=${AUDIT_PROPS_SPEC}" |
64 | + ${AUDIT_PROPS_SPEC} |
65 | + ${AUDIT_HEADER}) |
66 | + |
67 | +SET_SOURCE_FILES_PROPERTIES("${CMAKE_SOURCE_DIR}/src/api/auditimpl.cpp" |
68 | + PROPERTIES OBJECT_DEPENDS |
69 | + "${CMAKE_BINARY_DIR}/src/api/auditprops.cpp;${CMAKE_BINARY_DIR}/src/api/auditprops.h") |
70 | +SET_SOURCE_FILES_PROPERTIES("${CMAKE_SOURCE_DIR}/src/api/auditimpl.h" |
71 | + PROPERTIES OBJECT_DEPENDS |
72 | + "${CMAKE_BINARY_DIR}/src/api/auditprops.h") |
73 | # vim:set et sw=2 ts=2: |
74 | |
75 | === added file 'src/api/audit.xml' |
76 | --- src/api/audit.xml 1970-01-01 00:00:00 +0000 |
77 | +++ src/api/audit.xml 2013-04-03 23:02:22 +0000 |
78 | @@ -0,0 +1,30 @@ |
79 | +<?xml version="1.0" encoding="UTF-8"?> |
80 | +<!-- |
81 | + : Copyright 2013 The FLWOR Foundation. |
82 | + : |
83 | + : Licensed under the Apache License, Version 2.0 (the "License"); |
84 | + : you may not use this file except in compliance with the License. |
85 | + : You may obtain a copy of the License at |
86 | + : |
87 | + : http://www.apache.org/licenses/LICENSE-2.0 |
88 | + : |
89 | + : Unless required by applicable law or agreed to in writing, software |
90 | + : distributed under the License is distributed on an "AS IS" BASIS, |
91 | + : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
92 | + : See the License for the specific language governing permissions and |
93 | + : limitations under the License. |
94 | +--> |
95 | + |
96 | +<audit> |
97 | + |
98 | + <group name="xquery"> |
99 | + <group name="compilation"> |
100 | + <property name="filename" type="string"/> |
101 | + <property name="parse-duration" type="int"/> |
102 | + <property name="translation-duration" type="int"/> |
103 | + <property name="optimization-duration" type="int"/> |
104 | + <property name="codegeneration-duration" type="int"/> |
105 | + </group> |
106 | + </group> |
107 | + |
108 | +</audit> |
109 | |
110 | === modified file 'src/api/auditimpl.cpp' |
111 | --- src/api/auditimpl.cpp 2013-02-07 17:24:36 +0000 |
112 | +++ src/api/auditimpl.cpp 2013-04-03 23:02:22 +0000 |
113 | @@ -30,10 +30,7 @@ |
114 | // PropertyGroupImpl |
115 | //************************************************************************ |
116 | |
117 | -const char* XQUERY_COMPILATION_PATH[] = { "xquery", "compilation" }; |
118 | - |
119 | const PropertyGroupImpl EMPTY_OBJECT (0, NULL); |
120 | -const PropertyGroupImpl XQUERY_COMPILATION(2, XQUERY_COMPILATION_PATH); |
121 | |
122 | PropertyGroupImpl::PropertyGroupImpl(const size_t pathLength, const char** path) |
123 | : m_pathLength(pathLength), m_path(path) { |
124 | @@ -60,29 +57,6 @@ |
125 | |
126 | const PropertyImpl INVALID(""); |
127 | |
128 | -const PropertyImpl XQUERY_COMPILATION_FILENAME( |
129 | - XQUERY_COMPILATION, "filename", 0, Property::STRING); |
130 | - |
131 | -const PropertyImpl XQUERY_COMPILATION_PARSE_DURATION( |
132 | - XQUERY_COMPILATION, "parse-duration", 1, Property::INT); |
133 | - |
134 | -const PropertyImpl XQUERY_COMPILATION_TRANSLATION_DURATION( |
135 | - XQUERY_COMPILATION, "translation-duration", 2, Property::INT); |
136 | - |
137 | -const PropertyImpl XQUERY_COMPILATION_OPTIMIZATION_DURATION( |
138 | - XQUERY_COMPILATION, "optimization-duration", 3, Property::INT); |
139 | - |
140 | -const PropertyImpl XQUERY_COMPILATION_CODEGENERATION_DURATION( |
141 | - XQUERY_COMPILATION, "codegeneration-duration", 4, Property::INT); |
142 | - |
143 | -const PropertyImpl* PROPERTIES[] = { |
144 | - &XQUERY_COMPILATION_FILENAME, |
145 | - &XQUERY_COMPILATION_PARSE_DURATION, |
146 | - &XQUERY_COMPILATION_TRANSLATION_DURATION, |
147 | - &XQUERY_COMPILATION_OPTIMIZATION_DURATION, |
148 | - &XQUERY_COMPILATION_CODEGENERATION_DURATION |
149 | -}; |
150 | - |
151 | PropertyImpl::PropertyImpl(const PropertyGroup& g, const char n[], long i, Type t) |
152 | : m_group(g), m_id(i), m_type(t) { |
153 | String result; |
154 | @@ -120,6 +94,8 @@ |
155 | return m_type; |
156 | } |
157 | |
158 | +#include "api/auditprops.cpp" |
159 | + |
160 | //************************************************************************ |
161 | // Observation |
162 | //************************************************************************ |
163 | |
164 | === modified file 'src/api/auditimpl.h' |
165 | --- src/api/auditimpl.h 2013-02-07 17:24:36 +0000 |
166 | +++ src/api/auditimpl.h 2013-04-03 23:02:22 +0000 |
167 | @@ -43,8 +43,6 @@ |
168 | const char** m_path; |
169 | }; |
170 | |
171 | - extern const PropertyGroupImpl XQUERY_COMPILATION; |
172 | - |
173 | class PropertyImpl : public Property { |
174 | public: |
175 | |
176 | @@ -74,12 +72,6 @@ |
177 | const Type m_type; |
178 | }; |
179 | |
180 | - extern const PropertyImpl XQUERY_COMPILATION_FILENAME; |
181 | - extern const PropertyImpl XQUERY_COMPILATION_PARSE_DURATION; |
182 | - extern const PropertyImpl XQUERY_COMPILATION_TRANSLATION_DURATION; |
183 | - extern const PropertyImpl XQUERY_COMPILATION_OPTIMIZATION_DURATION; |
184 | - extern const PropertyImpl XQUERY_COMPILATION_CODEGENERATION_DURATION; |
185 | - |
186 | class ObservationImpl : public Observation { |
187 | public: |
188 | union Value { |
189 | @@ -210,6 +202,8 @@ |
190 | }; |
191 | |
192 | extern ProviderImpl PROVIDER_IMPL; |
193 | + |
194 | +#include "api/auditprops.h" |
195 | } |
196 | } |
197 | |
198 | |
199 | === added file 'src/api/auditprops_cpp.xq' |
200 | --- src/api/auditprops_cpp.xq 1970-01-01 00:00:00 +0000 |
201 | +++ src/api/auditprops_cpp.xq 2013-04-03 23:02:22 +0000 |
202 | @@ -0,0 +1,74 @@ |
203 | +(: |
204 | + : Copyright 2013 The FLWOR Foundation. |
205 | + : |
206 | + : Licensed under the Apache License, Version 2.0 (the "License"); |
207 | + : you may not use this file except in compliance with the License. |
208 | + : You may obtain a copy of the License at |
209 | + : |
210 | + : http://www.apache.org/licenses/LICENSE-2.0 |
211 | + : |
212 | + : Unless required by applicable law or agreed to in writing, software |
213 | + : distributed under the License is distributed on an "AS IS" BASIS, |
214 | + : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
215 | + : See the License for the specific language governing permissions and |
216 | + : limitations under the License. |
217 | +:) |
218 | +import module namespace file = "http://expath.org/ns/file"; |
219 | + |
220 | +declare variable $auditspecfile as xs:string external; |
221 | + |
222 | +declare function local:gen-group-spec($group as element()?) as xs:string* |
223 | +{ |
224 | + if ($group) |
225 | + then |
226 | + ($group/@name, local:gen-group-spec($group/parent::group)) |
227 | + else () |
228 | +}; |
229 | + |
230 | +declare function local:group-path($group-spec as xs:string*) as xs:string |
231 | +{ |
232 | +let $name := string-join($group-spec ! upper-case(.), "_") |
233 | +let $path := $name || "_PATH" |
234 | +return |
235 | + 'const char* ' |
236 | + || $path || "[]" |
237 | + || " = { " || string-join($group-spec ! concat('"', ., '"'), ", ") |
238 | + || " }; " |
239 | + || 'const PropertyGroupImpl ' || $name |
240 | + || "(" || count($group-spec) || ", " || $path || "); " |
241 | +}; |
242 | + |
243 | +variable $counter := -1; |
244 | + |
245 | +( |
246 | +let $spec := parse-xml(file:read-text($auditspecfile)) |
247 | +return |
248 | + string-join( |
249 | + for $first-prop in $spec//group/property[1] |
250 | + let $group-spec := reverse(local:gen-group-spec($first-prop/parent::group)) |
251 | + return |
252 | + local:group-path($group-spec) || |
253 | + string-join( |
254 | + for $prop in ($first-prop, $first-prop/following-sibling::property) |
255 | + let $group := string-join($group-spec ! upper-case(.), "_") |
256 | + return { |
257 | + $counter := $counter + 1; |
258 | + "const PropertyImpl " || $group || "_" || replace(upper-case($prop/@name), "-", "_") |
259 | + || "(" || $group || ', "' || $prop/@name || '", ' || $counter |
260 | + || ", Property::" || upper-case($prop/@type) || "); " |
261 | + } |
262 | + ) || " " |
263 | + ) || " " || |
264 | + "const PropertyImpl* PROPERTIES[] = { " || |
265 | + string-join( |
266 | + for $first-prop in $spec//group/property[1] |
267 | + let $group-spec := reverse(local:gen-group-spec($first-prop/parent::group)) |
268 | + return |
269 | + string-join( |
270 | + for $prop in ($first-prop, $first-prop/following-sibling::property) |
271 | + return |
272 | + (" &" || string-join($group-spec ! upper-case(.), "_") || "_" |
273 | + || replace(upper-case($prop/@name), "-", "_")), ", " |
274 | + ), ", " |
275 | + ) || " }; " |
276 | +) |
277 | |
278 | === added file 'src/api/auditprops_h.xq' |
279 | --- src/api/auditprops_h.xq 1970-01-01 00:00:00 +0000 |
280 | +++ src/api/auditprops_h.xq 2013-04-03 23:02:22 +0000 |
281 | @@ -0,0 +1,55 @@ |
282 | +(: |
283 | + : Copyright 2013 The FLWOR Foundation. |
284 | + : |
285 | + : Licensed under the Apache License, Version 2.0 (the "License"); |
286 | + : you may not use this file except in compliance with the License. |
287 | + : You may obtain a copy of the License at |
288 | + : |
289 | + : http://www.apache.org/licenses/LICENSE-2.0 |
290 | + : |
291 | + : Unless required by applicable law or agreed to in writing, software |
292 | + : distributed under the License is distributed on an "AS IS" BASIS, |
293 | + : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
294 | + : See the License for the specific language governing permissions and |
295 | + : limitations under the License. |
296 | +:) |
297 | +import module namespace file = "http://expath.org/ns/file"; |
298 | + |
299 | +declare variable $auditspecfile as xs:string external; |
300 | + |
301 | +declare function local:gen-group-spec($group as element()?) as xs:string* |
302 | +{ |
303 | + if ($group) |
304 | + then |
305 | + ($group/@name, local:gen-group-spec($group/parent::group)) |
306 | + else () |
307 | +}; |
308 | + |
309 | + |
310 | +declare function local:group($group-spec as xs:string*) as xs:string |
311 | +{ |
312 | +'extern const PropertyGroupImpl ' |
313 | + || string-join($group-spec ! upper-case(.), "_") |
314 | + || '; |
315 | +' |
316 | +}; |
317 | + |
318 | +string-join( |
319 | + ( |
320 | + let $spec := parse-xml(file:read-text($auditspecfile)) |
321 | + for $first-prop in $spec//group/property[1] |
322 | + let $group-spec := reverse(local:gen-group-spec($first-prop/parent::group)) |
323 | + return |
324 | + local:group($group-spec) || |
325 | + string-join( |
326 | + for $prop in ($first-prop, $first-prop/following-sibling::property) |
327 | + return |
328 | + 'extern const PropertyImpl ' |
329 | + || string-join($group-spec ! upper-case(.), "_") |
330 | + || '_' || replace(upper-case($prop/@name), "-", "_") |
331 | + || ';' |
332 | + , " |
333 | +") || ' |
334 | + |
335 | +')) |
336 | + |
337 | |
338 | === added directory 'src/api/pregenerated' |
339 | === added file 'src/api/pregenerated/auditprops.cpp' |
340 | --- src/api/pregenerated/auditprops.cpp 1970-01-01 00:00:00 +0000 |
341 | +++ src/api/pregenerated/auditprops.cpp 2013-04-03 23:02:22 +0000 |
342 | @@ -0,0 +1,16 @@ |
343 | +const char* XQUERY_COMPILATION_PATH[] = { "xquery", "compilation" }; |
344 | +const PropertyGroupImpl XQUERY_COMPILATION(2, XQUERY_COMPILATION_PATH); |
345 | +const PropertyImpl XQUERY_COMPILATION_FILENAME(XQUERY_COMPILATION, "filename", 0, Property::STRING); |
346 | +const PropertyImpl XQUERY_COMPILATION_PARSE_DURATION(XQUERY_COMPILATION, "parse-duration", 1, Property::INT); |
347 | +const PropertyImpl XQUERY_COMPILATION_TRANSLATION_DURATION(XQUERY_COMPILATION, "translation-duration", 2, Property::INT); |
348 | +const PropertyImpl XQUERY_COMPILATION_OPTIMIZATION_DURATION(XQUERY_COMPILATION, "optimization-duration", 3, Property::INT); |
349 | +const PropertyImpl XQUERY_COMPILATION_CODEGENERATION_DURATION(XQUERY_COMPILATION, "codegeneration-duration", 4, Property::INT); |
350 | + |
351 | + |
352 | +const PropertyImpl* PROPERTIES[] = { |
353 | + &XQUERY_COMPILATION_FILENAME, |
354 | + &XQUERY_COMPILATION_PARSE_DURATION, |
355 | + &XQUERY_COMPILATION_TRANSLATION_DURATION, |
356 | + &XQUERY_COMPILATION_OPTIMIZATION_DURATION, |
357 | + &XQUERY_COMPILATION_CODEGENERATION_DURATION |
358 | +}; |
359 | |
360 | === added file 'src/api/pregenerated/auditprops.h' |
361 | --- src/api/pregenerated/auditprops.h 1970-01-01 00:00:00 +0000 |
362 | +++ src/api/pregenerated/auditprops.h 2013-04-03 23:02:22 +0000 |
363 | @@ -0,0 +1,7 @@ |
364 | +extern const PropertyGroupImpl XQUERY_COMPILATION; |
365 | +extern const PropertyImpl XQUERY_COMPILATION_FILENAME; |
366 | +extern const PropertyImpl XQUERY_COMPILATION_PARSE_DURATION; |
367 | +extern const PropertyImpl XQUERY_COMPILATION_TRANSLATION_DURATION; |
368 | +extern const PropertyImpl XQUERY_COMPILATION_OPTIMIZATION_DURATION; |
369 | +extern const PropertyImpl XQUERY_COMPILATION_CODEGENERATION_DURATION; |
370 | + |
Validation queue starting for merge proposal. zorbatest. lambda. nu:8080/ remotequeue/ feature- gen_audit_ props-2013- 04-03T23- 11-43.877Z/ log.html
Log at: http://