mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
build-scripts: method in JarPackager to get module output as source
useful for replacing JPS artifacts usage GitOrigin-RevId: 8dd8eee59a9c6803a5a9b67b97346b2bb0adecc0
This commit is contained in:
committed by
intellij-monorepo-bot
parent
002e458d50
commit
e8aba7b2fe
@@ -20,6 +20,7 @@ import kotlinx.coroutines.coroutineScope
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
import org.jetbrains.intellij.build.BuildContext
|
||||
import org.jetbrains.intellij.build.CompilationContext
|
||||
import org.jetbrains.intellij.build.DirSource
|
||||
import org.jetbrains.intellij.build.FrontendModuleFilter
|
||||
import org.jetbrains.intellij.build.InMemoryContentSource
|
||||
@@ -842,6 +843,19 @@ internal val commonModuleExcludes: List<PathMatcher> = FileSystems.getDefault().
|
||||
)
|
||||
}
|
||||
|
||||
suspend fun moduleOutputAsSource(context: CompilationContext, module: JpsModule, excludes: List<PathMatcher> = commonModuleExcludes): Source {
|
||||
val moduleOutput = context.getModuleOutputDir(module)
|
||||
check(Files.exists(moduleOutput)) {
|
||||
"${module.name} module output directory doesn't exist: $moduleOutput"
|
||||
}
|
||||
return if (moduleOutput.toString().endsWith(".jar")) {
|
||||
ZipSource(file = moduleOutput, distributionFileEntryProducer = null, filter = createModuleSourcesNamesFilter(excludes))
|
||||
}
|
||||
else {
|
||||
DirSource(dir = moduleOutput, excludes = excludes)
|
||||
}
|
||||
}
|
||||
|
||||
fun createModuleSourcesNamesFilter(excludes: List<PathMatcher>): (String) -> Boolean = { name ->
|
||||
val p = Path.of(name)
|
||||
excludes.none { it.matches(p) }
|
||||
|
||||
Reference in New Issue
Block a user