name.remal.gradle_plugins.toolkit.build_logic.ide.gradle Maven / Gradle / Ivy
import groovy.json.JsonBuilder
import org.gradle.plugins.ide.idea.model.IdeaLanguageLevel
apply plugin: 'idea'
apply plugin: 'org.jetbrains.gradle.plugin.idea-ext'
apply plugin: 'name.remal.idea-settings'
allprojects {
apply plugin: 'idea'
idea {
module {
downloadJavadoc = true
downloadSources = true
}
}
}
idea.project {
jdkName = '17'
targetBytecodeVersion = JavaVersion.VERSION_17
languageLevel = new IdeaLanguageLevel(targetBytecodeVersion.majorVersion)
settings {
doNotDetectFrameworks(
'AngularCLI',
'android',
'hibernate',
'javaeeApplication',
'jpa',
'Spring',
'web',
)
}
}
ideaSettings {
nullability {
defaultNotNullAnnotation = 'javax.annotation.Nonnull'
defaultNullableAnnotation = 'javax.annotation.Nullable'
}
runOnSave {
reformatMode = 'WHOLE_FILE'
optimizeImports = true
}
}
tasks.named('processIdeaSettings') {
if (project.isRunningOnCi) {
doFirst {
String jsonString = new JsonBuilder([ideaDirPath: rootProject.file('.idea').absolutePath]).toPrettyString()
rootProject.file('layout.json').setText(jsonString, 'UTF-8')
}
}
}