Files
kotlin-fork/libraries/reflect/api/build.gradle
T
Dmitriy Novozhilov 9b63dde1c3 Add error-level OptIn on safeAs, cast and assertedCast functions in addToStdlib
Usage of this function is unsafe because it does not have native compiler
  support. This means that compiler won't report UNCHECKED_CAST,
  CAST_NEVER_SUCCEED or similar diagnostics in case of error cast
  (which can happen immediately or after some refactoring of class hierarchy)
2022-10-06 06:57:07 +00:00

79 lines
1.9 KiB
Groovy

description = ''
apply plugin: 'kotlin'
JvmToolchain.configureJvmToolchain(project, JdkMajorVersion.JDK_1_8)
def includeJava9 = BuildPropertiesExtKt.getIncludeJava9(project.kotlinBuildProperties)
sourceSets {
main {
java {
srcDir "${rootDir}/core/reflection.jvm/src"
}
resources {
srcDir("${rootDir}/core/reflection.jvm/resources")
}
}
if (includeJava9) {
java9
}
}
dependencies {
api kotlinStdlib()
compileOnly project(':core:descriptors')
compileOnly project(':core:descriptors.jvm')
compileOnly project(':core:deserialization')
compileOnly project(':core:descriptors.runtime')
compileOnly project(':core:util.runtime')
compileOnly "org.jetbrains:annotations:13.0"
}
if (includeJava9) {
configurations.register('java9PatchModule') {
extendsFrom(configurations.compileOnly)
exclude(group: 'org.jetbrains.kotlin', module: 'kotlin-stdlib')
canBeResolved = true
}
LibrariesCommon.configureJava9Compilation(
project,
'kotlin.reflect',
[sourceSets.main.output, configurations.java9PatchModule]
)
}
compileKotlin {
kotlinOptions {
freeCompilerArgs = [
"-Xallow-kotlin-package",
"-Xno-optimized-callable-references",
"-Xno-kotlin-nothing-value-exception",
"-opt-in=kotlin.RequiresOptIn",
"-opt-in=org.jetbrains.kotlin.utils.addToStdlib.UnsafeCastFunction",
"-Xno-new-java-annotation-targets",
]
moduleName = "kotlin-reflection"
}
}
configureFrontendIr(project)
jar {
manifestAttributes(manifest, project, "internal")
}
task java9Jar(type: Jar) {
classifier = "java9"
if (includeJava9) {
from sourceSets.java9.output
}
}
artifacts {
archives java9Jar
runtimeElements java9Jar
}