mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-26 21:12:19 +00:00
Removed test/generate_code.{sh|bat} (#6873)
* removed test/generate_code.{sh|bat}
remove c++0x from generate_code.py
added check generate code script in python
add windows specific call
added flags to generate_code.py
Set c++-0x on BUILD_LEGACY
Skip generating monster_extra if requested
* added option to skip monster extra
* add conditional to skip 2010 check gen
This commit is contained in:
@@ -1,41 +0,0 @@
|
|||||||
:: Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
::
|
|
||||||
:: Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
:: you may not use this file except in compliance with the License.
|
|
||||||
:: You may obtain a copy of the License at
|
|
||||||
::
|
|
||||||
:: http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
::
|
|
||||||
:: Unless required by applicable law or agreed to in writing, software
|
|
||||||
:: distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
:: See the License for the specific language governing permissions and
|
|
||||||
:: limitations under the License.
|
|
||||||
set buildtype=Release
|
|
||||||
if "%1"=="-b" set buildtype=%2
|
|
||||||
|
|
||||||
cd tests
|
|
||||||
call generate_code.bat -b %buildtype% || goto FAIL
|
|
||||||
|
|
||||||
:: TODO: Release and Debug builds produce differences here for some reason.
|
|
||||||
git checkout HEAD -- monster_test.bfbs
|
|
||||||
git checkout HEAD -- arrays_test.bfbs
|
|
||||||
|
|
||||||
git -c core.autocrlf=true diff --exit-code --quiet || goto :DIFFFOUND
|
|
||||||
goto SUCCESS
|
|
||||||
|
|
||||||
:DIFFFOUND
|
|
||||||
@echo "" >&2
|
|
||||||
@echo "ERROR: ********************************************************" >&2
|
|
||||||
@echo "ERROR: The following differences were found after building." >&2
|
|
||||||
@echo "ERROR: Perhaps there is a difference in the flags for the" >&2
|
|
||||||
@echo "ERROR: CMakeLists.txt vs the tests/generate_code.bat script?" >&2
|
|
||||||
@echo "ERROR: ********************************************************" >&2
|
|
||||||
@echo "" >&2
|
|
||||||
@git -c core.autocrlf=true --no-pager diff --binary
|
|
||||||
|
|
||||||
:FAIL
|
|
||||||
set EXITCODE=1
|
|
||||||
:SUCCESS
|
|
||||||
cd ..
|
|
||||||
EXIT /B %EXITCODE%
|
|
||||||
13
.github/PULL_REQUEST_TEMPLATE.md
vendored
13
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -2,14 +2,13 @@ Thank you for submitting a PR!
|
|||||||
|
|
||||||
Please delete this standard text once you've created your own description.
|
Please delete this standard text once you've created your own description.
|
||||||
|
|
||||||
Make sure you include the names of the affected language(s) in your PR title.
|
If you make changes to any of the code generators (`src/idl_gen*`) be sure to
|
||||||
This helps us get the correct maintainers to look at your issue.
|
build your project, as it will generate code based on the changes. If necessary
|
||||||
|
the code generation script can be directly run (`scripts/generate_code.py`),
|
||||||
|
requires Python3. This allows us to better see the effect of the PR.
|
||||||
|
|
||||||
If you make changes to any of the code generators, be sure to run
|
If your PR includes C++ code, please adhere to the
|
||||||
`cd tests && bash generate_code.sh` (or equivalent .bat) and include the generated
|
[Google C++ Style Guide](https://google.github.io/styleguide/cppguide.html),
|
||||||
code changes in the PR. This allows us to better see the effect of the PR.
|
|
||||||
|
|
||||||
If your PR includes C++ code, please adhere to the Google C++ Style Guide,
|
|
||||||
and don't forget we try to support older compilers (e.g. VS2010, GCC 4.6.3),
|
and don't forget we try to support older compilers (e.g. VS2010, GCC 4.6.3),
|
||||||
so only some C++11 support is available.
|
so only some C++11 support is available.
|
||||||
|
|
||||||
|
|||||||
4
.github/workflows/build.yml
vendored
4
.github/workflows/build.yml
vendored
@@ -136,7 +136,9 @@ jobs:
|
|||||||
- name: cmake
|
- name: cmake
|
||||||
run: CXX=${{ matrix.cxx }} cmake -G "Unix Makefiles" -DFLATBUFFERS_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release . && make -j4
|
run: CXX=${{ matrix.cxx }} cmake -G "Unix Makefiles" -DFLATBUFFERS_BUILD_TESTS=OFF -DCMAKE_BUILD_TYPE=Release . && make -j4
|
||||||
- name: Generate
|
- name: Generate
|
||||||
run: bash scripts/check-generate-code.sh && bash scripts/check-grpc-generated-code.sh
|
run: scripts/check_generate_code.py
|
||||||
|
- name: Generate gRPC
|
||||||
|
run: bash scripts/check-grpc-generated-code.sh
|
||||||
|
|
||||||
build-benchmarks:
|
build-benchmarks:
|
||||||
name: Build Benchmarks (on Linux)
|
name: Build Benchmarks (on Linux)
|
||||||
|
|||||||
@@ -115,7 +115,6 @@ matrix:
|
|||||||
-DFLATBUFFERS_CODE_SANITIZE=ON
|
-DFLATBUFFERS_CODE_SANITIZE=ON
|
||||||
- cmake --build . --target all --clean-first -- -j${JOBS}
|
- cmake --build . --target all --clean-first -- -j${JOBS}
|
||||||
- LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/google/grpc/install/lib ctest --extra-verbose --output-on-failure
|
- LD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/google/grpc/install/lib ctest --extra-verbose --output-on-failure
|
||||||
- bash scripts/check-generate-code.sh
|
|
||||||
|
|
||||||
- language: cpp
|
- language: cpp
|
||||||
os: osx
|
os: osx
|
||||||
@@ -140,7 +139,6 @@ matrix:
|
|||||||
-DFLATBUFFERS_CODE_SANITIZE=ON
|
-DFLATBUFFERS_CODE_SANITIZE=ON
|
||||||
- cmake --build . -- -j${JOBS}
|
- cmake --build . -- -j${JOBS}
|
||||||
- DYLD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/google/grpc/install/lib ctest --extra-verbose --output-on-failure
|
- DYLD_LIBRARY_PATH=$TRAVIS_BUILD_DIR/google/grpc/install/lib ctest --extra-verbose --output-on-failure
|
||||||
- bash scripts/check-generate-code.sh
|
|
||||||
|
|
||||||
- <<: *conan-linux-master
|
- <<: *conan-linux-master
|
||||||
env: CONAN_GCC_VERSIONS=8 CONAN_DOCKER_IMAGE=conanio/gcc8
|
env: CONAN_GCC_VERSIONS=8 CONAN_DOCKER_IMAGE=conanio/gcc8
|
||||||
|
|||||||
@@ -54,6 +54,9 @@ option(FLATBUFFERS_ENABLE_PCH
|
|||||||
Only work if CMake supports 'target_precompile_headers'. \"
|
Only work if CMake supports 'target_precompile_headers'. \"
|
||||||
This can speed up compilation time."
|
This can speed up compilation time."
|
||||||
OFF)
|
OFF)
|
||||||
|
option(FLATBUFFERS_SKIP_MONSTER_EXTRA
|
||||||
|
"Skip generating monster_extra.fbs that contains non-supported numerical\"
|
||||||
|
types." OFF)
|
||||||
|
|
||||||
if(NOT FLATBUFFERS_BUILD_FLATC AND FLATBUFFERS_BUILD_TESTS)
|
if(NOT FLATBUFFERS_BUILD_FLATC AND FLATBUFFERS_BUILD_TESTS)
|
||||||
message(WARNING
|
message(WARNING
|
||||||
@@ -466,7 +469,7 @@ function(compile_flatbuffers_schema_to_binary SRC_FBS)
|
|||||||
message(STATUS "`${SRC_FBS}`: add generation of binary (.bfbs) schema")
|
message(STATUS "`${SRC_FBS}`: add generation of binary (.bfbs) schema")
|
||||||
get_filename_component(SRC_FBS_DIR ${SRC_FBS} PATH)
|
get_filename_component(SRC_FBS_DIR ${SRC_FBS} PATH)
|
||||||
string(REGEX REPLACE "\\.fbs$" ".bfbs" GEN_BINARY_SCHEMA ${SRC_FBS})
|
string(REGEX REPLACE "\\.fbs$" ".bfbs" GEN_BINARY_SCHEMA ${SRC_FBS})
|
||||||
# For details about flags see generate_code.bat(sh)
|
# For details about flags see generate_code.py
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${GEN_BINARY_SCHEMA}
|
OUTPUT ${GEN_BINARY_SCHEMA}
|
||||||
COMMAND "${FLATBUFFERS_FLATC_EXECUTABLE}"
|
COMMAND "${FLATBUFFERS_FLATC_EXECUTABLE}"
|
||||||
@@ -489,7 +492,7 @@ function(compile_flatbuffers_schema_to_embedded_binary SRC_FBS OPT)
|
|||||||
message(STATUS "`${SRC_FBS}`: add generation of C++ embedded binary schema code with '${OPT}'")
|
message(STATUS "`${SRC_FBS}`: add generation of C++ embedded binary schema code with '${OPT}'")
|
||||||
get_filename_component(SRC_FBS_DIR ${SRC_FBS} PATH)
|
get_filename_component(SRC_FBS_DIR ${SRC_FBS} PATH)
|
||||||
string(REGEX REPLACE "\\.fbs$" "_bfbs_generated.h" GEN_BFBS_HEADER ${SRC_FBS})
|
string(REGEX REPLACE "\\.fbs$" "_bfbs_generated.h" GEN_BFBS_HEADER ${SRC_FBS})
|
||||||
# For details about flags see generate_code.bat(sh)
|
# For details about flags see generate_code.py
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${GEN_BFBS_HEADER}
|
OUTPUT ${GEN_BFBS_HEADER}
|
||||||
COMMAND "${FLATBUFFERS_FLATC_EXECUTABLE}"
|
COMMAND "${FLATBUFFERS_FLATC_EXECUTABLE}"
|
||||||
@@ -509,22 +512,32 @@ endfunction()
|
|||||||
# Look if we have python 3 installed so that we can run the generate code python
|
# Look if we have python 3 installed so that we can run the generate code python
|
||||||
# script after flatc is built.
|
# script after flatc is built.
|
||||||
find_package(PythonInterp 3)
|
find_package(PythonInterp 3)
|
||||||
|
|
||||||
if(PYTHONINTERP_FOUND AND
|
if(PYTHONINTERP_FOUND AND
|
||||||
# Skip doing this if the MSVC version is below VS 12.
|
# Skip doing this if the MSVC version is below VS 12.
|
||||||
# https://cmake.org/cmake/help/latest/variable/MSVC_VERSION.html
|
# https://cmake.org/cmake/help/latest/variable/MSVC_VERSION.html
|
||||||
(NOT MSVC OR MSVC_VERSION GREATER 1800))
|
(NOT MSVC OR MSVC_VERSION GREATER 1800))
|
||||||
if(WIN32)
|
if(WIN32)
|
||||||
set(GENERATION_SCRIPT py scripts/generate_code.py)
|
set(GENERATION_SCRIPT py scripts/generate_code.py)
|
||||||
else()
|
else()
|
||||||
set(GENERATION_SCRIPT scripts/generate_code.py)
|
set(GENERATION_SCRIPT scripts/generate_code.py)
|
||||||
endif()
|
endif()
|
||||||
|
if(FLATBUFFERS_BUILD_LEGACY)
|
||||||
|
# Need to set --cpp-std c++-0x options
|
||||||
|
set(GENERATION_SCRIPT ${GENERATION_SCRIPT} --cpp-0x)
|
||||||
|
endif()
|
||||||
|
if(FLATBUFFERS_SKIP_MONSTER_EXTRA)
|
||||||
|
set(GENERATION_SCRIPT ${GENERATION_SCRIPT} --skip-monster-extra)
|
||||||
|
endif()
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
TARGET flatc
|
TARGET flatc
|
||||||
POST_BUILD
|
POST_BUILD
|
||||||
COMMAND ${GENERATION_SCRIPT} "${FLATBUFFERS_FLATC_EXECUTABLE}"
|
COMMAND ${GENERATION_SCRIPT} --flatc "${FLATBUFFERS_FLATC_EXECUTABLE}"
|
||||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||||
COMMENT "Running ${GENERATION_SCRIPT}..."
|
COMMENT "Running ${GENERATION_SCRIPT}..."
|
||||||
VERBATIM)
|
VERBATIM)
|
||||||
|
else()
|
||||||
|
message("No Python3 interpreter found! Unable to generate files automatically.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(FLATBUFFERS_BUILD_TESTS)
|
if(FLATBUFFERS_BUILD_TESTS)
|
||||||
@@ -568,7 +581,7 @@ if(FLATBUFFERS_BUILD_TESTS)
|
|||||||
if(FLATBUFFERS_BUILD_CPP17)
|
if(FLATBUFFERS_BUILD_CPP17)
|
||||||
# Don't generate header for flattests_cpp17 target.
|
# Don't generate header for flattests_cpp17 target.
|
||||||
# This target uses "generated_cpp17/monster_test_generated.h"
|
# This target uses "generated_cpp17/monster_test_generated.h"
|
||||||
# produced by direct call of generate_code.bat(sh) script.
|
# produced by direct call of generate_code.py script.
|
||||||
add_executable(flattests_cpp17 ${FlatBuffers_Tests_CPP17_SRCS})
|
add_executable(flattests_cpp17 ${FlatBuffers_Tests_CPP17_SRCS})
|
||||||
add_dependencies(flattests_cpp17 generated_code)
|
add_dependencies(flattests_cpp17 generated_code)
|
||||||
target_compile_features(flattests_cpp17 PRIVATE cxx_std_17)
|
target_compile_features(flattests_cpp17 PRIVATE cxx_std_17)
|
||||||
|
|||||||
15
appveyor.yml
15
appveyor.yml
@@ -11,21 +11,21 @@ environment:
|
|||||||
CONDA_INSTALL_LOCN: "C:\\Miniconda35-x64"
|
CONDA_INSTALL_LOCN: "C:\\Miniconda35-x64"
|
||||||
CMAKE_OPTIONS: ""
|
CMAKE_OPTIONS: ""
|
||||||
CPP_TEST_OPTIONS: ""
|
CPP_TEST_OPTIONS: ""
|
||||||
|
CHECK_GEN_CODE: 1
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||||
CMAKE_VS_VERSION: "10 2010"
|
CMAKE_VS_VERSION: "10 2010"
|
||||||
CMAKE_OPTIONS: "-DFLATBUFFERS_BUILD_LEGACY=1"
|
CMAKE_OPTIONS: "-DFLATBUFFERS_BUILD_LEGACY=1 -DFLATBUFFERS_SKIP_MONSTER_EXTRA=ON"
|
||||||
CPP_TEST_OPTIONS: "--std-cpp c++0x"
|
CHECK_GEN_CODE: 0
|
||||||
MONSTER_EXTRA: "skip"
|
|
||||||
|
|
||||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||||
CMAKE_VS_VERSION: "12 2013"
|
CMAKE_VS_VERSION: "12 2013"
|
||||||
MONSTER_EXTRA: "skip"
|
CMAKE_OPTIONS: "-DFLATBUFFERS_SKIP_MONSTER_EXTRA=ON"
|
||||||
|
CPP_TEST_OPTIONS: "--skip-monster-extra"
|
||||||
|
|
||||||
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
|
||||||
CMAKE_VS_VERSION: "14 2015"
|
CMAKE_VS_VERSION: "14 2015"
|
||||||
MONSTER_EXTRA: ""
|
|
||||||
|
|
||||||
platform:
|
platform:
|
||||||
- x86
|
- x86
|
||||||
@@ -36,7 +36,6 @@ configuration:
|
|||||||
- Release
|
- Release
|
||||||
|
|
||||||
before_build:
|
before_build:
|
||||||
- set MONSTER_EXTRA=%MONSTER_EXTRA%
|
|
||||||
- cmake . -G"Visual Studio %CMAKE_VS_VERSION%" -DFLATBUFFERS_CODE_SANITIZE=1 %CMAKE_OPTIONS%
|
- cmake . -G"Visual Studio %CMAKE_VS_VERSION%" -DFLATBUFFERS_CODE_SANITIZE=1 %CMAKE_OPTIONS%
|
||||||
# This cuts down on a lot of noise generated by xamarin warnings.
|
# This cuts down on a lot of noise generated by xamarin warnings.
|
||||||
- if exist "C:\Program Files (x86)\MSBuild\14.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets" del "C:\Program Files (x86)\MSBuild\14.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets"
|
- if exist "C:\Program Files (x86)\MSBuild\14.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets" del "C:\Program Files (x86)\MSBuild\14.0\Microsoft.Common.targets\ImportAfter\Xamarin.Common.targets"
|
||||||
@@ -54,10 +53,8 @@ install:
|
|||||||
- ps: Install-Product node $env:nodejs_version
|
- ps: Install-Product node $env:nodejs_version
|
||||||
|
|
||||||
test_script:
|
test_script:
|
||||||
- call .appveyor\check-generate-code.bat -b %CONFIGURATION%
|
- if [%CHECK_GEN_CODE%]==[1] (call py scripts/check_generate_code.py "%CPP_TEST_OPTIONS%")
|
||||||
- "cd tests"
|
- "cd tests"
|
||||||
- rem "Building all code"
|
|
||||||
- generate_code.bat -b %CONFIGURATION% %CPP_TEST_OPTIONS%
|
|
||||||
- 7z a GeneratedMyGameCode.zip MyGame\
|
- 7z a GeneratedMyGameCode.zip MyGame\
|
||||||
- rem "---------------- C++ -----------------"
|
- rem "---------------- C++ -----------------"
|
||||||
- "cd .."
|
- "cd .."
|
||||||
|
|||||||
@@ -21,7 +21,7 @@
|
|||||||
// file) is needed to generate this header in the first place.
|
// file) is needed to generate this header in the first place.
|
||||||
// Should normally not be a problem since it can be generated by the
|
// Should normally not be a problem since it can be generated by the
|
||||||
// previous version of flatc whenever this code needs to change.
|
// previous version of flatc whenever this code needs to change.
|
||||||
// See reflection/generate_code.sh
|
// See scripts/generate_code.py for generation.
|
||||||
#include "flatbuffers/reflection_generated.h"
|
#include "flatbuffers/reflection_generated.h"
|
||||||
|
|
||||||
// Helper functionality for reflection.
|
// Helper functionality for reflection.
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
:: Copyright 2015 Google Inc. All rights reserved.
|
|
||||||
::
|
|
||||||
:: Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
:: you may not use this file except in compliance with the License.
|
|
||||||
:: You may obtain a copy of the License at
|
|
||||||
::
|
|
||||||
:: http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
::
|
|
||||||
:: Unless required by applicable law or agreed to in writing, software
|
|
||||||
:: distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
:: See the License for the specific language governing permissions and
|
|
||||||
:: limitations under the License.
|
|
||||||
|
|
||||||
set buildtype=Release
|
|
||||||
if "%1"=="-b" set buildtype=%2
|
|
||||||
|
|
||||||
..\%buildtype%\flatc.exe --cpp --cpp-std c++0x --no-prefix -o ../include/flatbuffers reflection.fbs || exit /b 1
|
|
||||||
@@ -1,31 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Copyright 2016 Google Inc. All rights reserved.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
set -e
|
|
||||||
|
|
||||||
tempDir="../include/flatbuffers/.tmp"
|
|
||||||
originalFile="../include/flatbuffers/reflection_generated.h"
|
|
||||||
newFile="$tempDir/reflection_generated.h"
|
|
||||||
|
|
||||||
../flatc -c --cpp-std c++0x --no-prefix -o $tempDir reflection.fbs
|
|
||||||
|
|
||||||
if [ -f "$newFile" ]; then
|
|
||||||
if ! cmp -s "$originalFile" "$newFile"; then
|
|
||||||
mv $newFile $originalFile
|
|
||||||
else
|
|
||||||
rm $newFile
|
|
||||||
fi
|
|
||||||
rmdir $tempDir
|
|
||||||
fi
|
|
||||||
@@ -1,47 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Copyright 2018 Google Inc. All rights reserved.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
set -e
|
|
||||||
|
|
||||||
if ! git diff --quiet; then
|
|
||||||
echo >&2
|
|
||||||
echo "ERROR: ********************************************************" >&2
|
|
||||||
echo "ERROR: The following differences were found after building." >&2
|
|
||||||
echo "ERROR: Perhaps there is a difference in the flags for the" >&2
|
|
||||||
echo "ERROR: CMakeLists.txt vs the tests/generate_code.sh script?" >&2
|
|
||||||
echo "ERROR: ********************************************************" >&2
|
|
||||||
echo >&2
|
|
||||||
git diff --binary --exit-code
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd tests
|
|
||||||
./generate_code.sh
|
|
||||||
cd ..
|
|
||||||
|
|
||||||
# TODO: Linux and macos builds produce differences here for some reason.
|
|
||||||
git checkout HEAD -- tests/monster_test.bfbs
|
|
||||||
git checkout HEAD -- tests/arrays_test.bfbs
|
|
||||||
git checkout HEAD -- samples/monster.bfbs
|
|
||||||
|
|
||||||
if ! git diff --quiet; then
|
|
||||||
echo >&2
|
|
||||||
echo "ERROR: ********************************************************" >&2
|
|
||||||
echo "ERROR: The following differences were found after running the" >&2
|
|
||||||
echo "ERROR: tests/generate_code.sh script. Maybe you forgot to run" >&2
|
|
||||||
echo "ERROR: it after making changes in a generator or schema?" >&2
|
|
||||||
echo "ERROR: ********************************************************" >&2
|
|
||||||
echo >&2
|
|
||||||
git diff --binary --exit-code
|
|
||||||
fi
|
|
||||||
63
scripts/check_generate_code.py
Executable file
63
scripts/check_generate_code.py
Executable file
@@ -0,0 +1,63 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
#
|
||||||
|
# Copyright 2021 Google Inc. All rights reserved.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
import platform
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
# Get the path where this script is located so we can invoke the script from
|
||||||
|
# any directory and have the paths work correctly.
|
||||||
|
script_path = Path(__file__).parent.resolve()
|
||||||
|
|
||||||
|
# Get the root path as an absolute path, so all derived paths are absolute.
|
||||||
|
root_path = script_path.parent.absolute()
|
||||||
|
|
||||||
|
result = subprocess.run(["git", "diff", "--quiet"], cwd=root_path)
|
||||||
|
|
||||||
|
if result.returncode != 0:
|
||||||
|
print(
|
||||||
|
"\n"
|
||||||
|
"ERROR: *********************************************************\n"
|
||||||
|
"ERROR: * The following differences were found after building. *\n"
|
||||||
|
"ERROR: * Perhaps there is a difference in the flags for the. *\n"
|
||||||
|
"ERROR: * CMakeLists.txt vs the script/generate_code.py script? *\n"
|
||||||
|
"ERROR: *********************************************************\n"
|
||||||
|
)
|
||||||
|
subprocess.run(["git", "diff", "--binary", "--exit-code"], cwd=root_path)
|
||||||
|
sys.exit(result.returncode)
|
||||||
|
|
||||||
|
# Rung the generate_code.py script, forwarding arguments
|
||||||
|
gen_cmd = ["scripts/generate_code.py"] + sys.argv[1:]
|
||||||
|
if platform.system() == "Windows":
|
||||||
|
gen_cmd = ["py"] + gen_cmd
|
||||||
|
subprocess.run(gen_cmd, cwd=root_path)
|
||||||
|
|
||||||
|
result = subprocess.run(["git", "diff", "--quiet"], cwd=root_path)
|
||||||
|
|
||||||
|
if result.returncode != 0:
|
||||||
|
print(
|
||||||
|
"\n"
|
||||||
|
"ERROR: ********************************************************\n"
|
||||||
|
"ERROR: * The following differences were found after running *\n"
|
||||||
|
"ERROR: * the script/generate_code.py script. Maybe you forgot *\n"
|
||||||
|
"ERROR: * to run it after making changes in a generator? *\n"
|
||||||
|
"ERROR: ********************************************************\n"
|
||||||
|
)
|
||||||
|
subprocess.run(["git", "diff", "--binary", "--exit-code"], cwd=root_path)
|
||||||
|
sys.exit(result.returncode)
|
||||||
|
|
||||||
|
sys.exit(0)
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
import argparse
|
||||||
import filecmp
|
import filecmp
|
||||||
import glob
|
import glob
|
||||||
import platform
|
import platform
|
||||||
@@ -22,6 +23,19 @@ import subprocess
|
|||||||
import sys
|
import sys
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
parser = argparse.ArgumentParser()
|
||||||
|
parser.add_argument(
|
||||||
|
"--flatc",
|
||||||
|
help="path of the Flat C compiler relative to the root directory",
|
||||||
|
)
|
||||||
|
parser.add_argument("--cpp-0x", action="store_true", help="use --cpp-std c++ox")
|
||||||
|
parser.add_argument(
|
||||||
|
"--skip-monster-extra",
|
||||||
|
action="store_true",
|
||||||
|
help="skip generating tests involving monster_extra.fbs",
|
||||||
|
)
|
||||||
|
args = parser.parse_args()
|
||||||
|
|
||||||
# Get the path where this script is located so we can invoke the script from
|
# Get the path where this script is located so we can invoke the script from
|
||||||
# any directory and have the paths work correctly.
|
# any directory and have the paths work correctly.
|
||||||
script_path = Path(__file__).parent.resolve()
|
script_path = Path(__file__).parent.resolve()
|
||||||
@@ -33,8 +47,8 @@ root_path = script_path.parent.absolute()
|
|||||||
# argument or defaulting to default names.
|
# argument or defaulting to default names.
|
||||||
flatc_exe = Path(
|
flatc_exe = Path(
|
||||||
("flatc" if not platform.system() == "Windows" else "flatc.exe")
|
("flatc" if not platform.system() == "Windows" else "flatc.exe")
|
||||||
if len(sys.argv) <= 1
|
if not args.flatc
|
||||||
else sys.argv[1]
|
else args.flatc
|
||||||
)
|
)
|
||||||
|
|
||||||
# Find and assert flatc compiler is present.
|
# Find and assert flatc compiler is present.
|
||||||
@@ -79,7 +93,8 @@ CPP_OPTS = [
|
|||||||
"--gen-compare",
|
"--gen-compare",
|
||||||
"--cpp-ptr-type",
|
"--cpp-ptr-type",
|
||||||
"flatbuffers::unique_ptr",
|
"flatbuffers::unique_ptr",
|
||||||
]
|
] + (["--cpp-std", "c++0x"] if args.cpp_0x else [])
|
||||||
|
|
||||||
CPP_17_OPTS = NO_INCL_OPTS + [
|
CPP_17_OPTS = NO_INCL_OPTS + [
|
||||||
"--cpp",
|
"--cpp",
|
||||||
"--cpp-std",
|
"--cpp-std",
|
||||||
@@ -230,11 +245,22 @@ flatc(
|
|||||||
schema="monster_test.fbs",
|
schema="monster_test.fbs",
|
||||||
)
|
)
|
||||||
|
|
||||||
flatc(
|
if not args.skip_monster_extra:
|
||||||
CPP_OPTS + CS_OPTS + NO_INCL_OPTS + JAVA_OPTS + KOTLIN_OPTS + PYTHON_OPTS,
|
flatc(
|
||||||
schema="monster_extra.fbs",
|
CPP_OPTS
|
||||||
data="monsterdata_extra.json",
|
+ CS_OPTS
|
||||||
)
|
+ NO_INCL_OPTS
|
||||||
|
+ JAVA_OPTS
|
||||||
|
+ KOTLIN_OPTS
|
||||||
|
+ PYTHON_OPTS,
|
||||||
|
schema="monster_extra.fbs",
|
||||||
|
data="monsterdata_extra.json",
|
||||||
|
)
|
||||||
|
|
||||||
|
flatc(
|
||||||
|
DART_OPTS + ["--gen-object-api"],
|
||||||
|
schema="monster_extra.fbs",
|
||||||
|
)
|
||||||
|
|
||||||
flatc(
|
flatc(
|
||||||
CPP_OPTS
|
CPP_OPTS
|
||||||
@@ -256,11 +282,6 @@ flatc(
|
|||||||
schema="arrays_test.fbs",
|
schema="arrays_test.fbs",
|
||||||
)
|
)
|
||||||
|
|
||||||
flatc(
|
|
||||||
DART_OPTS + ["--gen-object-api"],
|
|
||||||
schema="monster_extra.fbs",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
# Optional Scalars
|
# Optional Scalars
|
||||||
optional_scalars_schema = "optional_scalars.fbs"
|
optional_scalars_schema = "optional_scalars.fbs"
|
||||||
|
|||||||
@@ -10,6 +10,6 @@ cmake . -DCMAKE_BUILD_TYPE=$config \
|
|||||||
-DFLATBUFFERS_BUILD_TESTS=0 -DFLATBUFFERS_INSTALL=0
|
-DFLATBUFFERS_BUILD_TESTS=0 -DFLATBUFFERS_INSTALL=0
|
||||||
cmake --build . --target flatc --clean-first -- -j$JOBS
|
cmake --build . --target flatc --clean-first -- -j$JOBS
|
||||||
|
|
||||||
echo "Check generated code"
|
echo "Checking generated code"
|
||||||
scripts/check-generate-code.sh
|
scripts/check_generate_code.py
|
||||||
echo "Done"
|
echo "Done"
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ cmake . -DCMAKE_BUILD_TYPE=$config \
|
|||||||
cmake --build . --target all --clean-first -- -j$JOBS
|
cmake --build . --target all --clean-first -- -j$JOBS
|
||||||
ctest --extra-verbose --output-on-failure -j$JOBS
|
ctest --extra-verbose --output-on-failure -j$JOBS
|
||||||
|
|
||||||
echo "Check generated code"
|
echo "Checking generated code"
|
||||||
scripts/check-generate-code.sh
|
scripts/check_generate_code.py
|
||||||
|
|
||||||
echo "C++ tests done"
|
echo "C++ tests done"
|
||||||
|
|||||||
@@ -1,111 +0,0 @@
|
|||||||
:: Copyright 2015 Google Inc. All rights reserved.
|
|
||||||
::
|
|
||||||
:: Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
:: you may not use this file except in compliance with the License.
|
|
||||||
:: You may obtain a copy of the License at
|
|
||||||
::
|
|
||||||
:: http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
::
|
|
||||||
:: Unless required by applicable law or agreed to in writing, software
|
|
||||||
:: distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
:: See the License for the specific language governing permissions and
|
|
||||||
:: limitations under the License.
|
|
||||||
|
|
||||||
@SETLOCAL
|
|
||||||
|
|
||||||
set buildtype=Release
|
|
||||||
if "%1"=="-b" set buildtype=%2
|
|
||||||
|
|
||||||
set commandline=%*
|
|
||||||
|
|
||||||
|
|
||||||
if NOT "%commandline%"=="%commandline:--cpp-std c++0x=%" (
|
|
||||||
set TEST_CPP_FLAGS=--cpp-std c++0x
|
|
||||||
) else (
|
|
||||||
@rem --cpp-std is defined by flatc default settings.
|
|
||||||
set TEST_CPP_FLAGS=
|
|
||||||
)
|
|
||||||
|
|
||||||
set TEST_CPP_FLAGS=--gen-compare --cpp-ptr-type flatbuffers::unique_ptr %TEST_CPP_FLAGS%
|
|
||||||
set TEST_CS_FLAGS=--cs-gen-json-serializer
|
|
||||||
set TEST_TS_FLAGS=--gen-name-strings
|
|
||||||
set TEST_BASE_FLAGS=--reflect-names --gen-mutable --gen-object-api
|
|
||||||
set TEST_RUST_FLAGS=%TEST_BASE_FLAGS% --gen-name-strings --gen-all
|
|
||||||
set TEST_NOINCL_FLAGS=%TEST_BASE_FLAGS% --no-includes
|
|
||||||
|
|
||||||
..\%buildtype%\flatc.exe --binary --cpp --java --kotlin --csharp --dart --go --lobster --lua --ts --php --grpc ^
|
|
||||||
%TEST_NOINCL_FLAGS% %TEST_CPP_FLAGS% %TEST_CS_FLAGS% -I include_test monster_test.fbs monsterdata_test.json || goto FAIL
|
|
||||||
..\%buildtype%\flatc.exe --rust %TEST_RUST_FLAGS% -I include_test -o monster_test monster_test.fbs monsterdata_test.json || goto FAIL
|
|
||||||
|
|
||||||
..\%buildtype%\flatc.exe --python %TEST_BASE_FLAGS% -I include_test monster_test.fbs monsterdata_test.json || goto FAIL
|
|
||||||
|
|
||||||
..\%buildtype%\flatc.exe --binary --cpp --java --csharp --dart --go --lobster --lua --ts --php --python ^
|
|
||||||
%TEST_NOINCL_FLAGS% %TEST_CPP_FLAGS% %TEST_CS_FLAGS% %TEST_TS_FLAGS% -o namespace_test namespace_test/namespace_test1.fbs namespace_test/namespace_test2.fbs || goto FAIL
|
|
||||||
|
|
||||||
@rem For Rust we currently generate two independent schemas, with namespace_test2
|
|
||||||
@rem duplicating the types in namespace_test1
|
|
||||||
..\%buildtype%\flatc.exe --rust %TEST_RUST_FLAGS% -o namespace_test namespace_test/namespace_test1.fbs namespace_test/namespace_test2.fbs || goto FAIL
|
|
||||||
|
|
||||||
..\%buildtype%\flatc.exe --cpp --java --csharp --ts --php %TEST_BASE_FLAGS% %TEST_CPP_FLAGS% %TEST_CS_FLAGS% %TEST_TS_FLAGS% -o union_vector ./union_vector/union_vector.fbs || goto FAIL
|
|
||||||
..\%buildtype%\flatc.exe --ts --gen-name-strings --gen-mutable %TEST_BASE_FLAGS% %TEST_TS_FLAGS% -I include_test monster_test.fbs
|
|
||||||
..\%buildtype%\flatc.exe %TEST_BASE_FLAGS% %TEST_TS_FLAGS% -b -I include_test monster_test.fbs unicode_test.json
|
|
||||||
..\%buildtype%\flatc.exe --ts --gen-name-strings %TEST_BASE_FLAGS% %TEST_TS_FLAGS% -o union_vector union_vector/union_vector.fbs
|
|
||||||
..\%buildtype%\flatc.exe --rust %TEST_RUST_FLAGS% -I include_test -o include_test1 include_test/include_test1.fbs || goto FAIL
|
|
||||||
..\%buildtype%\flatc.exe --rust %TEST_RUST_FLAGS% -I include_test -o include_test2 include_test/sub/include_test2.fbs || goto FAIL
|
|
||||||
..\%buildtype%\flatc.exe -b --schema --bfbs-comments --bfbs-filenames . --bfbs-builtins -I include_test monster_test.fbs || goto FAIL
|
|
||||||
..\%buildtype%\flatc.exe --cpp --bfbs-comments --bfbs-filenames . --bfbs-builtins --bfbs-gen-embed %TEST_NOINCL_FLAGS% %TEST_CPP_FLAGS% -I include_test monster_test.fbs || goto FAIL
|
|
||||||
..\%buildtype%\flatc.exe -b --schema --bfbs-comments --bfbs-filenames . --bfbs-builtins -I include_test arrays_test.fbs || goto FAIL
|
|
||||||
..\%buildtype%\flatc.exe --jsonschema --schema -I include_test monster_test.fbs || goto FAIL
|
|
||||||
..\%buildtype%\flatc.exe --cpp --java --csharp --jsonschema %TEST_NOINCL_FLAGS% %TEST_CPP_FLAGS% %TEST_CS_FLAGS% --scoped-enums arrays_test.fbs || goto FAIL
|
|
||||||
..\%buildtype%\flatc.exe --rust %TEST_RUST_FLAGS% -o arrays_test arrays_test.fbs || goto FAIL
|
|
||||||
..\%buildtype%\flatc.exe --python %TEST_BASE_FLAGS% arrays_test.fbs || goto FAIL
|
|
||||||
..\%buildtype%\flatc.exe --cpp %TEST_BASE_FLAGS% --cpp-ptr-type flatbuffers::unique_ptr native_type_test.fbs || goto FAIL
|
|
||||||
|
|
||||||
@rem Generate the optional scalar code for tests.
|
|
||||||
..\%buildtype%\flatc.exe --java --kotlin --lobster --ts optional_scalars.fbs || goto FAIL
|
|
||||||
..\%buildtype%\flatc.exe --csharp --gen-object-api optional_scalars.fbs || goto FAIL
|
|
||||||
..\%buildtype%\flatc.exe --rust %TEST_RUST_FLAGS% -o optional_scalars optional_scalars.fbs || goto FAIL
|
|
||||||
..\%buildtype%\flatc.exe %TEST_NOINCL_FLAGS% %TEST_CPP_FLAGS% --cpp optional_scalars.fbs || goto FAIL
|
|
||||||
|
|
||||||
@rem Generate the schema evolution tests
|
|
||||||
..\%buildtype%\flatc.exe --cpp --scoped-enums %TEST_CPP_FLAGS% -o evolution_test ./evolution_test/evolution_v1.fbs ./evolution_test/evolution_v2.fbs || goto FAIL
|
|
||||||
|
|
||||||
@rem Generate the keywords tests
|
|
||||||
..\%buildtype%\flatc.exe --csharp --scoped-enums %TEST_BASE_FLAGS% %TEST_CS_FLAGS% keyword_test.fbs || goto FAIL
|
|
||||||
|
|
||||||
@rem Generate the nested namespace tests
|
|
||||||
..\%buildtype%\flatc.exe --csharp --cs-global-alias --gen-onefile %TEST_BASE_FLAGS% %TEST_CS_FLAGS% -o nested_namespace_test nested_namespace_test/nested_namespace_test1.fbs nested_namespace_test/nested_namespace_test2.fbs nested_namespace_test/nested_namespace_test3.fbs || goto FAIL
|
|
||||||
|
|
||||||
if NOT "%MONSTER_EXTRA%"=="skip" (
|
|
||||||
@echo Generate MosterExtra
|
|
||||||
..\%buildtype%\flatc.exe --cpp --java --csharp %TEST_NOINCL_FLAGS% %TEST_CPP_FLAGS% %TEST_CS_FLAGS% monster_extra.fbs monsterdata_extra.json || goto FAIL
|
|
||||||
..\%buildtype%\flatc.exe --python %TEST_BASE_FLAGS% monster_extra.fbs monsterdata_extra.json || goto FAIL
|
|
||||||
) else (
|
|
||||||
@echo monster_extra.fbs skipped (the strtod function from MSVC2013 or older doesn't support NaN/Inf arguments)
|
|
||||||
)
|
|
||||||
|
|
||||||
set TEST_CPP17_FLAGS=--cpp --cpp-std c++17 --cpp-static-reflection -o ./cpp17/generated_cpp17 %TEST_NOINCL_FLAGS%
|
|
||||||
if NOT "%MONSTER_EXTRA%"=="skip" (
|
|
||||||
@rem Flag c++17 requires Clang6, GCC7, MSVC2017 (_MSC_VER >= 1914) or higher.
|
|
||||||
..\%buildtype%\flatc.exe %TEST_CPP17_FLAGS% -I include_test monster_test.fbs || goto FAIL
|
|
||||||
..\%buildtype%\flatc.exe %TEST_CPP17_FLAGS% optional_scalars.fbs || goto FAIL
|
|
||||||
@rem..\%buildtype%\flatc.exe %TEST_CPP17_FLAGS% arrays_test.fbs || goto FAIL
|
|
||||||
@rem..\%buildtype%\flatc.exe %TEST_CPP17_FLAGS% native_type_test.fbs || goto FAIL
|
|
||||||
@rem..\%buildtype%\flatc.exe %TEST_CPP17_FLAGS% monster_extra.fbs || goto FAIL
|
|
||||||
..\%buildtype%\flatc.exe %TEST_CPP17_FLAGS% ./union_vector/union_vector.fbs || goto FAIL
|
|
||||||
)
|
|
||||||
|
|
||||||
cd ../samples
|
|
||||||
..\%buildtype%\flatc.exe --cpp --lobster %TEST_BASE_FLAGS% %TEST_CPP_FLAGS% monster.fbs || goto FAIL
|
|
||||||
..\%buildtype%\flatc.exe -b --schema --bfbs-comments --bfbs-filenames . --bfbs-builtins monster.fbs || goto FAIL
|
|
||||||
cd ../reflection
|
|
||||||
call generate_code.bat %1 %2 || goto FAIL
|
|
||||||
|
|
||||||
set EXITCODE=0
|
|
||||||
goto SUCCESS
|
|
||||||
:FAIL
|
|
||||||
set EXITCODE=1
|
|
||||||
:SUCCESS
|
|
||||||
cd ../tests
|
|
||||||
EXIT /B %EXITCODE%
|
|
||||||
@@ -1,114 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Copyright 2021 Google Inc. All rights reserved.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
set -e
|
|
||||||
|
|
||||||
commandline="'$*'"
|
|
||||||
|
|
||||||
if [[ $commandline == *"--cpp-std c++0x"* ]]; then
|
|
||||||
TEST_CPP_FLAGS="--cpp-std c++0x"
|
|
||||||
else
|
|
||||||
# --cpp-std is defined by flatc default settings.
|
|
||||||
TEST_CPP_FLAGS=
|
|
||||||
fi
|
|
||||||
|
|
||||||
TEST_CPP_FLAGS="--gen-compare --cpp-ptr-type flatbuffers::unique_ptr $TEST_CPP_FLAGS"
|
|
||||||
TEST_CS_FLAGS="--cs-gen-json-serializer"
|
|
||||||
TEST_TS_FLAGS="--gen-name-strings"
|
|
||||||
TEST_BASE_FLAGS="--reflect-names --gen-mutable --gen-object-api"
|
|
||||||
TEST_RUST_FLAGS="$TEST_BASE_FLAGS --gen-all --gen-name-strings"
|
|
||||||
TEST_NOINCL_FLAGS="$TEST_BASE_FLAGS --no-includes"
|
|
||||||
|
|
||||||
|
|
||||||
../flatc --binary --cpp --java --kotlin --csharp --dart --go --lobster --lua --ts --php --grpc \
|
|
||||||
$TEST_NOINCL_FLAGS $TEST_CPP_FLAGS $TEST_CS_FLAGS -I include_test monster_test.fbs monsterdata_test.json
|
|
||||||
../flatc --rust $TEST_RUST_FLAGS -o monster_test -I include_test monster_test.fbs monsterdata_test.json
|
|
||||||
|
|
||||||
../flatc --python $TEST_BASE_FLAGS -I include_test monster_test.fbs monsterdata_test.json
|
|
||||||
|
|
||||||
../flatc --cpp --java --kotlin --csharp --dart --go --binary --lobster --lua --ts --php --python \
|
|
||||||
$TEST_NOINCL_FLAGS $TEST_CPP_FLAGS $TEST_CS_FLAGS $TEST_TS_FLAGS -o namespace_test namespace_test/namespace_test1.fbs namespace_test/namespace_test2.fbs
|
|
||||||
|
|
||||||
# For Rust we currently generate two independent schemas, with namespace_test2
|
|
||||||
# duplicating the types in namespace_test1
|
|
||||||
../flatc --rust --gen-all $TEST_RUST_FLAGS -o namespace_test namespace_test/namespace_test1.fbs namespace_test/namespace_test2.fbs
|
|
||||||
|
|
||||||
../flatc --cpp --java --kotlin --csharp --ts --php $TEST_BASE_FLAGS $TEST_CPP_FLAGS $TEST_CS_FLAGS $TEST_TS_FLAGS -o union_vector ./union_vector/union_vector.fbs
|
|
||||||
../flatc --ts --gen-name-strings --gen-mutable $TEST_BASE_FLAGS $TEST_TS_FLAGS -I include_test monster_test.fbs
|
|
||||||
../flatc $TEST_BASE_FLAGS $TEST_TS_FLAGS -b -I include_test monster_test.fbs unicode_test.json
|
|
||||||
../flatc --ts --gen-name-strings $TEST_BASE_FLAGS $TEST_TS_FLAGS -o union_vector union_vector/union_vector.fbs
|
|
||||||
../flatc --rust $TEST_RUST_FLAGS -o include_test1 -I include_test include_test/include_test1.fbs
|
|
||||||
../flatc --rust $TEST_RUST_FLAGS -o include_test2 -I include_test include_test/sub/include_test2.fbs
|
|
||||||
../flatc -b --schema --bfbs-comments --bfbs-filenames . --bfbs-builtins -I include_test monster_test.fbs
|
|
||||||
../flatc --cpp --bfbs-comments --bfbs-filenames . --bfbs-builtins --bfbs-gen-embed $TEST_NOINCL_FLAGS $TEST_CPP_FLAGS -I include_test monster_test.fbs
|
|
||||||
../flatc -b --schema --bfbs-comments --bfbs-filenames . --bfbs-builtins -I include_test arrays_test.fbs
|
|
||||||
../flatc --jsonschema --schema -I include_test monster_test.fbs
|
|
||||||
../flatc --cpp --java --kotlin --csharp --python $TEST_NOINCL_FLAGS $TEST_CPP_FLAGS $TEST_CS_FLAGS monster_extra.fbs monsterdata_extra.json
|
|
||||||
../flatc --cpp --java --csharp --jsonschema $TEST_NOINCL_FLAGS $TEST_CPP_FLAGS $TEST_CS_FLAGS --scoped-enums arrays_test.fbs
|
|
||||||
../flatc --rust $TEST_RUST_FLAGS -o arrays_test arrays_test.fbs
|
|
||||||
../flatc --python $TEST_BASE_FLAGS arrays_test.fbs
|
|
||||||
../flatc --dart --gen-object-api monster_extra.fbs
|
|
||||||
|
|
||||||
# Generate optional scalar code for tests.
|
|
||||||
../flatc --java --kotlin --lobster --ts optional_scalars.fbs
|
|
||||||
../flatc --csharp --gen-object-api optional_scalars.fbs
|
|
||||||
../flatc --rust $TEST_RUST_FLAGS -o optional_scalars optional_scalars.fbs
|
|
||||||
../flatc $TEST_NOINCL_FLAGS $TEST_CPP_FLAGS --cpp optional_scalars.fbs
|
|
||||||
|
|
||||||
# Generate string/vector default code for tests
|
|
||||||
../flatc --rust $TEST_RUST_FLAGS -o more_defaults more_defaults.fbs
|
|
||||||
|
|
||||||
# Generate the schema evolution tests
|
|
||||||
../flatc --cpp --scoped-enums $TEST_CPP_FLAGS -o evolution_test ./evolution_test/evolution_v*.fbs
|
|
||||||
|
|
||||||
# Generate the keywords tests
|
|
||||||
../flatc --csharp $TEST_BASE_FLAGS $TEST_CS_FLAGS ./keyword_test.fbs
|
|
||||||
../flatc --rust $TEST_RUST_FLAGS -o keyword_test ./keyword_test.fbs
|
|
||||||
|
|
||||||
# Generate the keywords tests
|
|
||||||
../flatc --csharp --cs-global-alias --gen-onefile $TEST_BASE_FLAGS $TEST_CS_FLAGS -o nested_namespace_test nested_namespace_test/nested_namespace_test1.fbs nested_namespace_test/nested_namespace_test2.fbs nested_namespace_test/nested_namespace_test3.fbs
|
|
||||||
|
|
||||||
working_dir=`pwd`
|
|
||||||
cd FlatBuffers.Test.Swift/Tests/FlatBuffers.Test.SwiftTests
|
|
||||||
$working_dir/../flatc --bfbs-filenames $working_dir --swift --gen-json-emit --grpc $TEST_NOINCL_FLAGS $TEST_CPP_FLAGS $TEST_CS_FLAGS -I ${working_dir}/include_test ${working_dir}/monster_test.fbs
|
|
||||||
$working_dir/../flatc --bfbs-filenames $working_dir --swift --gen-json-emit $TEST_BASE_FLAGS $TEST_CPP_FLAGS $TEST_CS_FLAGS ${working_dir}/union_vector/union_vector.fbs
|
|
||||||
$working_dir/../flatc --bfbs-filenames $working_dir --swift --gen-json-emit ${working_dir}/optional_scalars.fbs
|
|
||||||
$working_dir/../flatc --bfbs-filenames $working_dir --swift --gen-json-emit --gen-object-api ${working_dir}/more_defaults.fbs
|
|
||||||
cd $working_dir
|
|
||||||
|
|
||||||
# Tests if the --filename-suffix and --filename-ext works and produces the same
|
|
||||||
# outputs.
|
|
||||||
../flatc --cpp --filename-suffix _suffix --filename-ext hpp $TEST_NOINCL_FLAGS $TEST_CPP_FLAGS -I include_test monster_test.fbs
|
|
||||||
if [ -f "monster_test_suffix.hpp" ]; then
|
|
||||||
if ! cmp -s "monster_test_suffix.hpp" "monster_test_generated.h"; then
|
|
||||||
echo "[Error] Filename suffix option did not produce identical results"
|
|
||||||
fi
|
|
||||||
rm "monster_test_suffix.hpp"
|
|
||||||
else
|
|
||||||
echo "[Error] Filename suffix option did not produce a file"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Flag c++17 requires Clang6, GCC7, MSVC2017 (_MSC_VER >= 1914) or higher.
|
|
||||||
TEST_CPP17_FLAGS="--cpp --cpp-std c++17 --cpp-static-reflection --gen-object-api -o ./cpp17/generated_cpp17 $TEST_NOINCL_FLAGS"
|
|
||||||
../flatc $TEST_CPP17_FLAGS -I include_test monster_test.fbs
|
|
||||||
../flatc $TEST_CPP17_FLAGS optional_scalars.fbs
|
|
||||||
../flatc $TEST_CPP17_FLAGS union_vector/union_vector.fbs
|
|
||||||
|
|
||||||
cd ../samples
|
|
||||||
../flatc --cpp --lobster $TEST_BASE_FLAGS $TEST_CPP_FLAGS monster.fbs
|
|
||||||
../flatc --rust $TEST_RUST_FLAGS -o rust_generated monster.fbs
|
|
||||||
../flatc -b --schema --bfbs-filenames . --bfbs-comments --bfbs-builtins monster.fbs
|
|
||||||
cd ../reflection
|
|
||||||
./generate_code.sh --cpp-std c++0x
|
|
||||||
Reference in New Issue
Block a user