Skip to content

Enable strict explicit mode #1877

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
Mar 27, 2020
Merged

Enable strict explicit mode #1877

merged 1 commit into from
Mar 27, 2020

Conversation

qwwdfsad
Copy link
Member

No description provided.

@qwwdfsad qwwdfsad requested a review from elizarov March 23, 2020 13:27

kotlin.sourceSets.matching({ it.name.contains("Main") }).all { srcSet ->
project.ext.set("kotlin.mpp.freeCompilerArgsForSourceSet.${srcSet.name}", "-Xexplicit-api=strict")
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of compile-common.gradle and compile-jvm.gradle you can add it here together with all other Kotlin compilation options:

// Configure subprojects with Kotlin sources
configure(subprojects.findAll { !sourceless.contains(it.name) }) {
// Use atomicfu plugin, it also adds all the necessary dependencies
apply plugin: 'kotlinx-atomicfu'
// Configure options for all Kotlin compilation tasks
tasks.withType(org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile).all {
kotlinOptions.freeCompilerArgs += experimentalAnnotations.collect { "-Xuse-experimental=" + it }
kotlinOptions.freeCompilerArgs += "-progressive"
kotlinOptions.freeCompilerArgs += "-XXLanguage:+InlineClasses"
// Remove null assertions to get smaller bytecode on Android
kotlinOptions.freeCompilerArgs += ["-Xno-param-assertions", "-Xno-receiver-assertions", "-Xno-call-assertions"]
}
}

Copy link
Member Author

Choose a reason for hiding this comment

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

This is not going to work:

  1. Explicit mode will be applied for test source sets
  2. IDE integration will be broken for some reason

@qwwdfsad qwwdfsad merged commit 9cbad7d into develop Mar 27, 2020
@qwwdfsad qwwdfsad deleted the explicit-mode branch March 27, 2020 14:43
qwwdfsad added a commit that referenced this pull request Apr 24, 2020
recheej pushed a commit to recheej/kotlinx.coroutines that referenced this pull request Dec 28, 2020
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