com.jakewharton.wormhole.gradle.GroovyVoodoo.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wormhole-gradle Show documentation
Show all versions of wormhole-gradle Show documentation
A time-traveling bytecode rewriter which adds future APIs to android.jar
package com.jakewharton.wormhole.gradle
import com.android.build.gradle.BaseExtension
import org.gradle.api.tasks.StopExecutionException
import java.util.function.Function
class GroovyVoodoo {
private Function integerHandler
private Function stringHandler
GroovyVoodoo(
Function integerHandler,
Function stringHandler
) {
this.integerHandler = integerHandler
this.stringHandler = stringHandler
}
void applyTo(BaseExtension extension) {
extension.metaClass.wormhole {
if (it instanceof Integer) {
return integerHandler.apply(it)
} else if (it instanceof String) {
return stringHandler.apply(it)
} else {
throw new StopExecutionException("Compilation platform must be specified as integer or string")
}
}
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy