index: shared indexes is enabled if we have a shared index downloader

GitOrigin-RevId: 21be0a9b21f88356d6b7091be0e0d154b9d75718
This commit is contained in:
Dmitro Batko
2020-02-18 19:36:26 +03:00
committed by intellij-monorepo-bot
parent 2fca15eb8c
commit a00746b6e1
2 changed files with 8 additions and 4 deletions

View File

@@ -1,6 +1,7 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.internal
import com.intellij.index.SharedIndexExtensions
import com.intellij.internal.SharedIndexesLogger.logDownloadNotifications
import com.intellij.internal.SharedIndexesLogger.logNotification
import com.intellij.notification.NotificationGroup
@@ -26,7 +27,7 @@ import kotlinx.coroutines.runBlocking
import org.jetbrains.concurrency.await
import java.nio.file.Path
private fun isSharedIndexesDownloadEnabled() = ApplicationManager.getApplication()?.isUnitTestMode == false && Registry.`is`("shared.indexes.download")
private fun isSharedIndexesDownloadEnabled() = ApplicationManager.getApplication()?.isUnitTestMode == false && Registry.`is`(SharedIndexExtensions.SHARED_INDEXES_DOWNLOAD_KEY)
class SharedJdkIndexChunkPreloader : JdkInstallerListener {
override fun onJdkDownloadStarted(request: JdkInstallRequest, project: Project?) {

View File

@@ -1,24 +1,27 @@
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.index;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.psi.stubs.StubSharedIndexExtension;
import com.intellij.psi.stubs.StubUpdatingIndex;
import com.intellij.util.indexing.FileBasedIndexExtension;
import com.intellij.util.indexing.ID;
import com.intellij.util.indexing.provided.OnDiskSharedIndexChunkLocator;
import com.intellij.util.indexing.provided.SharedIndexExtension;
import com.intellij.util.io.DataExternalizer;
import com.intellij.util.io.KeyDescriptor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.nio.file.Path;
public class SharedIndexExtensions {
public static final String SHARED_INDEXES_DOWNLOAD_KEY = "shared.indexes.download";
private static final String SHARED_INDEX_ENABLED = "shared.index.enabled";
public static boolean areSharedIndexesEnabled() {
return System.getProperty(OnDiskSharedIndexChunkLocator.ROOT_PROP) != null || System.getProperty(SHARED_INDEX_ENABLED) != null;
return System.getProperty(OnDiskSharedIndexChunkLocator.ROOT_PROP) != null ||
System.getProperty(SHARED_INDEX_ENABLED) != null ||
(!ApplicationManager.getApplication().isUnitTestMode() && Registry.is(SHARED_INDEXES_DOWNLOAD_KEY));
}
@SuppressWarnings("unchecked")