Sorry for the spam! :party_blob: :amper: How confi...
# kotlin-toolchain
r
Sorry for the spam! 🎉 amper How configure compose compiler options in amper? In gradle I use:
Copy code
composeCompiler {
    reportsDestination.set(layout.buildDirectory.dir("reports/compose_reports"))
    metricsDestination.set(layout.buildDirectory.dir("reports/compose_metrics"))
}
a
Sorry for the spam! 🎉 amper
No worries! Not a problem whatsoever! Sorry, we have no native DSL for that, however, you can use
settings.kotlin.freeCompilerArgs
to add something like that:
Copy code
-P plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=<directory>
as a workaround
r
Sorry, we have no native DSL for that, however, you can use
settings.kotlin.freeCompilerArgs
@Anton Prokhorov Hi, I tried, but throws exception always, I check the syntax but looks fine.
Copy code
freeCompilerArgs:
  - "-Wextra"
  - -P plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=compose_metrics
Copy code
/home/kingg22/IdeaProjects/vibrion/amper build -m app
00:02.156 INFO                            Compiling modules: app
00:04.105 INFO  :app:compileAndroidDebug  Compiling module 'app' for platform 'android'...

Internal error: org.jetbrains.amper.engine.TaskExecutor$TaskExecutionFailed: Task ':app:compileAndroidDebug' failed: org.jetbrains.kotlin.buildtools.api.CompilerArgumentsParseException: Invalid argument: -P plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=compose_metrics

Please check the build logs for the full stacktrace, and if possible file a bug report at https://youtrack.jetbrains.com/newIssue?project=AMPER
Maybe amper plugin or intellij idk, can help with
<https://kotlinlang.org/docs/compiler-reference.html#schema-for-compiler-options
|Schema for compiler options>
A common schema for all compiler options is published under
org.jetbrains.kotlin:kotlin-compiler-arguments-description
as a JAR artifact. This artifact includes both a code representation and a JSON equivalent of all compiler option descriptions (for non-Kotlin consumers). As well as metadata, such as the version in which each option was introduced or stabilized.
👀 1
a
I believe it should be something like that:
Copy code
settings:
  kotlin:
    freeCompilerArgs:
      - "-Wextra"
      - -P
      - plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=compose_metrics
r
Thanks, now works fine amper intensifies, only takes the directory from the root dir project
a
Thanks, now works fine amper intensifies
Cool! Happy to help
only takes the directory from the root dir project
Follow-up question: could you please elaborate? What do you mean by that? is it that it's impossible to set the directory outside of the project? and how would you expect it could work?
r
No, no, no, I don't expect to have the file outside the project; I just thought it would take the path from the build directory and not the root. If you want, perhaps try sending files to the system's temp directory if anyone prefers that idk, is not my case
a
how does it present? what stops you from settings folder inside
build
?
r
When I set
-P plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=compose_metrics
it writes to
<project-root>/compose_metrics
. What I meant is that I expected it maybe to resolve relative to
build/
like Gradle does with
layout.buildDirectory
, so maybe something like:
-P plugin:androidx.compose.compiler.plugins.kotlin:metricsDestination=build/compose_metrics
It works fine; nothing stops me from using
build/compose_metrics
, I was just clarifying the behavior. I thought maybe Amper would have a default like Gradle, but it's cool as is. I'm sorry if I wasn't clear, English isn't my native language.
message has been deleted
a
> English isn't my native language. neither mine, that's fine, don't worry 🙂 yeah, okay got it, thanks for the explanation in Gradle build folder is configurable but it still might be nice to provide with some helpers anyway however, I believe we should have provided native support of configuring this in the first place (it's still not clear how to refer
build
dir though) but at least now we have such use case
amper intensifies 1