Has anyone tried the new `-Xcompiler-plugin-orderi...
# compiler
y
Has anyone tried the new
-Xcompiler-plugin-ordering
in 2.3? I tried https://youtrack.jetbrains.com/issue/KT-55300/Provide-a-mechanism-to-describe-ordering-and-dependencies-for-compiler-plugins#focus=Comm[…]915454.0-0 but it doesn’t seem to work so far.
Basically I’m trying to run my plugin before `app.cash.burst.kotlin`:
Copy code
override fun applyToCompilation(kotlinCompilation: KotlinCompilation<*>): Provider<List<SubpluginOption>> {
    kotlinCompilation.compileTaskProvider.configure {
        it.compilerOptions.freeCompilerArgs.add("-Xcompiler-plugin-order=my.compiler>app.cash.burst.kotlin")
    }
    ...
    return project.provider { listOf() }
}

override fun getCompilerPluginId(): String = "my.compiler"
...
z
It only orders IR plugins, in case that’s relevant to your use case. Brian is quite responsive on the issue and I would report any issues with a MR on that youtrack issue
y
They are both IR plugins. I’ll try to reproduce it with the
compiler-plugin-template
project.
b
A few pieces have to fit together to make sure things are expected to work: 1. You are compiling with
2.3.0-Beta1
or later and both compiler plugins have been updated as well. 2. Both compiler plugins have defined a non-empty ID within their respective
CompilerPluginRegistrar
. 3. These IDs are used when defining the order constraint to the compiler. (No warnings or errors are currently reported if IDs are not found.) It's also possible that my sample just doesn't work at all (since I never actually tried it 🫣). Have you tried specifying the constraint in the free args of the project which uses both plugins?
y
Specifying it in the project consuming both plugins doesn’t seem to work either.
is there any way to print out all compiler plugin IDs in the current compilation? 😃
b
Does this project happen to be open source? Anything I can use to reproduce? No, there isn't a way to print out all the compiler plugin IDs.
🤦‍♂️ It's a bug. Report an issue if you would like, but a fix is in the works. Seems Gradle is still using the old
-Xplugin
option to register plugins and that goes down a different code path so the plugins don't get sorted.
y
Thanks! Yes it’s open source but I haven’t pushed the plugin code yet. Will do that soon and create an issue.