def swiftc_inputs(ctx):
  """Determine the list of inputs required for the compile action.

  Args:
    ctx: rule context.

  Returns:
    A list of files needed by swiftc.
  """
  swift_providers = [x.swift for x in ctx.attr.deps if hasattr(x, "swift")]
  objc_providers = [x.objc for x in ctx.attr.deps if hasattr(x, "objc")]

  dep_modules = []
  for swift in swift_providers:
    dep_modules += swift.transitive_modules

  objc_files = set()
  for objc in objc_providers:
    objc_files += objc.header
    objc_files += objc.module_map
    objc_files += set(objc.static_framework_file)
    objc_files += set(objc.dynamic_framework_file)

  return ctx.files.srcs + dep_modules + list(objc_files)