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
15set buildtype=Release
16if "%1"=="-b" set buildtype=%2
17
18..\%buildtype%\flatc.exe --cpp --java --csharp --go --binary --python --lobster --lua --js --rust --ts --php --grpc --gen-mutable --reflect-names --gen-object-api --gen-compare --no-includes --cpp-ptr-type flatbuffers::unique_ptr --no-fb-import -I include_test monster_test.fbs monsterdata_test.json || goto FAIL
19..\%buildtype%\flatc.exe --cpp --java --csharp --go --binary --python --lobster --lua --js --rust --ts --php --gen-mutable --reflect-names --no-fb-import --cpp-ptr-type flatbuffers::unique_ptr  -o namespace_test namespace_test/namespace_test1.fbs namespace_test/namespace_test2.fbs || goto FAIL
20..\%buildtype%\flatc.exe --cpp --java --js --ts --php --gen-mutable --reflect-names --gen-object-api --gen-compare --cpp-ptr-type flatbuffers::unique_ptr -o union_vector ./union_vector/union_vector.fbs || goto FAIL
21..\%buildtype%\flatc.exe -b --schema --bfbs-comments --bfbs-builtins -I include_test monster_test.fbs || goto FAIL
22..\%buildtype%\flatc.exe --jsonschema --schema -I include_test monster_test.fbs || goto FAIL
23
24IF NOT "%MONSTER_EXTRA%"=="skip" (
25  @echo Generate MosterExtra
26  ..\%buildtype%\flatc.exe --cpp --java --csharp --python --gen-mutable --reflect-names --gen-object-api --gen-compare --no-includes monster_extra.fbs || goto FAIL
27) else (
28  @echo monster_extra.fbs skipped (the strtod function from MSVC2013 or older doesn't support NaN/Inf arguments)
29)
30
31cd ../samples
32..\%buildtype%\flatc.exe --cpp --lobster --gen-mutable --reflect-names --gen-object-api --gen-compare --cpp-ptr-type flatbuffers::unique_ptr monster.fbs || goto FAIL
33..\%buildtype%\flatc.exe -b --schema --bfbs-comments --bfbs-builtins monster.fbs || goto FAIL
34cd ../reflection
35call generate_code.bat %1 %2 || goto FAIL
36
37set EXITCODE=0
38goto SUCCESS
39:FAIL
40set EXITCODE=1
41:SUCCESS
42cd ../tests
43EXIT /B %EXITCODE%
44