fixes for intellij model, srcjars weren't being picked up (#55)
diff --git a/kotlin/builder/src/io/bazel/kotlin/builder/mode/jvm/actions/UnpackSourceJars.kt b/kotlin/builder/src/io/bazel/kotlin/builder/mode/jvm/actions/UnpackSourceJars.kt
index 46b305f..a63f33d 100644
--- a/kotlin/builder/src/io/bazel/kotlin/builder/mode/jvm/actions/UnpackSourceJars.kt
+++ b/kotlin/builder/src/io/bazel/kotlin/builder/mode/jvm/actions/UnpackSourceJars.kt
@@ -34,7 +34,7 @@
.also {
try {
it.mkdirs()
- } catch(ex: Exception) {
+ } catch (ex: Exception) {
throw RuntimeException("could not create unpack directory at $it", ex)
}
}
@@ -43,7 +43,9 @@
mutableListOf(
Paths.get(toolchain.JAR_TOOL_PATH).toAbsolutePath().toString(),
"xf", srcjar.toAbsolutePath().toString()
- ).also { executeAndAwaitSuccess(10, unpackDir, it) }
+ ).also {
+ executeAndAwaitSuccess(10, unpackDir, it)
+ }
} catch (e: Exception) {
throw RuntimeException("unable to unpack source jar: $srcjar", e)
}
diff --git a/kotlin/internal/compile.bzl b/kotlin/internal/compile.bzl
index bce6126..913ab40 100644
--- a/kotlin/internal/compile.bzl
+++ b/kotlin/internal/compile.bzl
@@ -131,7 +131,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=utils.actions.maybe_make_srcsjar(ctx),
+ source_jars= _srcjar_file_type.filter(ctx.files.srcs) + 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.
@@ -142,14 +142,16 @@
def _make_providers(ctx, java_info, transitive_files=depset(order="default")):
kotlin_info=kt.info.KtInfo(
- src=ctx.attr.srcs,
+ srcs=ctx.files.srcs,
+ # intelij aspect needs this.
outputs = struct(
jdeps = ctx.outputs.jdeps,
jars = [struct(
class_jar = ctx.outputs.jar,
ijar = None,
+ source_jars = _srcjar_file_type.filter(ctx.files.srcs)
)]
- ), # intelij aspect needs this.
+ ),
)
default_info = DefaultInfo(
diff --git a/kotlin/internal/kt.bzl b/kotlin/internal/kt.bzl
index cd8d1e7..47e1985 100644
--- a/kotlin/internal/kt.bzl
+++ b/kotlin/internal/kt.bzl
@@ -25,7 +25,7 @@
_KtInfo = provider(
fields = {
- "src": "the source files. [intelij-aspect]",
+ "srcs": "the source files. [intelij-aspect]",
"outputs": "output jars produced by this rule. [intelij-aspect]",
},
)