Skip to content

Kotlin User Projects: add kotlin_additional_cli_options and logging #2996

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 23, 2025

Conversation

woainikk
Copy link
Contributor

@woainikk woainikk requested a review from sandwwraith April 23, 2025 07:49
@@ -28,7 +37,7 @@ tasks.withType(KotlinCompilationTask::class).configureEach {
}

allWarningsAsErrors = werrorEnabled

logger.info("allWarningsAsErrors=$werrorEnabled")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this logging really needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, that will allow us to make sure we use correct settings

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't they visible in teamcity parameters?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean, that's not exactly what I would want to see in the build log

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe move it to Added Kotlin compiler flags section then?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tasks.withType<KotlinCompilationTask<*>>().configureEach {
    doFirst {
      logger.info("Added Kotlin compiler flags: ${compilerOptions.freeCompilerArgs.get().joinToString(", ")}")
      logger.info("Werror state: ${compilerOptions.allWarningsAsErrors.get()}")
   }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair, fixed

@@ -46,3 +55,9 @@ tasks.withType<Kotlin2JsCompile>().configureEach {
tasks.withType<KotlinNativeCompile>().configureEach {
compilerOptions { freeCompilerArgs.add("-Xpartial-linkage-loglevel=ERROR") }
}

tasks.withType<KotlinCompilationTask<*>>().configureEach {
doFirst {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest printing only the additional args if they were provided: if (kotlin_additional_cli_options?.isNotEmpty()) logger.info(...)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's useful to have all options in log. now it look like this:
Added Kotlin compiler flags: -Xexplicit-api=strict, -Xsuppress-version-warnings, -Xexpect-actual-classes, -P, plugin:org.jetbrains.kotlinx.serialization:disableIntrinsic=false, -Xreport-all-warnings, -Xrender-internal-diagnostic-names, -nowarn

@woainikk woainikk force-pushed the bobova/compiler-options branch from 39dbc33 to bf7299a Compare April 23, 2025 10:28
@woainikk woainikk requested a review from sandwwraith April 23, 2025 12:37
@woainikk woainikk merged commit d6634ef into dev Apr 23, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants