blob: f2aef1e033e07f475f4812d2621a9e10e68fb527 [file] [log] [blame]
# Copyright 2018 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
LOCAL_DIR := $(GET_LOCAL_DIR)
#
# FIDL compiler host tests.
#
MODULE := $(LOCAL_DIR)
MODULE_TYPE := hosttest
MODULE_NAME := fidl-compiler-test
EXAMPLE_DIR := system/host/fidl/examples/
EXAMPLE_FILES := \
$(EXAMPLE_DIR)/alignment.fidl \
$(EXAMPLE_DIR)/bits.fidl \
$(EXAMPLE_DIR)/empty.fidl \
$(EXAMPLE_DIR)/enums.fidl \
$(EXAMPLE_DIR)/events.fidl \
$(EXAMPLE_DIR)/errors.fidl \
$(EXAMPLE_DIR)/example-0.fidl \
$(EXAMPLE_DIR)/example-1.fidl \
$(EXAMPLE_DIR)/example-2.fidl \
$(EXAMPLE_DIR)/example-3.fidl \
$(EXAMPLE_DIR)/example-4.fidl \
$(EXAMPLE_DIR)/example-5.fidl \
$(EXAMPLE_DIR)/example-6.fidl \
$(EXAMPLE_DIR)/example-7.fidl \
$(EXAMPLE_DIR)/example-8.fidl \
$(EXAMPLE_DIR)/example-9.fidl \
$(EXAMPLE_DIR)/example-10.fidl \
$(EXAMPLE_DIR)/interface-ordinals.fidl \
$(EXAMPLE_DIR)/library-a/point.fidl \
$(EXAMPLE_DIR)/library-b/view.fidl \
$(EXAMPLE_DIR)/simple.fidl \
$(EXAMPLE_DIR)/tables.fidl \
$(EXAMPLE_DIR)/test.fidl \
$(EXAMPLE_DIR)/types.fidl \
$(LOCAL_DIR)/testdata/goodformat.fidl \
$(LOCAL_DIR)/testdata/badformat.fidl.noformat \
$(LOCAL_DIR)/testdata/doc_comments.fidl \
BUILDGEN_DIR=$(BUILDDIR)/system/utest/fidl-compiler
$(BUILDGEN_DIR)/examples.cpp: $(EXAMPLE_FILES)
@$(MKDIR)
$(call BUILDECHO, generating FIDL test example file)
$(NOECHO)rm -rf $@ && \
printf "\
#include <map>\n\
#include <string>\n\
#include \"examples.h\"\n\
// Autogenerated: Do not modify!\n\
std::map<std::string, std::string> Examples::map_ = {\n" >> $@ && \
for i in $^; do \
printf " {\""$${i}"\", R\"FIDL(""$$(cat $${i})"")FIDL\"}," >> $@; \
done && \
printf "\
};\n" >> $@ \
MODULE_SRCS := \
$(LOCAL_DIR)/attributes_tests.cpp \
$(LOCAL_DIR)/bits_tests.cpp \
$(LOCAL_DIR)/coded_types_generator_tests.cpp \
$(LOCAL_DIR)/consts_tests.cpp \
$(LOCAL_DIR)/declaration_order_tests.cpp \
$(LOCAL_DIR)/enums_tests.cpp \
$(LOCAL_DIR)/errors_tests.cpp \
$(LOCAL_DIR)/flat_ast_tests.cpp \
$(LOCAL_DIR)/formatter_unittests.cpp \
$(LOCAL_DIR)/json_generator_tests.cpp \
$(LOCAL_DIR)/max_bytes_multipass_tests.cpp \
$(LOCAL_DIR)/max_bytes_tests.cpp \
$(LOCAL_DIR)/max_handle_tests.cpp \
$(LOCAL_DIR)/optionals_tests.cpp \
$(LOCAL_DIR)/ordinals_tests.cpp \
$(LOCAL_DIR)/parsing_tests.cpp \
$(LOCAL_DIR)/protocol_tests.cpp \
$(LOCAL_DIR)/superinterface_tests.cpp \
$(LOCAL_DIR)/table_tests.cpp \
$(LOCAL_DIR)/types_tests.cpp \
$(LOCAL_DIR)/using_tests.cpp \
$(LOCAL_DIR)/virtual_source_tests.cpp \
$(LOCAL_DIR)/visitor_unittests.cpp \
$(LOCAL_DIR)/xunion_tests.cpp \
$(BUILDGEN_DIR)/examples.cpp \
MODULE_COMPILEFLAGS := \
-Isystem/ulib/fit/include \
-Isystem/ulib/unittest/include \
-Isystem/utest/fidl-compiler \
-Ithird_party/ulib/uboringssl/include \
MODULE_HOST_LIBS := \
system/host/fidl \
system/ulib/fit.hostlib \
system/ulib/pretty.hostlib \
system/ulib/unittest.hostlib \
third_party/ulib/uboringssl.hostlib \
MODULE_PACKAGE_INCS := \
$(LOCAL_DIR)/examples.h \
include make/module.mk