Build: Don't instrument NotNulls during form instrumentation

This commit is contained in:
Vyacheslav Gerasimov
2018-12-25 21:54:46 +03:00
parent f40635c2d2
commit 38d836dece
7 changed files with 23 additions and 13 deletions
+9 -4
View File
@@ -28,7 +28,7 @@ import org.gradle.api.tasks.compile.AbstractCompile
import org.gradle.kotlin.dsl.*
import java.io.File
fun Project.configureInstrumentation() {
fun Project.configureFormInstrumentation() {
plugins.matching { it::class.java.canonicalName.startsWith("org.jetbrains.kotlin.gradle.plugin") }.all {
// When we change the output classes directory, Gradle will automatically configure
// the test compile tasks to use the instrumented classes. Normally this is fine,
@@ -100,6 +100,9 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
@Input
var originalClassesDirs: FileCollection? = null
@get:Input
var instrumentNotNull: Boolean = false
@get:InputFiles
val sourceDirs: FileCollection
get() = project.files(sourceSet!!.allSource.srcDirs.filter { !sourceSet!!.resources.contains(it) && it.exists() })
@@ -129,7 +132,10 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
}
logger.info("Compiling forms and instrumenting code with nullability preconditions")
val instrumentNotNull = prepareNotNullInstrumenting(classpath.asPath)
if (instrumentNotNull) {
prepareNotNullInstrumenting(classpath.asPath)
}
instrumentCode(sourceDirs, instrumentNotNull)
}
@@ -140,7 +146,7 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
}
}
private fun prepareNotNullInstrumenting(classpath: String): Boolean {
private fun prepareNotNullInstrumenting(classpath: String) {
ant.withGroovyBuilder {
"typedef"(
"name" to "skip",
@@ -149,7 +155,6 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
"classname" to FILTER_ANNOTATION_REGEXP_CLASS
)
}
return true
}
private fun instrumentCode(srcDirs: FileCollection, instrumentNotNull: Boolean) {
+9 -4
View File
@@ -28,7 +28,7 @@ import org.gradle.api.tasks.compile.AbstractCompile
import org.gradle.kotlin.dsl.*
import java.io.File
fun Project.configureInstrumentation() {
fun Project.configureFormInstrumentation() {
plugins.matching { it::class.java.canonicalName.startsWith("org.jetbrains.kotlin.gradle.plugin") }.all {
// When we change the output classes directory, Gradle will automatically configure
// the test compile tasks to use the instrumented classes. Normally this is fine,
@@ -100,6 +100,9 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
@Input
var originalClassesDirs: FileCollection? = null
@get:Input
var instrumentNotNull: Boolean = false
@get:InputFiles
val sourceDirs: FileCollection
get() = project.files(sourceSet!!.allSource.srcDirs.filter { !sourceSet!!.resources.contains(it) && it.exists() })
@@ -129,7 +132,10 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
}
logger.info("Compiling forms and instrumenting code with nullability preconditions")
val instrumentNotNull = prepareNotNullInstrumenting(classpath.asPath)
if (instrumentNotNull) {
prepareNotNullInstrumenting(classpath.asPath)
}
instrumentCode(sourceDirs, instrumentNotNull)
}
@@ -140,7 +146,7 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
}
}
private fun prepareNotNullInstrumenting(classpath: String): Boolean {
private fun prepareNotNullInstrumenting(classpath: String) {
ant.withGroovyBuilder {
"typedef"(
"name" to "skip",
@@ -149,7 +155,6 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
"classname" to FILTER_ANNOTATION_REGEXP_CLASS
)
}
return true
}
private fun instrumentCode(srcDirs: FileCollection, instrumentNotNull: Boolean) {
+1 -1
View File
@@ -205,5 +205,5 @@ projectTest(taskName = "performanceTest") {
testsJar {}
classesDirsArtifact()
configureInstrumentation()
configureFormInstrumentation()
+1 -1
View File
@@ -30,4 +30,4 @@ sourceSets {
"test" { none() }
}
configureInstrumentation()
configureFormInstrumentation()
+1 -1
View File
@@ -74,4 +74,4 @@ projectTest {
useAndroidSdk()
}
configureInstrumentation()
configureFormInstrumentation()
+1 -1
View File
@@ -28,7 +28,7 @@ sourceSets {
"test" { none() }
}
configureInstrumentation()
configureFormInstrumentation()
runtimeJar {
archiveName = "jvm-ide.jar"
+1 -1
View File
@@ -17,7 +17,7 @@ sourceSets {
"test" { none() }
}
configureInstrumentation()
configureFormInstrumentation()
runtimeJar {
archiveName = "native-ide.jar"