from waftools.pebble_test import clar
import waftools.ragel

def build(bld):
    clar(bld,
        sources_ant_glob = "src/fw/comm/ble/kernel_le_client/ams/ams_util.c "
                           "src/fw/comm/ble/kernel_le_client/ams/ams.c "
                           "src/fw/services/normal/music.c "
                           "tests/fakes/fake_events.c "
                           "tests/fakes/fake_gatt_client_operations.c "
                           "tests/fakes/fake_gatt_client_subscriptions.c "
                           "tests/fakes/fake_rtc.c",
        test_sources_ant_glob = "test_ams.c")

    clar(bld,
        sources_ant_glob = "src/fw/comm/ble/kernel_le_client/ams/ams_util.c",
        test_sources_ant_glob = "test_ams_util.c")

    # TODO: the bt_driver calls here should really be a fake and not rely on
    # the cc2564 module
    clar(bld,
        sources_ant_glob = "src/fw/comm/ble/gap_le_advert.c "
                           "src/fw/comm/ble/gap_le_connection.c "
                           "src/fw/services/common/regular_timer.c "
                           "src/fw/comm/internals/bt_conn_mgr.c "
                           "tests/fakes/fake_GAPAPI.c "
                           "tests/fakes/fake_rtc.c "
                           "tests/fakes/fake_HCIAPI.c "
                           "tests/fakes/fake_gap_le_connect_params.c ",
        test_sources_ant_glob = "test_gap_le_advert.c",
        override_includes=['dummy_board'])

    clar(bld,
        sources_ant_glob = "src/fw/comm/internals/bt_conn_mgr.c "
                           "src/fw/services/common/regular_timer.c "
                           "tests/fakes/fake_gap_le_connect_params.c "
                           "tests/fakes/fake_rtc.c ",
        test_sources_ant_glob = "test_bt_conn_mgr.c")

    clar(bld,
        sources_ant_glob = "src/fw/util/rand/rand.c "
                           "src/fw/vendor/tinymt32/tinymt32.c "
                           "src/fw/comm/ble/gap_le_connection.c "
                           "src/fw/comm/ble/gatt_client_accessors.c "
                           "src/fw/comm/ble/gatt_client_discovery.c "
                           "src/fw/comm/ble/gatt_service_changed.c "
                           "src/fw/comm/internals/bt_conn_mgr.c "
                           "tests/fakes/fake_events.c "
                           "tests/fakes/fake_rtc.c "
                           "tests/fakes/fake_GATTAPI.c "
                           "tests/fakes/fake_GATTAPI_test_vectors.c "
                           "tests/fakes/fake_gap_le_connect_params.c ",
        test_sources_ant_glob = "test_gatt_client_accessors.c")

    clar(bld,
        sources_ant_glob = "src/fw/util/rand/rand.c "
                           "src/fw/vendor/tinymt32/tinymt32.c "
                           "src/fw/comm/ble/gap_le_connection.c "
                           "src/fw/comm/ble/gatt_client_accessors.c "
                           "src/fw/comm/ble/gatt_client_discovery.c "
                           "src/fw/comm/ble/gatt_service_changed.c "
                           "src/fw/comm/internals/bt_conn_mgr.c "
                           "tests/fakes/fake_gap_le_connect_params.c "
                           "tests/fakes/fake_events.c "
                           "tests/fakes/fake_rtc.c "
                           "tests/fakes/fake_GATTAPI.c "
                           "tests/fakes/fake_GATTAPI_test_vectors.c ",
        test_sources_ant_glob = "test_gatt_client_discovery.c")

    clar(bld,
        sources_ant_glob = "src/fw/util/rand/rand.c "
                           "src/fw/vendor/tinymt32/tinymt32.c "
                           "src/fw/comm/ble/gap_le_connection.c "
                           "src/fw/comm/ble/gap_le_task.c "
                           "src/fw/comm/ble/gatt_client_accessors.c "
                           "src/fw/comm/ble/gatt_client_discovery.c "
                           "src/fw/comm/ble/gatt_client_subscriptions.c "
                           "src/fw/comm/ble/gatt_service_changed.c "
                           "src/fw/comm/internals/bt_conn_mgr.c "
                           "tests/fakes/fake_gap_le_connect_params.c "
                           "tests/fakes/fake_events.c "
                           "tests/fakes/fake_GATTAPI.c "
                           "tests/fakes/fake_GATTAPI_test_vectors.c "
                           "tests/fakes/fake_queue.c "
                           "tests/fakes/fake_rtc.c ",
        test_sources_ant_glob = "test_gatt_client_subscriptions.c")

    clar(bld,
        sources_ant_glob = "src/fw/util/rand/rand.c "
                           "src/fw/vendor/tinymt32/tinymt32.c "
                           "src/fw/comm/ble/gatt_client_discovery.c "
                           "src/fw/comm/ble/gatt_service_changed.c "
                           "src/fw/comm/internals/bt_conn_mgr.c "
                           "tests/fakes/fake_gap_le_connect_params.c "
                           "tests/fakes/fake_GATTAPI.c "
                           "tests/fakes/fake_GATTAPI_test_vectors.c "
                           "tests/fakes/fake_rtc.c",
        test_sources_ant_glob = "test_gatt_service_changed_client.c")

    clar(bld,
         sources_ant_glob = "src/fw/util/rand/rand.c "
                          "src/fw/vendor/tinymt32/tinymt32.c "
                          "src/fw/comm/ble/gap_le_connection.c "
                          "src/fw/comm/ble/gatt_client_discovery.c "
                          "src/fw/comm/ble/gatt_service_changed.c "
                          "src/fw/comm/internals/bt_conn_mgr.c "
                          "tests/fakes/fake_gap_le_connect_params.c "
                          "tests/fakes/fake_GATTAPI.c "
                          "tests/fakes/fake_GATTAPI_test_vectors.c "
                          "tests/fakes/fake_rtc.c",
          test_sources_ant_glob="test_gatt_service_changed_server.c")

    clar(bld,
        sources_ant_glob = "src/fw/comm/ble/gap_le_connect.c "
                           "src/fw/comm/ble/gap_le_connection.c "
                           "src/fw/comm/ble/gap_le_task.c "
                           "src/fw/comm/internals/bt_conn_mgr.c "
                           "tests/fakes/fake_events.c "
                           "tests/fakes/fake_GAPAPI.c "
                           "tests/fakes/fake_bluetooth_persistent_storage.c "
                           "tests/fakes/fake_gap_le_connect_params.c "
                           "tests/fakes/fake_HCIAPI.c "
                           "tests/fakes/fake_rtc.c ",
        test_sources_ant_glob = "test_gap_le_connect.c",
        override_includes=['dummy_board'])

    clar(bld,
        sources_ant_glob = "src/fw/util/time/mktime.c " \
        "src/fw/util/buffer.c " \
        "src/fw/util/time/time.c " \
        "src/fw/comm/ble/kernel_le_client/ancs/ancs_util.c " \
        "tests/fakes/fake_rtc.c",
        test_sources_ant_glob = "test_ancs_util.c")

    clar(bld,
        sources_ant_glob = "src/fw/util/buffer.c " \
        "src/fw/util/pstring.c " \
        "src/fw/util/time/mktime.c " \
        "src/fw/util/time/time.c "\
        "src/fw/comm/ble/kernel_le_client/ancs/ancs_util.c " \
        "src/fw/comm/ble/kernel_le_client/ancs/ancs.c " \
        "src/fw/comm/ble/kernel_le_client/ancs/ancs_app_name_storage.c " \
        "src/fw/services/common/regular_timer.c " \
        "src/fw/util/rand/rand.c " \
        "src/fw/vendor/tinymt32/tinymt32.c " \
        "tests/fakes/fake_events.c " \
        "tests/fakes/fake_kernel_services_notifications.c " \
        "tests/fakes/fake_gatt_client_subscriptions.c " \
        "tests/fakes/fake_rtc.c " \
        "src/fw/services/normal/notifications/ancs/ancs_notifications.c " \
        " src/fw/services/normal/notifications/ancs/ancs_notifications_util.c " \
        "src/fw/services/normal/notifications/ancs/ancs_item.c " \
        "src/fw/services/normal/notifications/ancs/ancs_filtering.c " \
        "src/fw/services/normal/notifications/ancs/ancs_phone_call.c " \
        "src/fw/services/normal/timeline/item.c " \
        "src/fw/services/normal/timeline/attributes_actions.c " \
        "src/fw/services/normal/timeline/attribute_group.c " \
        "src/fw/services/normal/timeline/attribute.c",
        test_sources_ant_glob = "test_ancs.c")

    clar(bld,
         sources_ant_glob="src/fw/comm/ble/kernel_le_client/kernel_le_client.c "
                           "src/fw/util/rand/rand.c "
                           "src/fw/vendor/tinymt32/tinymt32.c",
         test_sources_ant_glob="test_kernel_le_client.c")

    for ppogatt_version in [ 0, 1]:
        clar(bld,
             sources_ant_glob = "src/fw/system/hexdump.c " \
                           "src/fw/comm/ble/kernel_le_client/ppogatt/ppogatt.c " \
                           "src/fw/services/common/regular_timer.c " \
                           "src/fw/util/rand/rand.c "
                           "src/fw/vendor/tinymt32/tinymt32.c "
                           "tests/fakes/fake_gatt_client_operations.c " \
                           "tests/fakes/fake_gatt_client_subscriptions.c " \
                           "tests/fakes/fake_rtc.c " \
                           "tests/fakes/fake_session.c",
             defines=["USE_PPOGATT_VERSION=%d" % ppogatt_version],
             test_name='test_ppogatt_v%d' % ppogatt_version,
             test_sources_ant_glob = "test_ppogatt.c")

# vim:filetype=python