Nobuaki Sukegawa | 11da87e | 2016-09-10 14:02:19 +0900 | [diff] [blame] | 1 | # |
| 2 | # Licensed to the Apache Software Foundation (ASF) under one |
| 3 | # or more contributor license agreements. See the NOTICE file |
| 4 | # distributed with this work for additional information |
| 5 | # regarding copyright ownership. The ASF licenses this file |
| 6 | # to you under the Apache License, Version 2.0 (the |
| 7 | # "License"); you may not use this file except in compliance |
| 8 | # with the License. You may obtain a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, |
| 13 | # software distributed under the License is distributed on an |
| 14 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 15 | # KIND, either express or implied. See the License for the |
| 16 | # specific language governing permissions and limitations |
| 17 | # under the License. |
| 18 | # |
| 19 | |
nsrtvwls | 014f53f | 2018-09-28 08:11:21 -0700 | [diff] [blame] | 20 | file(GLOB KEYWORD_SAMPLES "${CMAKE_CURRENT_SOURCE_DIR}/keyword-samples/*.thrift") |
Jens Geyer | ec0141c | 2022-10-15 18:50:14 +0200 | [diff] [blame] | 21 | set(KEYWORD_LANGS php) # the whole ticket THRIFT-4655 is only about PHP so leave other languages alone |
| 22 | LIST(REMOVE_ITEM KEYWORD_LANGS swift) # in Swift you can escape reserved words (and in other languages as well) |
Jano Svitok | 4fd001c | 2020-03-13 01:28:03 +0100 | [diff] [blame] | 23 | foreach(LANG ${KEYWORD_LANGS}) |
nsrtvwls | 014f53f | 2018-09-28 08:11:21 -0700 | [diff] [blame] | 24 | foreach(SAMPLE ${KEYWORD_SAMPLES}) |
| 25 | get_filename_component(FILENAME ${SAMPLE} NAME_WE) |
| 26 | add_test(NAME "${LANG}_${FILENAME}" |
| 27 | COMMAND thrift-compiler --gen ${LANG} ${SAMPLE}) |
| 28 | set_tests_properties("${LANG}_${FILENAME}" PROPERTIES |
| 29 | PASS_REGULAR_EXPRESSION "Cannot use reserved language keyword") |
| 30 | endforeach() |
| 31 | endforeach() |
| 32 | |
James E. King III | 278528c | 2019-01-11 12:17:44 -0500 | [diff] [blame] | 33 | find_package(PythonInterp QUIET) |
| 34 | if(PYTHONINTERP_FOUND) |
| 35 | add_test(NAME StalenessCheckTest COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/compiler/staleness_check.py ${THRIFT_COMPILER}) |
| 36 | else() |
| 37 | message(WARNING "Skipping StalenessCheckTest as there is no python interpreter available.") |
James E. King III | 29f7f8f | 2019-01-26 09:15:19 -0500 | [diff] [blame] | 38 | endif() |