mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-01 17:03:12 +07:00
QD-11982: Disable Gradle dependency sources and Javadocs during Qodana analysis, even when enabled by the Gradle idea plugin. Add independent forced Javadocs policy handling, preserve standalone sources behavior, and cover both Gradle policy combinations and the Qodana cache regression.
Co-authored-by: Jakub Andrzejewski <jakub.andrzejewski@jetbrains.com> Merge-request: IJ-MR-213684 Merged-by: Jakub Andrzejewski <jakub.andrzejewski@jetbrains.com> (cherry picked from commit a13e71f1913aa373c79767800f871e6d98509a48) Merge-request: IJ-MR-215399 Merged-by: Jakub Andrzejewski <jakub.andrzejewski@jetbrains.com> GitOrigin-RevId: 8a5f2b49ce1eb54d2d9712c58f42da829420e2ea
This commit is contained in:
committed by
intellij-monorepo-bot
co-authored by
Jakub Andrzejewski
parent
992d0b404e
commit
237631cb56
@@ -43,6 +43,7 @@ import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.search.ExecutionSearchScopes;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.PlatformUtils;
|
||||
import com.intellij.util.containers.JBIterable;
|
||||
import com.intellij.util.execution.ParametersListUtil;
|
||||
import com.intellij.util.messages.MessageBusConnection;
|
||||
@@ -164,7 +165,14 @@ public final class GradleManager
|
||||
}
|
||||
GradleSystemSettings systemSettings = GradleSystemSettings.getInstance();
|
||||
String vmOptions = Objects.requireNonNullElse(daemonVmOptions, "");
|
||||
if (vmOptions.contains("-Didea.gradle.download.sources.force=false")) {
|
||||
if (PlatformUtils.isQodana()) {
|
||||
result.withVmOptions(List.of(
|
||||
"-Didea.gradle.download.sources.force=false",
|
||||
"-Didea.gradle.download.javadocs.force=false"
|
||||
));
|
||||
result.setDownloadSources(false);
|
||||
}
|
||||
else if (vmOptions.contains("-Didea.gradle.download.sources.force=false")) {
|
||||
result.setDownloadSources(false);
|
||||
} else {
|
||||
result.setDownloadSources(systemSettings.isDownloadSources());
|
||||
|
||||
+37
-3
@@ -38,7 +38,10 @@ abstract class GradleAuxiliaryDependencyImportingTestCase : GradleImportingTestC
|
||||
override fun configureGradleVmOptions(options: MutableSet<String>) {
|
||||
super.configureGradleVmOptions(options)
|
||||
if (settings.forceDownloadSourcesFlagValue != null) {
|
||||
options.add("-D$FORCE_ARGUMENT_PROPERTY_NAME=${settings.forceDownloadSourcesFlagValue}")
|
||||
options.add("-D$FORCE_DOWNLOAD_SOURCES_ARGUMENT_PROPERTY_NAME=${settings.forceDownloadSourcesFlagValue}")
|
||||
}
|
||||
if (settings.forceDownloadJavadocsFlagValue != null) {
|
||||
options.add("-D$FORCE_DOWNLOAD_JAVADOCS_ARGUMENT_PROPERTY_NAME=${settings.forceDownloadJavadocsFlagValue}")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,6 +85,7 @@ abstract class GradleAuxiliaryDependencyImportingTestCase : GradleImportingTestC
|
||||
val pluginDownloadSourcesValue: Boolean?,
|
||||
val ideaDownloadSourcesValue: Boolean,
|
||||
val forceDownloadSourcesFlagValue: Boolean?,
|
||||
val forceDownloadJavadocsFlagValue: Boolean?,
|
||||
val sourcesExpected: Boolean,
|
||||
val pluginDownloadJavadocValue: Boolean?,
|
||||
val javadocExpected: Boolean,
|
||||
@@ -91,7 +95,8 @@ abstract class GradleAuxiliaryDependencyImportingTestCase : GradleImportingTestC
|
||||
|
||||
companion object {
|
||||
|
||||
private const val FORCE_ARGUMENT_PROPERTY_NAME = "idea.gradle.download.sources.force"
|
||||
private const val FORCE_DOWNLOAD_SOURCES_ARGUMENT_PROPERTY_NAME = "idea.gradle.download.sources.force"
|
||||
private const val FORCE_DOWNLOAD_JAVADOCS_ARGUMENT_PROPERTY_NAME = "idea.gradle.download.javadocs.force"
|
||||
private const val DEPENDENCY_CACHE_PATH = "caches/modules-2/files-2.1/junit/junit/4.12/"
|
||||
|
||||
private val testCaseMatrix: List<TestScenario> = listOf(
|
||||
@@ -100,6 +105,7 @@ abstract class GradleAuxiliaryDependencyImportingTestCase : GradleImportingTestC
|
||||
pluginDownloadSourcesValue = true,
|
||||
ideaDownloadSourcesValue = true,
|
||||
forceDownloadSourcesFlagValue = true,
|
||||
forceDownloadJavadocsFlagValue = null,
|
||||
sourcesExpected = true,
|
||||
pluginDownloadJavadocValue = false,
|
||||
javadocExpected = false
|
||||
@@ -108,6 +114,7 @@ abstract class GradleAuxiliaryDependencyImportingTestCase : GradleImportingTestC
|
||||
pluginDownloadSourcesValue = true,
|
||||
ideaDownloadSourcesValue = true,
|
||||
forceDownloadSourcesFlagValue = false,
|
||||
forceDownloadJavadocsFlagValue = null,
|
||||
sourcesExpected = false,
|
||||
pluginDownloadJavadocValue = false,
|
||||
javadocExpected = false
|
||||
@@ -116,6 +123,7 @@ abstract class GradleAuxiliaryDependencyImportingTestCase : GradleImportingTestC
|
||||
pluginDownloadSourcesValue = true,
|
||||
ideaDownloadSourcesValue = false,
|
||||
forceDownloadSourcesFlagValue = null,
|
||||
forceDownloadJavadocsFlagValue = null,
|
||||
sourcesExpected = true,
|
||||
pluginDownloadJavadocValue = false,
|
||||
javadocExpected = false
|
||||
@@ -124,6 +132,7 @@ abstract class GradleAuxiliaryDependencyImportingTestCase : GradleImportingTestC
|
||||
pluginDownloadSourcesValue = false,
|
||||
ideaDownloadSourcesValue = true,
|
||||
forceDownloadSourcesFlagValue = null,
|
||||
forceDownloadJavadocsFlagValue = null,
|
||||
sourcesExpected = false,
|
||||
pluginDownloadJavadocValue = false,
|
||||
javadocExpected = false
|
||||
@@ -132,6 +141,7 @@ abstract class GradleAuxiliaryDependencyImportingTestCase : GradleImportingTestC
|
||||
pluginDownloadSourcesValue = false,
|
||||
ideaDownloadSourcesValue = true,
|
||||
forceDownloadSourcesFlagValue = true,
|
||||
forceDownloadJavadocsFlagValue = null,
|
||||
sourcesExpected = true,
|
||||
pluginDownloadJavadocValue = false,
|
||||
javadocExpected = false
|
||||
@@ -140,6 +150,7 @@ abstract class GradleAuxiliaryDependencyImportingTestCase : GradleImportingTestC
|
||||
pluginDownloadSourcesValue = null,
|
||||
ideaDownloadSourcesValue = true,
|
||||
forceDownloadSourcesFlagValue = null,
|
||||
forceDownloadJavadocsFlagValue = null,
|
||||
sourcesExpected = true,
|
||||
pluginDownloadJavadocValue = false,
|
||||
javadocExpected = false
|
||||
@@ -148,6 +159,7 @@ abstract class GradleAuxiliaryDependencyImportingTestCase : GradleImportingTestC
|
||||
pluginDownloadSourcesValue = null,
|
||||
ideaDownloadSourcesValue = false,
|
||||
forceDownloadSourcesFlagValue = null,
|
||||
forceDownloadJavadocsFlagValue = null,
|
||||
sourcesExpected = false,
|
||||
pluginDownloadJavadocValue = false,
|
||||
javadocExpected = false
|
||||
@@ -158,6 +170,7 @@ abstract class GradleAuxiliaryDependencyImportingTestCase : GradleImportingTestC
|
||||
pluginDownloadSourcesValue = true,
|
||||
ideaDownloadSourcesValue = true,
|
||||
forceDownloadSourcesFlagValue = true,
|
||||
forceDownloadJavadocsFlagValue = null,
|
||||
sourcesExpected = true,
|
||||
pluginDownloadJavadocValue = true,
|
||||
javadocExpected = true
|
||||
@@ -166,6 +179,7 @@ abstract class GradleAuxiliaryDependencyImportingTestCase : GradleImportingTestC
|
||||
pluginDownloadSourcesValue = true,
|
||||
ideaDownloadSourcesValue = true,
|
||||
forceDownloadSourcesFlagValue = false,
|
||||
forceDownloadJavadocsFlagValue = null,
|
||||
sourcesExpected = false,
|
||||
pluginDownloadJavadocValue = true,
|
||||
javadocExpected = true
|
||||
@@ -174,6 +188,7 @@ abstract class GradleAuxiliaryDependencyImportingTestCase : GradleImportingTestC
|
||||
pluginDownloadSourcesValue = true,
|
||||
ideaDownloadSourcesValue = false,
|
||||
forceDownloadSourcesFlagValue = null,
|
||||
forceDownloadJavadocsFlagValue = null,
|
||||
sourcesExpected = true,
|
||||
pluginDownloadJavadocValue = true,
|
||||
javadocExpected = true
|
||||
@@ -182,9 +197,28 @@ abstract class GradleAuxiliaryDependencyImportingTestCase : GradleImportingTestC
|
||||
pluginDownloadSourcesValue = false,
|
||||
ideaDownloadSourcesValue = false,
|
||||
forceDownloadSourcesFlagValue = false,
|
||||
forceDownloadJavadocsFlagValue = null,
|
||||
sourcesExpected = false,
|
||||
pluginDownloadJavadocValue = true,
|
||||
javadocExpected = true
|
||||
),
|
||||
TestScenario(
|
||||
pluginDownloadSourcesValue = true,
|
||||
ideaDownloadSourcesValue = true,
|
||||
forceDownloadSourcesFlagValue = false,
|
||||
forceDownloadJavadocsFlagValue = false,
|
||||
sourcesExpected = false,
|
||||
pluginDownloadJavadocValue = true,
|
||||
javadocExpected = false
|
||||
),
|
||||
TestScenario(
|
||||
pluginDownloadSourcesValue = true,
|
||||
ideaDownloadSourcesValue = true,
|
||||
forceDownloadSourcesFlagValue = false,
|
||||
forceDownloadJavadocsFlagValue = true,
|
||||
sourcesExpected = false,
|
||||
pluginDownloadJavadocValue = false,
|
||||
javadocExpected = true
|
||||
)
|
||||
)
|
||||
|
||||
@@ -201,4 +235,4 @@ abstract class GradleAuxiliaryDependencyImportingTestCase : GradleImportingTestC
|
||||
return result
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
@@ -19,6 +19,7 @@ public class GradleDependencyDownloadPolicyBuilder extends AbstractModelBuilderS
|
||||
|
||||
private static final String DOWNLOAD_SOURCES_FORCE_PROPERTY_NAME = "idea.gradle.download.sources.force";
|
||||
private static final String DOWNLOAD_SOURCES_PROPERTY_NAME = "idea.gradle.download.sources";
|
||||
private static final String DOWNLOAD_JAVADOCS_FORCE_PROPERTY_NAME = "idea.gradle.download.javadocs.force";
|
||||
|
||||
@Override
|
||||
public boolean canBuild(String modelName) {
|
||||
@@ -80,6 +81,10 @@ public class GradleDependencyDownloadPolicyBuilder extends AbstractModelBuilderS
|
||||
}
|
||||
|
||||
private static boolean shouldDownloadJavadocs(@NotNull ModelBuilderContext context, @NotNull Project project) {
|
||||
String forcePropertyValue = System.getProperty(DOWNLOAD_JAVADOCS_FORCE_PROPERTY_NAME);
|
||||
if (forcePropertyValue != null) {
|
||||
return Boolean.parseBoolean(forcePropertyValue);
|
||||
}
|
||||
IdeaModule ideaModule = GradleIdeaPluginUtil.getIdeaModule(project);
|
||||
if (ideaModule != null) {
|
||||
return ideaModule.isDownloadJavadoc();
|
||||
|
||||
Reference in New Issue
Block a user