remove usage of filetype
diff --git a/kotlin/internal/compile.bzl b/kotlin/internal/compile.bzl
index 6cabade..9a02835 100644
--- a/kotlin/internal/compile.bzl
+++ b/kotlin/internal/compile.bzl
@@ -15,10 +15,7 @@
 load("//kotlin/internal:plugins.bzl", "plugins")
 load("//kotlin/internal:utils.bzl", "utils")
 
-_src_file_types = FileType([".java", ".kt"])
-_srcjar_file_type = FileType([".srcjar"])
-
-def _kotlin_do_compile_action(ctx, rule_kind, output_jar, compile_jars, module_name, friend_paths):
+def _kotlin_do_compile_action(ctx, rule_kind, output_jar, compile_jars, module_name, friend_paths, srcs, src_jars):
     """Internal macro that sets up a Kotlin compile action.
 
     This macro only supports a single Kotlin compile operation for a rule.
@@ -55,9 +52,6 @@
         "--kotlin_passthrough_flags", "-Xcoroutines=%s" % tc.coroutines
     ]
 
-    srcs=[f.path for f in _src_file_types.filter(ctx.files.srcs)]
-    src_jars = [f.path for f in _srcjar_file_type.filter(ctx.files.srcs)]
-
     if len(srcs) == 0 and len(src_jars) == 0:
         fail("srcs did not contain kotlin/java files or any srcjars")
 
@@ -65,7 +59,7 @@
         args += ["--sources", "\n".join(srcs)]
 
     if len(src_jars) > 0:
-        args += ["--source_jars", "\n".join(src_jars)]
+        args += ["--source_jars", "\n".join([sj.path for sj in src_jars])]
 
     # Collect and prepare plugin descriptor for the worker.
     plugin_info=plugins.merge_plugin_infos(ctx.attr.plugins + ctx.attr.deps)
@@ -99,7 +93,7 @@
 def _select_std_libs(ctx):
     return ctx.files._kotlin_std
 
-def _make_java_provider(ctx, input_deps=[], auto_deps=[]):
+def _make_java_provider(ctx, input_deps=[], auto_deps=[], src_jars=[]):
     """Creates the java_provider for a Kotlin target.
 
     This macro is distinct from the kotlin_make_providers as collecting the java_info is useful before the DefaultInfo is
@@ -132,7 +126,7 @@
         use_ijar = False,
         # A list or set of output source jars that contain the uncompiled source files including the source files
         # generated by annotation processors if the case.
-        source_jars= _srcjar_file_type.filter(ctx.files.srcs) + utils.actions.maybe_make_srcsjar(ctx),
+        source_jars= src_jars + utils.actions.maybe_make_srcsjar(ctx),
         # A list or a set of jars that should be used at compilation for a given target.
         compile_time_jars = my_compile_jars,
         # A list or a set of jars that should be used at runtime for a given target.
@@ -151,7 +145,7 @@
             jars = [struct(
               class_jar = ctx.outputs.jar,
               ijar = None,
-              source_jars = _srcjar_file_type.filter(ctx.files.srcs)
+              source_jars = java_info.source_jars
             )]
         ),
     )
@@ -169,7 +163,7 @@
         providers=[java_info,default_info,kotlin_info],
     )
 
-def _compile_action(ctx, rule_kind, module_name, friend_paths=depset()):
+def _compile_action(ctx, rule_kind, module_name, friend_paths=depset(), src_jars=[]):
     """Setup a kotlin compile action.
 
     Args:
@@ -200,6 +194,14 @@
 
     deps = ctx.attr.deps + getattr(ctx.attr, "friends", [])
 
+    srcs = []
+    src_jars = []
+    for f in ctx.files.srcs:
+        if f.path.endswith(".kt") or f.path.endswith(".java"):
+            srcs.append(f.path)
+        elif f.path.endswith(".srcjar"):
+            src_jars.append(f)
+
     # setup the compile action.
     _kotlin_do_compile_action(
         ctx,
@@ -207,7 +209,9 @@
         output_jar = kt_compile_output_jar,
         compile_jars = utils.collect_jars_for_compile(deps) + kotlin_auto_deps,
         module_name = module_name,
-        friend_paths = friend_paths
+        friend_paths = friend_paths,
+        srcs = srcs,
+        src_jars = src_jars
     )
 
     # setup the merge action if needed.
@@ -215,7 +219,7 @@
         utils.actions.fold_jars(ctx, output_jar, output_merge_list)
 
     # create the java provider but the kotlin and default provider cannot be created here.
-    return _make_java_provider(ctx, deps, kotlin_auto_deps)
+    return _make_java_provider(ctx, deps, kotlin_auto_deps, src_jars)
 
 compile = struct(
     compile_action = _compile_action,
diff --git a/kotlin/kotlin.bzl b/kotlin/kotlin.bzl
index 86248a8..91da083 100644
--- a/kotlin/kotlin.bzl
+++ b/kotlin/kotlin.bzl
@@ -119,20 +119,6 @@
 )
 load("//third_party/jvm:workspace.bzl", _maven_dependencies="maven_dependencies")
 
-_kt_compile_filetypes = FileType([
-    # source jars these will be unpacked by the compiler.
-    ".srcjar",
-    # The files types that may be passed to the core Kotlin compile rule.
-    ".kt",
-    ".java",
-])
-
-_jar_filetype = FileType([".jar"])
-
-_srcjar_filetype = FileType([
-    ".jar",
-    "-sources.jar",
-])
 # _kt.defs.KT_COMPILER_REPO can't be used till skydoc is removed
 KT_COMPILER_REPO="com_github_jetbrains_kotlin"
 
@@ -208,7 +194,7 @@
 _common_attr = dict(_implicit_deps.items() + {
     "srcs": attr.label_list(
         default = [],
-        allow_files = _kt_compile_filetypes,
+        allow_files = [".srcjar", ".kt", ".java"],
     ),
     "deps": attr.label_list(aspects = [_kt_jvm_plugin_aspect]),
     "runtime_deps": attr.label_list(default = []),