Build: Don't instrument NotNulls during form instrumentation
This commit is contained in:
@@ -28,7 +28,7 @@ import org.gradle.api.tasks.compile.AbstractCompile
|
|||||||
import org.gradle.kotlin.dsl.*
|
import org.gradle.kotlin.dsl.*
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
fun Project.configureInstrumentation() {
|
fun Project.configureFormInstrumentation() {
|
||||||
plugins.matching { it::class.java.canonicalName.startsWith("org.jetbrains.kotlin.gradle.plugin") }.all {
|
plugins.matching { it::class.java.canonicalName.startsWith("org.jetbrains.kotlin.gradle.plugin") }.all {
|
||||||
// When we change the output classes directory, Gradle will automatically configure
|
// When we change the output classes directory, Gradle will automatically configure
|
||||||
// the test compile tasks to use the instrumented classes. Normally this is fine,
|
// the test compile tasks to use the instrumented classes. Normally this is fine,
|
||||||
@@ -100,6 +100,9 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
|
|||||||
@Input
|
@Input
|
||||||
var originalClassesDirs: FileCollection? = null
|
var originalClassesDirs: FileCollection? = null
|
||||||
|
|
||||||
|
@get:Input
|
||||||
|
var instrumentNotNull: Boolean = false
|
||||||
|
|
||||||
@get:InputFiles
|
@get:InputFiles
|
||||||
val sourceDirs: FileCollection
|
val sourceDirs: FileCollection
|
||||||
get() = project.files(sourceSet!!.allSource.srcDirs.filter { !sourceSet!!.resources.contains(it) && it.exists() })
|
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")
|
logger.info("Compiling forms and instrumenting code with nullability preconditions")
|
||||||
val instrumentNotNull = prepareNotNullInstrumenting(classpath.asPath)
|
if (instrumentNotNull) {
|
||||||
|
prepareNotNullInstrumenting(classpath.asPath)
|
||||||
|
}
|
||||||
|
|
||||||
instrumentCode(sourceDirs, instrumentNotNull)
|
instrumentCode(sourceDirs, instrumentNotNull)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,7 +146,7 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun prepareNotNullInstrumenting(classpath: String): Boolean {
|
private fun prepareNotNullInstrumenting(classpath: String) {
|
||||||
ant.withGroovyBuilder {
|
ant.withGroovyBuilder {
|
||||||
"typedef"(
|
"typedef"(
|
||||||
"name" to "skip",
|
"name" to "skip",
|
||||||
@@ -149,7 +155,6 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
|
|||||||
"classname" to FILTER_ANNOTATION_REGEXP_CLASS
|
"classname" to FILTER_ANNOTATION_REGEXP_CLASS
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun instrumentCode(srcDirs: FileCollection, instrumentNotNull: Boolean) {
|
private fun instrumentCode(srcDirs: FileCollection, instrumentNotNull: Boolean) {
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ import org.gradle.api.tasks.compile.AbstractCompile
|
|||||||
import org.gradle.kotlin.dsl.*
|
import org.gradle.kotlin.dsl.*
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
fun Project.configureInstrumentation() {
|
fun Project.configureFormInstrumentation() {
|
||||||
plugins.matching { it::class.java.canonicalName.startsWith("org.jetbrains.kotlin.gradle.plugin") }.all {
|
plugins.matching { it::class.java.canonicalName.startsWith("org.jetbrains.kotlin.gradle.plugin") }.all {
|
||||||
// When we change the output classes directory, Gradle will automatically configure
|
// When we change the output classes directory, Gradle will automatically configure
|
||||||
// the test compile tasks to use the instrumented classes. Normally this is fine,
|
// the test compile tasks to use the instrumented classes. Normally this is fine,
|
||||||
@@ -100,6 +100,9 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
|
|||||||
@Input
|
@Input
|
||||||
var originalClassesDirs: FileCollection? = null
|
var originalClassesDirs: FileCollection? = null
|
||||||
|
|
||||||
|
@get:Input
|
||||||
|
var instrumentNotNull: Boolean = false
|
||||||
|
|
||||||
@get:InputFiles
|
@get:InputFiles
|
||||||
val sourceDirs: FileCollection
|
val sourceDirs: FileCollection
|
||||||
get() = project.files(sourceSet!!.allSource.srcDirs.filter { !sourceSet!!.resources.contains(it) && it.exists() })
|
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")
|
logger.info("Compiling forms and instrumenting code with nullability preconditions")
|
||||||
val instrumentNotNull = prepareNotNullInstrumenting(classpath.asPath)
|
if (instrumentNotNull) {
|
||||||
|
prepareNotNullInstrumenting(classpath.asPath)
|
||||||
|
}
|
||||||
|
|
||||||
instrumentCode(sourceDirs, instrumentNotNull)
|
instrumentCode(sourceDirs, instrumentNotNull)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,7 +146,7 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun prepareNotNullInstrumenting(classpath: String): Boolean {
|
private fun prepareNotNullInstrumenting(classpath: String) {
|
||||||
ant.withGroovyBuilder {
|
ant.withGroovyBuilder {
|
||||||
"typedef"(
|
"typedef"(
|
||||||
"name" to "skip",
|
"name" to "skip",
|
||||||
@@ -149,7 +155,6 @@ open class IntelliJInstrumentCodeTask : ConventionTask() {
|
|||||||
"classname" to FILTER_ANNOTATION_REGEXP_CLASS
|
"classname" to FILTER_ANNOTATION_REGEXP_CLASS
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun instrumentCode(srcDirs: FileCollection, instrumentNotNull: Boolean) {
|
private fun instrumentCode(srcDirs: FileCollection, instrumentNotNull: Boolean) {
|
||||||
|
|||||||
@@ -205,5 +205,5 @@ projectTest(taskName = "performanceTest") {
|
|||||||
testsJar {}
|
testsJar {}
|
||||||
|
|
||||||
classesDirsArtifact()
|
classesDirsArtifact()
|
||||||
configureInstrumentation()
|
configureFormInstrumentation()
|
||||||
|
|
||||||
|
|||||||
@@ -30,4 +30,4 @@ sourceSets {
|
|||||||
"test" { none() }
|
"test" { none() }
|
||||||
}
|
}
|
||||||
|
|
||||||
configureInstrumentation()
|
configureFormInstrumentation()
|
||||||
|
|||||||
@@ -74,4 +74,4 @@ projectTest {
|
|||||||
useAndroidSdk()
|
useAndroidSdk()
|
||||||
}
|
}
|
||||||
|
|
||||||
configureInstrumentation()
|
configureFormInstrumentation()
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ sourceSets {
|
|||||||
"test" { none() }
|
"test" { none() }
|
||||||
}
|
}
|
||||||
|
|
||||||
configureInstrumentation()
|
configureFormInstrumentation()
|
||||||
|
|
||||||
runtimeJar {
|
runtimeJar {
|
||||||
archiveName = "jvm-ide.jar"
|
archiveName = "jvm-ide.jar"
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ sourceSets {
|
|||||||
"test" { none() }
|
"test" { none() }
|
||||||
}
|
}
|
||||||
|
|
||||||
configureInstrumentation()
|
configureFormInstrumentation()
|
||||||
|
|
||||||
runtimeJar {
|
runtimeJar {
|
||||||
archiveName = "native-ide.jar"
|
archiveName = "native-ide.jar"
|
||||||
|
|||||||
Reference in New Issue
Block a user