kotlin-classes missing in Module.classroots()

Answered

I am trying to get the classroots of a given module. I use the below:

OrderEnumerator.orderEntries(module).recursively().classesRoots

I get all the classroots except "build/tmp/kotlin-classes". This is where kotlin compiled classes are present in an Android project.

I get "build/intermediates/javac" but not "build/tmp/kotlin-classes". Why is this missing?

Note: I also tried the below, but to no avail:

OrderEnumerator.orderEntries(project).recursively().classesRoots

 

3 comments
Comment actions Permalink

I looked at the `.iml` file for the module and found the entry for `kotlin-classes`. I now have to do the below to obtain the classpath:

(FacetManager.getInstance(module).allFacets.filterIsInstance<KotlinFacet>().first().configuration.settings.compilerArguments as K2JVMCompilerArguments).destination


Is this the only way?

1
Comment actions Permalink

Henry,

To get the KotlinFacet instance, you can go with:

KotlinFacet.get(module)

 

1
Comment actions Permalink

Hi Jakub, my primary question is How do I get all the classRoots of a module. I now understand that "OrderEnumerator.orderEntries" will only give me the order entries, but not the classpath mentioned in the KotlinFacet. I want all the classroots. How do I get that?

0

Please sign in to leave a comment.