Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 1 | :: Copyright 2015 Google Inc. All rights reserved. |
| 2 | :: |
| 3 | :: Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | :: you may not use this file except in compliance with the License. |
| 5 | :: You may obtain a copy of the License at |
| 6 | :: |
| 7 | :: http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | :: |
| 9 | :: Unless required by applicable law or agreed to in writing, software |
| 10 | :: distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | :: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | :: See the License for the specific language governing permissions and |
| 13 | :: limitations under the License. |
| 14 | |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame^] | 15 | @SETLOCAL |
| 16 | |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 17 | set buildtype=Release |
| 18 | if "%1"=="-b" set buildtype=%2 |
| 19 | |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame^] | 20 | set commandline=%* |
| 21 | |
| 22 | |
| 23 | if NOT "%commandline%"=="%commandline:--cpp-std c++0x=%" ( |
| 24 | set TEST_CPP_FLAGS=--cpp-std c++0x |
| 25 | ) else ( |
| 26 | @rem --cpp-std is defined by flatc default settings. |
| 27 | set TEST_CPP_FLAGS= |
| 28 | ) |
| 29 | |
| 30 | set TEST_CPP_FLAGS=--gen-compare --cpp-ptr-type flatbuffers::unique_ptr %TEST_CPP_FLAGS% |
| 31 | set TEST_CS_FLAGS=--cs-gen-json-serializer |
| 32 | set TEST_JS_TS_FLAGS=--gen-name-strings |
| 33 | set TEST_RUST_FLAGS=--gen-name-strings |
| 34 | set TEST_BASE_FLAGS=--reflect-names --gen-mutable --gen-object-api |
| 35 | set TEST_NOINCL_FLAGS=%TEST_BASE_FLAGS% --no-includes --no-fb-import |
| 36 | |
| 37 | ..\%buildtype%\flatc.exe --binary --cpp --java --kotlin --csharp --dart --go --lobster --lua --js --ts --php --grpc ^ |
| 38 | %TEST_NOINCL_FLAGS% %TEST_CPP_FLAGS% %TEST_CS_FLAGS% -I include_test monster_test.fbs monsterdata_test.json || goto FAIL |
| 39 | ..\%buildtype%\flatc.exe --rust %TEST_NOINCL_FLAGS% %TEST_RUST_FLAGS% -I include_test monster_test.fbs monsterdata_test.json || goto FAIL |
| 40 | |
| 41 | ..\%buildtype%\flatc.exe --python %TEST_BASE_FLAGS% --no-fb-import -I include_test monster_test.fbs monsterdata_test.json || goto FAIL |
| 42 | |
| 43 | ..\%buildtype%\flatc.exe --binary --cpp --java --csharp --dart --go --lobster --lua --js --ts --php --python --rust ^ |
| 44 | %TEST_NOINCL_FLAGS% %TEST_CPP_FLAGS% %TEST_CS_FLAGS% %TEST_JS_TS_FLAGS% -o namespace_test namespace_test/namespace_test1.fbs namespace_test/namespace_test2.fbs || goto FAIL |
| 45 | |
| 46 | ..\%buildtype%\flatc.exe --cpp --java --csharp --js --ts --php %TEST_BASE_FLAGS% %TEST_CPP_FLAGS% %TEST_CS_FLAGS% %TEST_JS_TS_FLAGS% -o union_vector ./union_vector/union_vector.fbs || goto FAIL |
| 47 | ..\%buildtype%\flatc.exe --rust -I include_test -o include_test include_test/include_test1.fbs || goto FAIL |
| 48 | ..\%buildtype%\flatc.exe --rust -I include_test -o include_test/sub include_test/sub/include_test2.fbs || goto FAIL |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 49 | ..\%buildtype%\flatc.exe -b --schema --bfbs-comments --bfbs-builtins -I include_test monster_test.fbs || goto FAIL |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame^] | 50 | ..\%buildtype%\flatc.exe --cpp --bfbs-comments --bfbs-builtins --bfbs-gen-embed %TEST_NOINCL_FLAGS% %TEST_CPP_FLAGS% -I include_test monster_test.fbs || goto FAIL |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 51 | ..\%buildtype%\flatc.exe -b --schema --bfbs-comments --bfbs-builtins -I include_test arrays_test.fbs || goto FAIL |
| 52 | ..\%buildtype%\flatc.exe --jsonschema --schema -I include_test monster_test.fbs || goto FAIL |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame^] | 53 | ..\%buildtype%\flatc.exe --cpp --java --csharp --jsonschema %TEST_NOINCL_FLAGS% %TEST_CPP_FLAGS% %TEST_CS_FLAGS% --scoped-enums arrays_test.fbs || goto FAIL |
| 54 | ..\%buildtype%\flatc.exe --python %TEST_BASE_FLAGS% arrays_test.fbs || goto FAIL |
| 55 | ..\%buildtype%\flatc.exe --cpp %TEST_BASE_FLAGS% --cpp-ptr-type flatbuffers::unique_ptr native_type_test.fbs || goto FAIL |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 56 | |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame^] | 57 | @rem Generate the optional scalar code for tests. |
| 58 | ..\%buildtype%\flatc.exe --csharp --java --kotlin --rust --lobster --ts --js optional_scalars.fbs || goto FAIL |
| 59 | ..\%buildtype%\flatc.exe %TEST_NOINCL_FLAGS% %TEST_CPP_FLAGS% --cpp optional_scalars.fbs || goto FAIL |
| 60 | |
| 61 | @rem Generate the schema evolution tests |
| 62 | ..\%buildtype%\flatc.exe --cpp --scoped-enums %TEST_CPP_FLAGS% -o evolution_test ./evolution_test/evolution_v1.fbs ./evolution_test/evolution_v2.fbs || goto FAIL |
| 63 | |
| 64 | if NOT "%MONSTER_EXTRA%"=="skip" ( |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 65 | @echo Generate MosterExtra |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame^] | 66 | ..\%buildtype%\flatc.exe --cpp --java --csharp %TEST_NOINCL_FLAGS% %TEST_CPP_FLAGS% %TEST_CS_FLAGS% monster_extra.fbs monsterdata_extra.json || goto FAIL |
| 67 | ..\%buildtype%\flatc.exe --python %TEST_BASE_FLAGS% monster_extra.fbs monsterdata_extra.json || goto FAIL |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 68 | ) else ( |
| 69 | @echo monster_extra.fbs skipped (the strtod function from MSVC2013 or older doesn't support NaN/Inf arguments) |
| 70 | ) |
| 71 | |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame^] | 72 | set TEST_CPP17_FLAGS=--cpp --cpp-std c++17 -o ./cpp17/generated_cpp17 %TEST_NOINCL_FLAGS% |
| 73 | if NOT "%MONSTER_EXTRA%"=="skip" ( |
| 74 | @rem Flag c++17 requires Clang6, GCC7, MSVC2017 (_MSC_VER >= 1914) or higher. |
| 75 | ..\%buildtype%\flatc.exe %TEST_CPP17_FLAGS% -I include_test monster_test.fbs || goto FAIL |
| 76 | ..\%buildtype%\flatc.exe %TEST_CPP17_FLAGS% optional_scalars.fbs || goto FAIL |
| 77 | @rem..\%buildtype%\flatc.exe %TEST_CPP17_FLAGS% arrays_test.fbs || goto FAIL |
| 78 | @rem..\%buildtype%\flatc.exe %TEST_CPP17_FLAGS% native_type_test.fbs || goto FAIL |
| 79 | @rem..\%buildtype%\flatc.exe %TEST_CPP17_FLAGS% monster_extra.fbs || goto FAIL |
| 80 | @rem..\%buildtype%\flatc.exe %TEST_CPP17_FLAGS% ./union_vector/union_vector.fbs || goto FAIL |
| 81 | ) |
| 82 | |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 83 | cd ../samples |
Austin Schuh | 272c613 | 2020-11-14 16:37:52 -0800 | [diff] [blame^] | 84 | ..\%buildtype%\flatc.exe --cpp --lobster %TEST_BASE_FLAGS% %TEST_CPP_FLAGS% monster.fbs || goto FAIL |
Austin Schuh | e89fa2d | 2019-08-14 20:24:23 -0700 | [diff] [blame] | 85 | ..\%buildtype%\flatc.exe -b --schema --bfbs-comments --bfbs-builtins monster.fbs || goto FAIL |
| 86 | cd ../reflection |
| 87 | call generate_code.bat %1 %2 || goto FAIL |
| 88 | |
| 89 | set EXITCODE=0 |
| 90 | goto SUCCESS |
| 91 | :FAIL |
| 92 | set EXITCODE=1 |
| 93 | :SUCCESS |
| 94 | cd ../tests |
| 95 | EXIT /B %EXITCODE% |