calculator-gradle/gradle/config/groovyc-static.groovy

63 lines
2.1 KiB
Groovy
Raw Permalink Normal View History

2024-11-13 18:56:35 +01:00
import groovy.transform.CompileStatic
import io.tswf.groovy.bettergroovy.transforms.annotationgstrings.GStringsInAnnotations
import io.tswf.groovy.bettergroovy.transforms.directnamedargs.DirectNamedArgsCall
import io.tswf.groovy.bettergroovy.transforms.namedvariantdefaults.NamedVariantDefaults
import io.tswf.groovy.bettergroovy.transforms.scan.ScanSourceSet
import io.tswf.groovy.bettergroovy.transforms.extensions.SilentStaticTypeChecker
import io.tswf.groovy.bettergroovy.transforms.nullsafe.NullSafeVariables
import io.tswf.groovy.bettergroovy.transforms.validation.checkedmapconstructor.CheckMapConstructors
import io.tswf.groovy.bettergroovy.transforms.extensions.SameSourceSetExtensionMethods
withConfig(configuration) {
ast(ScanSourceSet)
if (getBooleanProperty("groovycOptionSilentTypeChecking")) {
ast(SilentStaticTypeChecker)
}
if (getBooleanProperty("groovycOptionSameSourceExtensions")) {
ast(SameSourceSetExtensionMethods)
}
if (getBooleanProperty("groovycOptionGlobalGStringInAnnotationsTransform")) {
ast(GStringsInAnnotations)
}
if (getBooleanProperty("groovycOptionGlobalNamedVariantsDirectCallsTransform")) {
ast(DirectNamedArgsCall)
}
if (getBooleanProperty("groovycOptionGlobalNamedVariantsDefaultsTransform")) {
ast(NamedVariantDefaults)
}
if (getBooleanProperty("groovycOptionGlobalNullsafeChecks")) {
ast(NullSafeVariables)
}
if (getBooleanProperty("groovycOptionGlobalCheckMapConstructors")) {
ast(CheckMapConstructors)
}
if (getBooleanProperty("groovycOptionSLF4JLevels")) {
ast(io.tswf.groovy.bettergroovy.transforms.slf4j.SLF4JLevels)
}
if (getBooleanProperty("groovycOptionGlobalCompileStaticTransform")) {
ast(CompileStatic)
}
}
boolean getBooleanProperty(String featureName) {
def stringProperty = getStringProperty(featureName)
if (stringProperty != null) {
return stringProperty.equalsIgnoreCase("true")
}
return null
}
String getStringProperty(String propertyName) {
return System.getProperty(propertyName)
}