[gradle] [IDEA-314169] forced IdeaPlugin settings override on project import if download sources flag value is not null

GitOrigin-RevId: b0709d34c896de0dfa7fb4cc782d4d5119b3dedd
This commit is contained in:
Alexander.Glukhov
2023-06-27 10:08:07 +00:00
committed by intellij-monorepo-bot
parent 0c5a09e92a
commit 84a915c3f9
@@ -238,8 +238,9 @@ class ExternalProjectBuilderImpl extends AbstractModelBuilderService {
def ideaResourceDirs = null
def ideaTestSourceDirs = null
def ideaTestResourceDirs = null
def downloadJavadoc = false
def downloadSources = Boolean.parseBoolean(System.getProperty("idea.disable.gradle.download.sources", "true"))
def downloadSourcesFlag = System.getProperty("idea.disable.gradle.download.sources")
def downloadSources = downloadSourcesFlag == null ? true : Boolean.valueOf(downloadSourcesFlag)
def downloadJavadoc = downloadSourcesFlag == null ? false : downloadSources
def testSourceSets = []
@@ -270,8 +271,25 @@ class ExternalProjectBuilderImpl extends AbstractModelBuilderService {
ideaTestSourceDirs = new LinkedHashSet<>(ideaPluginModule.testSourceDirs)
ideaTestResourceDirs = ideaPluginModule.hasProperty("testResourceDirs") ? new LinkedHashSet<>(ideaPluginModule.testResourceDirs) : []
}
downloadJavadoc = ideaPluginModule.downloadJavadoc
downloadSources = ideaPluginModule.downloadSources
if (downloadSourcesFlag != null) {
ideaPluginModule.downloadSources = downloadSources
ideaPluginModule.downloadJavadoc = downloadJavadoc
}
else {
downloadJavadoc = ideaPluginModule.downloadJavadoc
downloadSources = ideaPluginModule.downloadSources
}
}
if (ideaPluginModule == null && downloadSourcesFlag != null) {
project.plugins.whenPluginAdded { plugin ->
if (plugin instanceof IdeaPlugin) {
def module = plugin?.model?.module
if (module != null) {
module.downloadJavadoc = downloadJavadoc
module.downloadSources = downloadSources
}
}
}
}
def projectSourceCompatibility = getSourceCompatibility(project)