mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[Workspace Model] Disable generator version check in tests where you do generate entities
GitOrigin-RevId: 3ed8fbeb4c3b646bdff2355b11bd8214677c8e9a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
150183ea6d
commit
84574c4b3f
+14
-12
@@ -16,6 +16,7 @@ object CodeGeneratorVersions {
|
||||
|
||||
var checkApiInInterface = true
|
||||
var checkApiInImpl = true
|
||||
var checkImplInImpl = true
|
||||
}
|
||||
|
||||
@Target(AnnotationTarget.CLASS)
|
||||
@@ -65,18 +66,19 @@ object GeneratedCodeCompatibilityChecker {
|
||||
}
|
||||
}
|
||||
|
||||
// Check that impl class has the correct impl version
|
||||
val entityImplImplVersion = implAnnotations.filterIsInstance<GeneratedCodeImplVersion>().singleOrNull()?.version
|
||||
?: error("Generated class '$implClass' doesn't have an impl version marker. " +
|
||||
"You should regenerate the code of your entities")
|
||||
assert(entityImplImplVersion == CodeGeneratorVersions.IMPL_VERSION) {
|
||||
"""
|
||||
Current IMPL version of the generator is '${CodeGeneratorVersions.IMPL_VERSION}',
|
||||
but the generated code is marked as version '$entityImplImplVersion'.
|
||||
Please, regenerate your entities.
|
||||
|
||||
Checked entity: $implClass
|
||||
""".trimIndent()
|
||||
if (CodeGeneratorVersions.checkImplInImpl) { // Check that impl class has the correct impl version
|
||||
val entityImplImplVersion = implAnnotations.filterIsInstance<GeneratedCodeImplVersion>().singleOrNull()?.version
|
||||
?: error("Generated class '$implClass' doesn't have an impl version marker. " +
|
||||
"You should regenerate the code of your entities")
|
||||
assert(entityImplImplVersion == CodeGeneratorVersions.IMPL_VERSION) {
|
||||
"""
|
||||
Current IMPL version of the generator is '${CodeGeneratorVersions.IMPL_VERSION}',
|
||||
but the generated code is marked as version '$entityImplImplVersion'.
|
||||
Please, regenerate your entities.
|
||||
|
||||
Checked entity: $implClass
|
||||
""".trimIndent()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+17
-1
@@ -7,10 +7,26 @@ import com.intellij.openapi.vfs.VirtualFileFilter
|
||||
import com.intellij.openapi.vfs.VirtualFileManager
|
||||
import com.intellij.testFramework.PlatformTestUtil
|
||||
import com.intellij.util.SystemProperties
|
||||
import com.intellij.workspaceModel.storage.CodeGeneratorVersions
|
||||
import java.io.File
|
||||
import java.nio.file.Path
|
||||
|
||||
class IntellijEntitiesGenerationTest : CodeGenerationTestBase() {
|
||||
|
||||
override fun setUp() {
|
||||
CodeGeneratorVersions.checkApiInInterface = false
|
||||
CodeGeneratorVersions.checkApiInImpl = false
|
||||
CodeGeneratorVersions.checkImplInImpl = false
|
||||
super.setUp()
|
||||
}
|
||||
|
||||
override fun tearDown() {
|
||||
super.tearDown()
|
||||
CodeGeneratorVersions.checkApiInInterface = true
|
||||
CodeGeneratorVersions.checkApiInImpl = true
|
||||
CodeGeneratorVersions.checkImplInImpl = true
|
||||
}
|
||||
|
||||
private enum class IntellijEntitiesPackage(val apiRootRelativePath: String, val implRootRelativePath: String, val pathToPackage: String, val keepPropertiesWithUnknownType: Boolean = false) {
|
||||
Bridges("platform/workspaceModel/storage/src",
|
||||
"platform/workspaceModel/storage/gen",
|
||||
@@ -19,7 +35,7 @@ class IntellijEntitiesGenerationTest : CodeGenerationTestBase() {
|
||||
"plugins/eclipse/gen",
|
||||
"org/jetbrains/idea/eclipse/workspaceModel"),
|
||||
Tests("platform/workspaceModel/storage/testEntities/testSrc",
|
||||
"platform/workspaceModel/storage/testEntities/gen",
|
||||
"platform/workspaceModel/storage/testEntities/gen",
|
||||
"com/intellij/workspaceModel/storage/entities/test/api", true);
|
||||
|
||||
val apiRootPath: Path
|
||||
|
||||
Reference in New Issue
Block a user