JS: generate paths in source maps relative to .map file location
See KT-19818
Original commit: 9008791a54
This commit is contained in:
@@ -359,7 +359,7 @@ open class KotlinJpsBuildTest : AbstractKotlinJpsBuildTestCase() {
|
|||||||
buildAllModules().assertSuccessful()
|
buildAllModules().assertSuccessful()
|
||||||
|
|
||||||
val sourceMapContent = File(getOutputDir(PROJECT_NAME), "$PROJECT_NAME.js.map").readText()
|
val sourceMapContent = File(getOutputDir(PROJECT_NAME), "$PROJECT_NAME.js.map").readText()
|
||||||
val expectedPath = "prefix-dir/pkg/test1.kt"
|
val expectedPath = "prefix-dir/src/pkg/test1.kt"
|
||||||
assertTrue("Source map file should contain relative path ($expectedPath)", sourceMapContent.contains("\"$expectedPath\""))
|
assertTrue("Source map file should contain relative path ($expectedPath)", sourceMapContent.contains("\"$expectedPath\""))
|
||||||
|
|
||||||
val librarySourceMapFile = File(getOutputDir(PROJECT_NAME), "lib/kotlin.js.map")
|
val librarySourceMapFile = File(getOutputDir(PROJECT_NAME), "lib/kotlin.js.map")
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ import org.jetbrains.kotlin.progress.CompilationCanceledStatus
|
|||||||
import org.jetbrains.kotlin.utils.*
|
import org.jetbrains.kotlin.utils.*
|
||||||
import org.jetbrains.org.objectweb.asm.ClassReader
|
import org.jetbrains.org.objectweb.asm.ClassReader
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
import java.net.URI
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
|
||||||
class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
||||||
@@ -647,7 +648,10 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
|||||||
val compilerSettings = JpsKotlinCompilerSettings.getCompilerSettings(representativeModule)
|
val compilerSettings = JpsKotlinCompilerSettings.getCompilerSettings(representativeModule)
|
||||||
val k2JsArguments = JpsKotlinCompilerSettings.getK2JsCompilerArguments(representativeModule)
|
val k2JsArguments = JpsKotlinCompilerSettings.getK2JsCompilerArguments(representativeModule)
|
||||||
|
|
||||||
val sourceRoots = KotlinSourceFileCollector.getRelevantSourceRoots(representativeTarget).map { it.file }
|
val sourceRoots = representativeModule.contentRootsList.urls
|
||||||
|
.map { URI.create(it) }
|
||||||
|
.filter { it.scheme == "file" }
|
||||||
|
.map { File(it) }
|
||||||
|
|
||||||
val friendPaths = KotlinBuilderModuleScriptGenerator.getProductionModulesWhichInternalsAreVisible(representativeTarget).mapNotNull {
|
val friendPaths = KotlinBuilderModuleScriptGenerator.getProductionModulesWhichInternalsAreVisible(representativeTarget).mapNotNull {
|
||||||
val file = getOutputMetaFile(it, false)
|
val file = getOutputMetaFile(it, false)
|
||||||
|
|||||||
Reference in New Issue
Block a user