diff --git a/jps/model-impl/src/org/jetbrains/jps/service/impl/JpsServiceManagerImpl.java b/jps/model-impl/src/org/jetbrains/jps/service/impl/JpsServiceManagerImpl.java index d85561d6937b..2f566f681578 100644 --- a/jps/model-impl/src/org/jetbrains/jps/service/impl/JpsServiceManagerImpl.java +++ b/jps/model-impl/src/org/jetbrains/jps/service/impl/JpsServiceManagerImpl.java @@ -1,22 +1,9 @@ -/* - * Copyright 2000-2014 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// 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 org.jetbrains.jps.service.impl; import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.util.containers.ContainerUtil; +import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.jps.plugin.JpsPluginManager; import org.jetbrains.jps.service.JpsServiceManager; @@ -82,16 +69,19 @@ public class JpsServiceManagerImpl extends JpsServiceManager { return (List)cached; } - private boolean cleanupExtensionCache() { - JpsPluginManager manager = myPluginManager; - if (manager != null) { - int stamp = manager.getModificationStamp(); - if (myModificationStamp.getAndSet(stamp) != stamp) { - myExtensions.clear(); - return true; + @ApiStatus.Internal + public boolean cleanupExtensionCache() { + synchronized (myExtensions) { + JpsPluginManager manager = myPluginManager; + if (manager != null) { + int stamp = manager.getModificationStamp(); + if (myModificationStamp.getAndSet(stamp) != stamp) { + myExtensions.clear(); + return true; + } } + return false; } - return false; } @NotNull diff --git a/platform/platform-impl/src/com/intellij/jps/impl/JpsIdePluginManagerImpl.java b/platform/platform-impl/src/com/intellij/jps/impl/JpsIdePluginManagerImpl.java index 5eb499664c33..20e2423a6017 100644 --- a/platform/platform-impl/src/com/intellij/jps/impl/JpsIdePluginManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/jps/impl/JpsIdePluginManagerImpl.java @@ -1,9 +1,12 @@ -// 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. +// 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.jps.impl; import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.extensions.*; +import com.intellij.openapi.extensions.ExtensionPoint; +import com.intellij.openapi.extensions.ExtensionPointListener; +import com.intellij.openapi.extensions.ExtensionsArea; +import com.intellij.openapi.extensions.PluginDescriptor; import com.intellij.openapi.module.Module; import com.intellij.openapi.module.ModuleManager; import com.intellij.openapi.project.Project; @@ -27,6 +30,8 @@ import org.jetbrains.jps.model.serialization.module.JpsModuleRootModelSerializer import org.jetbrains.jps.model.serialization.module.JpsModuleSourceRootPropertiesSerializer; import org.jetbrains.jps.model.serialization.module.UnknownSourceRootPropertiesSerializer; import org.jetbrains.jps.plugin.JpsPluginManager; +import org.jetbrains.jps.service.JpsServiceManager; +import org.jetbrains.jps.service.impl.JpsServiceManagerImpl; import java.io.BufferedReader; import java.io.IOException; @@ -126,6 +131,10 @@ public final class JpsIdePluginManagerImpl extends JpsPluginManager { } myExternalBuildPlugins.remove(pluginDescriptor); myModificationStamp.incrementAndGet(); + JpsServiceManager jpsServiceManager = JpsServiceManager.getInstance(); + if (jpsServiceManager instanceof JpsServiceManagerImpl) { + ((JpsServiceManagerImpl)jpsServiceManager).cleanupExtensionCache(); + } } private void handlePluginAdded(@NotNull PluginDescriptor pluginDescriptor) {