-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
74 changed files
with
2,090 additions
and
15 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
impl211/src/main/kotlin/org/modelix/mps/api/ModelixMpsApiImpl211.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
impl222/src/main/kotlin/org/modelix/mps/api/ModelixMpsApiImpl222.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
impl243/src/main/kotlin/org/modelix/mps/api/ModelixMpsApiImpl243.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
public final class org/modelix/mps/api/ModelixMpsApi : org/modelix/mps/api/IModelixMpsApi { | ||
public static final field INSTANCE Lorg/modelix/mps/api/ModelixMpsApi; | ||
public fun fixVersions (Ljetbrains/mps/project/Project;Lorg/jetbrains/mps/openapi/module/SModule;)V | ||
public fun fixVersions (Lorg/jetbrains/mps/openapi/project/Project;Lorg/jetbrains/mps/openapi/module/SModule;)V | ||
public fun getMPSProjects ()Ljava/util/List; | ||
public fun getVirtualFolder (Ljetbrains/mps/project/Project;Lorg/jetbrains/mps/openapi/module/SModule;)Ljava/lang/String; | ||
public fun getVirtualFolder (Lorg/jetbrains/mps/openapi/module/SModule;)Ljava/lang/String; | ||
public fun getVirtualFolder (Lorg/jetbrains/mps/openapi/project/Project;Lorg/jetbrains/mps/openapi/module/SModule;)Ljava/lang/String; | ||
public fun getVirtualFolders (Lorg/jetbrains/mps/openapi/module/SModule;)Ljava/util/List; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
plugins { | ||
alias(libs.plugins.intellij) | ||
alias(libs.plugins.kotlin.jvm) | ||
} | ||
|
||
intellij { | ||
localPath = project(":impl203").layout.buildDirectory.dir("mps").map { it.asFile.absolutePath } | ||
instrumentCode = false | ||
} | ||
|
||
tasks { | ||
buildSearchableOptions { | ||
enabled = false | ||
} | ||
} | ||
|
||
dependencies { | ||
testImplementation(project(":lib")) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
import com.intellij.ide.impl.OpenProjectTask | ||
import com.intellij.openapi.Disposable | ||
import com.intellij.openapi.application.ApplicationManager | ||
import com.intellij.openapi.project.Project | ||
import com.intellij.openapi.project.ProjectManager | ||
import com.intellij.openapi.project.ex.ProjectManagerEx | ||
import com.intellij.openapi.util.Disposer | ||
import com.intellij.testFramework.TestApplicationManager | ||
import com.intellij.testFramework.UsefulTestCase | ||
import com.intellij.util.io.delete | ||
import jetbrains.mps.ide.ThreadUtils | ||
import jetbrains.mps.ide.project.ProjectHelper | ||
import jetbrains.mps.project.MPSProject | ||
import java.io.File | ||
import java.nio.file.Files | ||
import java.nio.file.Path | ||
|
||
/** | ||
* Based on org.jetbrains.uast.test.env.AbstractLargeProjectTest | ||
*/ | ||
@Suppress("removal") | ||
abstract class TestBase(val testDataName: String?) : UsefulTestCase() { | ||
init { | ||
// workaround for MPS 2023.3 failing to start in test mode | ||
System.setProperty("intellij.platform.load.app.info.from.resources", "true") | ||
} | ||
|
||
protected lateinit var project: Project | ||
|
||
override fun runInDispatchThread() = false | ||
|
||
override fun setUp() { | ||
super.setUp() | ||
TestApplicationManager.getInstance() | ||
project = openTestProject() | ||
} | ||
|
||
override fun tearDown() { | ||
super.tearDown() | ||
} | ||
|
||
private fun openTestProject(): Project { | ||
val projectDirParent = Path.of("build", "test-projects").toAbsolutePath() | ||
projectDirParent.toFile().mkdirs() | ||
val projectDir = Files.createTempDirectory(projectDirParent, "mps-project") | ||
projectDir.delete(recursively = true) | ||
projectDir.toFile().mkdirs() | ||
projectDir.toFile().deleteOnExit() | ||
val project = if (testDataName != null) { | ||
val sourceDir = File("testdata/$testDataName") | ||
sourceDir.copyRecursively(projectDir.toFile(), overwrite = true) | ||
ProjectManagerEx.getInstanceEx().openProject(projectDir, OpenProjectTask())!! | ||
} else { | ||
ProjectManagerEx.getInstanceEx().newProject(projectDir, OpenProjectTask())!! | ||
} | ||
|
||
disposeOnTearDownInEdt { runCatching { ProjectManager.getInstance().closeAndDispose(project) } } | ||
|
||
ApplicationManager.getApplication().invokeAndWait { | ||
// empty - openTestProject executed not in EDT, so, invokeAndWait just forces | ||
// processing of all events that were queued during project opening | ||
} | ||
|
||
return project | ||
} | ||
|
||
private fun disposeOnTearDownInEdt(runnable: Runnable) { | ||
Disposer.register( | ||
testRootDisposable, | ||
Disposable { | ||
ApplicationManager.getApplication().invokeAndWait(runnable) | ||
}, | ||
) | ||
} | ||
|
||
protected val mpsProject: MPSProject get() { | ||
return checkNotNull(ProjectHelper.fromIdeaProject(project)) { "MPS project not loaded" } | ||
} | ||
|
||
protected fun <R> writeAction(body: () -> R): R { | ||
return mpsProject.modelAccess.computeWriteAction(body) | ||
} | ||
|
||
protected fun <R> writeActionOnEdt(body: () -> R): R { | ||
return onEdt { writeAction { body() } } | ||
} | ||
|
||
protected fun <R> onEdt(body: () -> R): R { | ||
var result: R? = null | ||
ThreadUtils.runInUIThreadAndWait { | ||
result = body() | ||
} | ||
return result as R | ||
} | ||
|
||
protected fun <R> readAction(body: () -> R): R { | ||
var result: R? = null | ||
mpsProject.modelAccess.runReadAction { | ||
result = body() | ||
} | ||
return result as R | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import org.modelix.mps.api.ModelixMpsApi | ||
|
||
class VirtualFolderTests203 : TestBase("SimpleProject") { | ||
|
||
fun `test getVirtualFolder`() { | ||
val module = ModelixMpsApi.getMPSProjects().single().projectModules.single() | ||
val folder = ModelixMpsApi.getVirtualFolder(module) | ||
assertEquals("myFolder", folder) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project version="4"> | ||
<component name="MPSProject"> | ||
<projectModules> | ||
<modulePath path="$PROJECT_DIR$/solutions/Solution1/Solution1.msd" folder="myFolder" /> | ||
</projectModules> | ||
</component> | ||
</project> |
22 changes: 22 additions & 0 deletions
22
test/203/testdata/SimpleProject/solutions/Solution1/Solution1.msd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<solution name="Solution1" uuid="6517ba0d-f632-49c5-a166-401587c2c3ca" moduleVersion="0" compileInMPS="true"> | ||
<models> | ||
<modelRoot contentPath="${module}" type="default"> | ||
<sourceRoot location="models" /> | ||
</modelRoot> | ||
</models> | ||
<facets> | ||
<facet type="java"> | ||
<classes generated="true" path="${module}/classes_gen" /> | ||
</facet> | ||
</facets> | ||
<sourcePath /> | ||
<languageVersions> | ||
<language slang="l:f3061a53-9226-4cc5-a443-f952ceaf5816:jetbrains.mps.baseLanguage" version="11" /> | ||
<language slang="l:ceab5195-25ea-4f22-9b92-103b95ca8c0c:jetbrains.mps.lang.core" version="2" /> | ||
<language slang="l:9ded098b-ad6a-4657-bfd9-48636cfe8bc3:jetbrains.mps.lang.traceable" version="0" /> | ||
</languageVersions> | ||
<dependencyVersions> | ||
<module reference="6517ba0d-f632-49c5-a166-401587c2c3ca(Solution1)" version="0" /> | ||
</dependencyVersions> | ||
</solution> |
42 changes: 42 additions & 0 deletions
42
test/203/testdata/SimpleProject/solutions/Solution1/models/Solution1.model1.mps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<model ref="r:630db018-71e0-498d-8b21-6ec252b3533a(Solution1.model1)"> | ||
<persistence version="9" /> | ||
<languages> | ||
<use id="f3061a53-9226-4cc5-a443-f952ceaf5816" name="jetbrains.mps.baseLanguage" version="11" /> | ||
</languages> | ||
<imports /> | ||
<registry> | ||
<language id="f3061a53-9226-4cc5-a443-f952ceaf5816" name="jetbrains.mps.baseLanguage"> | ||
<concept id="1068390468198" name="jetbrains.mps.baseLanguage.structure.ClassConcept" flags="ig" index="312cEu" /> | ||
<concept id="1068580123132" name="jetbrains.mps.baseLanguage.structure.BaseMethodDeclaration" flags="ng" index="3clF44"> | ||
<child id="1068580123133" name="returnType" index="3clF45" /> | ||
<child id="1068580123135" name="body" index="3clF47" /> | ||
</concept> | ||
<concept id="1068580123165" name="jetbrains.mps.baseLanguage.structure.InstanceMethodDeclaration" flags="ig" index="3clFb_" /> | ||
<concept id="1068580123136" name="jetbrains.mps.baseLanguage.structure.StatementList" flags="sn" stub="5293379017992965193" index="3clFbS" /> | ||
<concept id="1068581517677" name="jetbrains.mps.baseLanguage.structure.VoidType" flags="in" index="3cqZAl" /> | ||
<concept id="1107461130800" name="jetbrains.mps.baseLanguage.structure.Classifier" flags="ng" index="3pOWGL"> | ||
<child id="5375687026011219971" name="member" index="jymVt" unordered="true" /> | ||
</concept> | ||
<concept id="1178549954367" name="jetbrains.mps.baseLanguage.structure.IVisible" flags="ng" index="1B3ioH"> | ||
<child id="1178549979242" name="visibility" index="1B3o_S" /> | ||
</concept> | ||
<concept id="1146644602865" name="jetbrains.mps.baseLanguage.structure.PublicVisibility" flags="nn" index="3Tm1VV" /> | ||
</language> | ||
<language id="ceab5195-25ea-4f22-9b92-103b95ca8c0c" name="jetbrains.mps.lang.core"> | ||
<concept id="1169194658468" name="jetbrains.mps.lang.core.structure.INamedConcept" flags="ng" index="TrEIO"> | ||
<property id="1169194664001" name="name" index="TrG5h" /> | ||
</concept> | ||
</language> | ||
</registry> | ||
<node concept="312cEu" id="3cIAtmcX1Sw"> | ||
<property role="TrG5h" value="Class1" /> | ||
<node concept="3clFb_" id="3cIAtmcX1Te" role="jymVt"> | ||
<property role="TrG5h" value="method1" /> | ||
<node concept="3cqZAl" id="3cIAtmcX1Tg" role="3clF45" /> | ||
<node concept="3Tm1VV" id="3cIAtmcX1Th" role="1B3o_S" /> | ||
<node concept="3clFbS" id="3cIAtmcX1Ti" role="3clF47" /> | ||
</node> | ||
<node concept="3Tm1VV" id="3cIAtmcX1Sx" role="1B3o_S" /> | ||
</node> | ||
</model> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
plugins { | ||
alias(libs.plugins.intellij) | ||
alias(libs.plugins.kotlin.jvm) | ||
} | ||
|
||
intellij { | ||
localPath = project(":impl211").layout.buildDirectory.dir("mps").map { it.asFile.absolutePath } | ||
instrumentCode = false | ||
} | ||
|
||
tasks { | ||
buildSearchableOptions { | ||
enabled = false | ||
} | ||
} | ||
|
||
dependencies { | ||
testImplementation(project(":lib")) | ||
} |
Oops, something went wrong.