mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-02-04 23:39:07 +07:00
[jps build] provide a way to pass workspace model to the JPS build process in serialized way (IJPL-409)
If newly introduced 'jps.build.use.workspace.model' registry option is enabled, required modules and libraries are added to the JPS build classpath, paths to global and project cache file for the workspace model are passed to the build process, and it loads the project model from them instead of reading the project configuration files. It's an experimental approach, and it isn't fully implemented yet: * it doesn't ensure that caches are up-to-date; * the cache currently cannot be loaded by the build process because it references entities and other classes aren't available in the build process (e.g. ScratchRootsEntity and VirtualFileUrlBridge). GitOrigin-RevId: 54a4a49566ca9dd0433c7a13251c2e28fc051e78
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3dd4206d54
commit
f3ab5a172e
@@ -0,0 +1,24 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
@file:JvmName("CompilerTests")
|
||||
package com.intellij.compiler
|
||||
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.openapi.util.registry.Registry
|
||||
import com.intellij.platform.backend.workspace.GlobalWorkspaceModelCache.Companion.getInstance
|
||||
import com.intellij.platform.backend.workspace.WorkspaceModel
|
||||
import com.intellij.platform.backend.workspace.WorkspaceModelCache
|
||||
import com.intellij.platform.ide.progress.runWithModalProgressBlocking
|
||||
|
||||
fun saveWorkspaceModelCaches(project: Project) {
|
||||
if (Registry.`is`("jps.build.use.workspace.model")) {
|
||||
val cache = WorkspaceModelCache.getInstance(project)
|
||||
checkNotNull(cache) { "Workspace model cache is not enabled for project" }
|
||||
cache.setVirtualFileUrlManager(WorkspaceModel.getInstance(project).getVirtualFileUrlManager())
|
||||
cache.saveCacheNow()
|
||||
val globalCache = getInstance()
|
||||
checkNotNull(globalCache) { "Workspace model cache is not enabled for global storage" }
|
||||
runWithModalProgressBlocking(project, "Save workspace model cache") {
|
||||
globalCache.saveCacheNow()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.intellij.testFramework;
|
||||
|
||||
import com.intellij.compiler.CompilerManagerImpl;
|
||||
import com.intellij.compiler.CompilerTestUtil;
|
||||
import com.intellij.compiler.CompilerTests;
|
||||
import com.intellij.compiler.server.BuildManager;
|
||||
import com.intellij.diagnostic.ThreadDumper;
|
||||
import com.intellij.execution.wsl.WslPath;
|
||||
@@ -194,6 +195,7 @@ public final class CompilerTester {
|
||||
ErrorReportingCallback callback = new ErrorReportingCallback(semaphore);
|
||||
PlatformTestUtil.saveProject(getProject(), false);
|
||||
CompilerTestUtil.saveApplicationSettings();
|
||||
CompilerTests.saveWorkspaceModelCaches(getProject());
|
||||
EdtTestUtil.runInEdtAndWait(() -> {
|
||||
// for now directory based project is used for external storage
|
||||
if (!ProjectKt.isDirectoryBased(myProject)) {
|
||||
|
||||
Reference in New Issue
Block a user