CustomDatasource: fixed build optimization issue with custom datasources, Fixes #994