mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-16 22:51:17 +07:00
A new implementation which generates and loads the runtime module repository from a module-descriptors.dat file in binary format is implemented. module-descriptors.jar in the old format is still generated for compatibility with other tools (e.g., IntelliJ Platform Gradle Plugin) and to provide a human-readable view. It's also used as a fallback variant if module-descriptors.dat is absent. The new format speeds up loading by around 10 times. GitOrigin-RevId: b17ba7b53f825e6dcf243ff0aa5b7aedaf7ab9e2
99 lines
2.3 KiB
Kotlin
99 lines
2.3 KiB
Kotlin
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
|
package com.intellij.devkit.runtimeModuleRepository.jps.build
|
|
|
|
import org.jetbrains.jps.builders.BuildResult
|
|
import org.jetbrains.jps.builders.CompileScopeTestBuilder
|
|
import org.jetbrains.jps.model.java.JavaSourceRootType
|
|
|
|
class RuntimeModuleRepositoryIncrementalBuildTest : RuntimeModuleRepositoryTestCase() {
|
|
fun `test up to date`() {
|
|
addModule("a", withTests = false)
|
|
buildRepository().assertSuccessful()
|
|
assertUpToDate()
|
|
}
|
|
|
|
fun `test add source root`() {
|
|
val a = addModule("a", withTests = false, withSources = false)
|
|
buildAndCheck {
|
|
descriptor("a", resourceDirName = null)
|
|
}
|
|
|
|
a.addSourceRoot(getUrl("a/src"), JavaSourceRootType.SOURCE)
|
|
buildAndCheck {
|
|
descriptor("a")
|
|
}
|
|
assertUpToDate()
|
|
}
|
|
|
|
fun `test add source file`() {
|
|
addModule("a", withTests = false)
|
|
buildAndCheck {
|
|
descriptor("a")
|
|
}
|
|
|
|
createFile("a/src/A.java", "class A {}")
|
|
assertUpToDate()
|
|
}
|
|
|
|
fun `test add remove dependency`() {
|
|
val a = addModule("a", withTests = false)
|
|
val b = addModule("b", withTests = false)
|
|
buildAndCheck {
|
|
descriptor("a")
|
|
descriptor("b")
|
|
}
|
|
|
|
b.dependenciesList.addModuleDependency(a)
|
|
buildAndCheck {
|
|
descriptor("a")
|
|
descriptor("b", "a")
|
|
}
|
|
assertUpToDate()
|
|
|
|
b.dependenciesList.clear()
|
|
buildAndCheck {
|
|
descriptor("a")
|
|
descriptor("b")
|
|
}
|
|
assertUpToDate()
|
|
}
|
|
|
|
fun `test add remove module`() {
|
|
addModule("a", withTests = false)
|
|
buildAndCheck {
|
|
descriptor("a")
|
|
}
|
|
|
|
val b = addModule("b", withTests = false)
|
|
buildAndCheck {
|
|
descriptor("a")
|
|
descriptor("b")
|
|
}
|
|
|
|
myProject.removeModule(b)
|
|
buildAndCheck {
|
|
descriptor("a")
|
|
}
|
|
assertUpToDate()
|
|
}
|
|
|
|
fun `test delete output`() {
|
|
addModule("a", withTests = false)
|
|
buildAndCheck {
|
|
descriptor("a")
|
|
}
|
|
|
|
deleteFile("out/${RuntimeModuleRepositoryBuildConstants.COMPACT_REPOSITORY_FILE_NAME}")
|
|
buildAndCheck {
|
|
descriptor("a")
|
|
}
|
|
}
|
|
|
|
private fun assertUpToDate() {
|
|
buildRepository().assertUpToDate()
|
|
}
|
|
|
|
private fun buildRepository(): BuildResult {
|
|
return doBuild(CompileScopeTestBuilder.make().targetTypes(RuntimeModuleRepositoryTarget))
|
|
}
|
|
} |