mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java] commit changes under write action when artifacts configuration is reloaded (EA-241293)
GitOrigin-RevId: 232a59b351976daee22e904e3bba8748f3637b0e
This commit is contained in:
committed by
intellij-monorepo-bot
parent
3d97af0177
commit
1a4e89dc2b
+1
-1
@@ -208,7 +208,7 @@ public final class ArtifactManagerImpl extends ArtifactManager implements Persis
|
||||
|
||||
if (myLoaded) {
|
||||
final ArtifactModelImpl model = new ArtifactModelImpl(this, artifacts);
|
||||
doCommit(model);
|
||||
WriteAction.run(() -> doCommit(model));
|
||||
}
|
||||
else {
|
||||
myModel.setArtifactsList(artifacts);
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
<component name="ArtifactManager">
|
||||
<artifact type="jar" name="a">
|
||||
<output-path>$PROJECT_DIR$/out/artifacts/a</output-path>
|
||||
<root id="archive" name="a.jar">
|
||||
<element id="file-copy" path="$PROJECT_DIR$/a.txt"/>
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
<component name="ArtifactManager">
|
||||
<artifact type="jar" name="a">
|
||||
<output-path>$PROJECT_DIR$/out/artifacts/a</output-path>
|
||||
<root id="archive" name="a.jar">
|
||||
<element id="file-copy" path="$PROJECT_DIR$/bbb.txt"/>
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
||||
@@ -10,6 +10,8 @@ import com.intellij.openapi.roots.ModuleRootManager
|
||||
import com.intellij.openapi.util.io.FileUtil
|
||||
import com.intellij.openapi.vfs.VfsUtil
|
||||
import com.intellij.openapi.vfs.VfsUtilCore
|
||||
import com.intellij.packaging.artifacts.ArtifactManager
|
||||
import com.intellij.packaging.impl.elements.FileCopyPackagingElement
|
||||
import com.intellij.testFramework.ApplicationRule
|
||||
import com.intellij.testFramework.PlatformTestUtil
|
||||
import com.intellij.testFramework.TemporaryDirectory
|
||||
@@ -71,6 +73,19 @@ class ReloadProjectTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `change artifact`() {
|
||||
loadProjectAndCheckResults("changeArtifact/initial") { project ->
|
||||
val artifact = ArtifactManager.getInstance(project).artifacts.single()
|
||||
assertThat(artifact.name).isEqualTo("a")
|
||||
assertThat((artifact.rootElement.children.single() as FileCopyPackagingElement).filePath).endsWith("/a.txt")
|
||||
copyFilesAndReload(project, "changeArtifact/update")
|
||||
val artifact2 = ArtifactManager.getInstance(project).artifacts.single()
|
||||
assertThat(artifact2.name).isEqualTo("a")
|
||||
assertThat((artifact2.rootElement.children.single() as FileCopyPackagingElement).filePath).endsWith("/bbb.txt")
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun copyFilesAndReload(project: Project, relativePath: String) {
|
||||
val base = Paths.get(project.basePath!!)
|
||||
val projectDir = VfsUtil.findFile(base, true)!!
|
||||
|
||||
Reference in New Issue
Block a user