mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 13:02:30 +07:00
[workspace model] Remove workspace.model.test.properties.bridge registry key
GitOrigin-RevId: db9b37b6bb81905c28b1fbb52e1e3b1387924c5c
This commit is contained in:
committed by
intellij-monorepo-bot
parent
2876ac2ae4
commit
ce01c62c97
@@ -20,7 +20,6 @@ import com.intellij.platform.backend.workspace.WorkspaceModel
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.Milliseconds
|
||||
import com.intellij.platform.diagnostic.telemetry.helpers.MillisecondsMeasurer
|
||||
import com.intellij.platform.workspace.jps.entities.*
|
||||
import com.intellij.platform.workspace.jps.serialization.impl.JpsProjectEntitiesLoader.isModulePropertiesBridgeEnabled
|
||||
import com.intellij.platform.workspace.storage.*
|
||||
import com.intellij.platform.workspace.storage.url.VirtualFileUrl
|
||||
import com.intellij.serviceContainer.PrecomputedExtensionModel
|
||||
@@ -45,14 +44,7 @@ internal class ModuleBridgeImpl(
|
||||
val plugins = PluginManagerCore.getPluginSet().getEnabledModules()
|
||||
val corePluginDescriptor = plugins.find { it.pluginId == PluginManagerCore.CORE_ID }
|
||||
?: error("Core plugin with id: ${PluginManagerCore.CORE_ID} should be available")
|
||||
if (isModulePropertiesBridgeEnabled) {
|
||||
registerService(TestModuleProperties::class.java, TestModulePropertiesBridge::class.java, corePluginDescriptor, false)
|
||||
}
|
||||
else {
|
||||
val classLoader = javaClass.classLoader
|
||||
val implClass = classLoader.loadClass("com.intellij.openapi.roots.impl.TestModulePropertiesImpl")
|
||||
registerService(TestModuleProperties::class.java, implClass, corePluginDescriptor, false)
|
||||
}
|
||||
registerService(TestModuleProperties::class.java, TestModulePropertiesBridge::class.java, corePluginDescriptor, false)
|
||||
}
|
||||
|
||||
//override fun beforeChanged(event: VersionedStorageChange) = moduleBridgeBeforeChangedTimeMs.addMeasuredTime {
|
||||
|
||||
@@ -441,9 +441,6 @@
|
||||
serviceImplementation="com.intellij.configurationStore.ModuleStoreImpl"
|
||||
testServiceImplementation="com.intellij.configurationStore.TestModuleStore"/>
|
||||
|
||||
<registryKey defaultValue="true" key="workspace.model.test.properties.bridge" restartRequired="true"
|
||||
description="Provides bridges for TestModuleProperties via WorkspaceModel"/>
|
||||
|
||||
<moduleService serviceImplementation="com.intellij.openapi.module.impl.DeprecatedModuleOptionManager"/>
|
||||
<moduleService serviceInterface="com.intellij.openapi.components.PathMacroManager"
|
||||
serviceImplementation="com.intellij.openapi.components.impl.ModulePathMacroManager"/>
|
||||
|
||||
@@ -1,67 +0,0 @@
|
||||
// Copyright 2000-2019 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.openapi.roots.impl;
|
||||
|
||||
import com.intellij.openapi.components.PersistentStateComponent;
|
||||
import com.intellij.openapi.components.State;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModulePointer;
|
||||
import com.intellij.openapi.module.ModulePointerManager;
|
||||
import com.intellij.openapi.roots.ExternalProjectSystemRegistry;
|
||||
import com.intellij.openapi.roots.ProjectModelElement;
|
||||
import com.intellij.openapi.roots.ProjectModelExternalSource;
|
||||
import com.intellij.openapi.roots.TestModuleProperties;
|
||||
import com.intellij.util.xmlb.annotations.Attribute;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@State(name = "TestModuleProperties")
|
||||
class TestModulePropertiesImpl extends TestModuleProperties implements PersistentStateComponent<TestModulePropertiesImpl.TestModulePropertiesState>,
|
||||
ProjectModelElement {
|
||||
private ModulePointer myProductionModulePointer;
|
||||
private final Module myModule;
|
||||
|
||||
TestModulePropertiesImpl(@NotNull Module module) {
|
||||
myModule = module;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String getProductionModuleName() {
|
||||
return myProductionModulePointer != null ? myProductionModulePointer.getModuleName() : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Module getProductionModule() {
|
||||
return myProductionModulePointer != null ? myProductionModulePointer.getModule() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setProductionModuleName(@Nullable String moduleName) {
|
||||
myProductionModulePointer = moduleName != null ? ModulePointerManager.getInstance(myModule.getProject()).create(moduleName) : null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public TestModulePropertiesState getState() {
|
||||
TestModulePropertiesState state = new TestModulePropertiesState();
|
||||
state.moduleName = getProductionModuleName();
|
||||
return state;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadState(@NotNull TestModulePropertiesState state) {
|
||||
setProductionModuleName(state.moduleName);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public ProjectModelExternalSource getExternalSource() {
|
||||
return ExternalProjectSystemRegistry.getInstance().getExternalSource(myModule);
|
||||
}
|
||||
|
||||
public static class TestModulePropertiesState {
|
||||
@Attribute("production-module")
|
||||
public String moduleName;
|
||||
}
|
||||
}
|
||||
@@ -28,10 +28,6 @@ object JpsProjectEntitiesLoader {
|
||||
return data
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
val isModulePropertiesBridgeEnabled: Boolean
|
||||
get() = Registry.`is`("workspace.model.test.properties.bridge")
|
||||
|
||||
fun loadModule(moduleFile: Path, configLocation: JpsProjectConfigLocation, builder: MutableEntityStorage,
|
||||
errorReporter: ErrorReporter, context: SerializationContext) {
|
||||
val source = JpsProjectFileEntitySource.FileInDirectory(moduleFile.parent.toVirtualFileUrl(context.virtualFileUrlManager), configLocation)
|
||||
|
||||
@@ -8,7 +8,6 @@ import com.intellij.platform.diagnostic.telemetry.helpers.MillisecondsMeasurer
|
||||
import com.intellij.platform.workspace.jps.*
|
||||
import com.intellij.platform.workspace.jps.entities.*
|
||||
import com.intellij.platform.workspace.jps.serialization.SerializationContext
|
||||
import com.intellij.platform.workspace.jps.serialization.impl.JpsProjectEntitiesLoader.isModulePropertiesBridgeEnabled
|
||||
import com.intellij.platform.workspace.storage.*
|
||||
import com.intellij.platform.workspace.storage.url.VirtualFileUrl
|
||||
import com.intellij.platform.workspace.storage.url.VirtualFileUrlManager
|
||||
@@ -589,7 +588,6 @@ internal open class ModuleImlFileEntitiesSerializer(internal val modulePath: Mod
|
||||
}
|
||||
|
||||
private fun loadTestModuleProperty(moduleEntity: ModuleEntity.Builder, reader: JpsFileContentReader, entitySource: EntitySource) {
|
||||
if (!isModulePropertiesBridgeEnabled) return
|
||||
val component = reader.loadComponent(fileUrl.url, TEST_MODULE_PROPERTIES_COMPONENT_NAME) ?: return
|
||||
val productionModuleName = component.getAttribute(PRODUCTION_MODULE_NAME_ATTRIBUTE).value
|
||||
if (productionModuleName.isEmpty()) return
|
||||
@@ -938,7 +936,6 @@ internal open class ModuleImlFileEntitiesSerializer(internal val modulePath: Mod
|
||||
}
|
||||
|
||||
private fun saveTestModuleProperty(moduleEntity: ModuleEntity, writer: JpsFileContentWriter) {
|
||||
if (!isModulePropertiesBridgeEnabled) return
|
||||
val testProperties = moduleEntity.testProperties ?: return
|
||||
val testModulePropertyTag = Element(TEST_MODULE_PROPERTIES_COMPONENT_NAME)
|
||||
testModulePropertyTag.setAttribute(PRODUCTION_MODULE_NAME_ATTRIBUTE, testProperties.productionModuleId.presentableName)
|
||||
|
||||
Reference in New Issue
Block a user