diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.kt index b6d1acacbef..a3a61b0f608 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/K2JSCompilerArguments.kt @@ -48,11 +48,12 @@ class K2JSCompilerArguments : CommonCompilerArguments() { var sourceMapPrefix: String? by FreezableVar(null) @Argument( - value = "-source-map-source-roots", + value = "-source-map-base-dirs", + deprecatedName = "-source-map-source-roots", valueDescription = "", description = "Base directories which are used to calculate relative paths to source files in source map" ) - var sourceMapSourceRoots: String? by FreezableVar(null) + var sourceMapBaseDirs: String? by FreezableVar(null) @GradleOption(DefaultValues.JsSourceMapContentModes::class) @Argument( diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/js/K2JSCompiler.java b/compiler/cli/src/org/jetbrains/kotlin/cli/js/K2JSCompiler.java index 04926cb3d11..24b6088880d 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/js/K2JSCompiler.java +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/js/K2JSCompiler.java @@ -357,8 +357,8 @@ public class K2JSCompiler extends CLICompiler { configuration.put(JSConfigurationKeys.SOURCE_MAP_PREFIX, arguments.getSourceMapPrefix()); } - String sourceMapSourceRoots = arguments.getSourceMapSourceRoots() != null ? - arguments.getSourceMapSourceRoots() : + String sourceMapSourceRoots = arguments.getSourceMapBaseDirs() != null ? + arguments.getSourceMapBaseDirs() : calculateSourceMapSourceRoot(messageCollector, arguments); List sourceMapSourceRootList = StringUtil.split(sourceMapSourceRoots, File.pathSeparator); configuration.put(JSConfigurationKeys.SOURCE_MAP_SOURCE_ROOTS, sourceMapSourceRootList); @@ -367,7 +367,7 @@ public class K2JSCompiler extends CLICompiler { if (arguments.getSourceMapPrefix() != null) { messageCollector.report(WARNING, "source-map-prefix argument has no effect without source map", null); } - if (arguments.getSourceMapSourceRoots() != null) { + if (arguments.getSourceMapBaseDirs() != null) { messageCollector.report(WARNING, "source-map-source-root argument has no effect without source map", null); } } diff --git a/compiler/testData/cli/js/jsHelp.out b/compiler/testData/cli/js/jsHelp.out index c1334ac1393..f76e57906fe 100644 --- a/compiler/testData/cli/js/jsHelp.out +++ b/compiler/testData/cli/js/jsHelp.out @@ -10,11 +10,10 @@ where possible options include: -output-postfix Path to file which will be added to the end of output file -output-prefix Path to file which will be added to the beginning of output file -source-map Generate source map + -source-map-base-dirs Base directories which are used to calculate relative paths to source files in source map -source-map-embed-sources { always, never, inlining } Embed source files into source map -source-map-prefix Prefix for paths in a source map - -source-map-source-roots - Base directories which are used to calculate relative paths to source files in source map -target { v5 } Generate JS files for specific ECMA version -api-version Allow to use declarations only from the specified version of bundled libraries -X Print a synopsis of advanced options diff --git a/compiler/testData/cli/js/sourceMapDuplicateRelativePaths.args b/compiler/testData/cli/js/sourceMapDuplicateRelativePaths.args index e99539d99f3..77f63052fe4 100644 --- a/compiler/testData/cli/js/sourceMapDuplicateRelativePaths.args +++ b/compiler/testData/cli/js/sourceMapDuplicateRelativePaths.args @@ -1,7 +1,7 @@ $TESTDATA_DIR$/sourceMapDuplicatePath/ -no-stdlib -source-map --source-map-source-roots +-source-map-base-dirs $TESTDATA_DIR$/sourceMapDuplicatePath/foo:$TESTDATA_DIR$/sourceMapDuplicatePath/bar -output $TEMP_DIR$/out.js diff --git a/compiler/testData/cli/js/sourceMapRootManual.args b/compiler/testData/cli/js/sourceMapRootManual.args index 92d3231bc81..e280b72da6f 100644 --- a/compiler/testData/cli/js/sourceMapRootManual.args +++ b/compiler/testData/cli/js/sourceMapRootManual.args @@ -2,7 +2,7 @@ $TESTDATA_DIR$/sourceMapRoot/foo/file1.kt $TESTDATA_DIR$/sourceMapRoot/bar/file2.kt -no-stdlib -source-map --source-map-source-roots +-source-map-base-dirs $TESTDATA_DIR$/ -output $TEMP_DIR$/out.js diff --git a/compiler/testData/cli/js/sourceMapRootMissing.args b/compiler/testData/cli/js/sourceMapRootMissing.args index 1afe84d1637..b7142ce5ce6 100644 --- a/compiler/testData/cli/js/sourceMapRootMissing.args +++ b/compiler/testData/cli/js/sourceMapRootMissing.args @@ -4,7 +4,7 @@ $TESTDATA_DIR$/sourceMapRoot/bar/baz/file3.kt $TESTDATA_DIR$/sourceMapRoot/foo/baz/file4.kt -no-stdlib -source-map --source-map-source-roots +-source-map-base-dirs $TESTDATA_DIR$/sourceMapRoot/foo -output $TEMP_DIR$/out.js diff --git a/compiler/testData/cli/js/sourceMapRootMultiple.args b/compiler/testData/cli/js/sourceMapRootMultiple.args index 1cc53c0a34b..6e122e374a2 100644 --- a/compiler/testData/cli/js/sourceMapRootMultiple.args +++ b/compiler/testData/cli/js/sourceMapRootMultiple.args @@ -2,7 +2,7 @@ $TESTDATA_DIR$/sourceMapRoot/foo/file1.kt $TESTDATA_DIR$/sourceMapRoot/bar/file2.kt -no-stdlib -source-map --source-map-source-roots +-source-map-base-dirs $TESTDATA_DIR$/foo:$TESTDATA_DIR$/bar -output $TEMP_DIR$/out.js diff --git a/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsKotlinCompilerRunner.kt b/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsKotlinCompilerRunner.kt index c32fe8ac171..1984d68caba 100644 --- a/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsKotlinCompilerRunner.kt +++ b/jps-plugin/src/org/jetbrains/kotlin/compilerRunner/JpsKotlinCompilerRunner.kt @@ -97,7 +97,7 @@ class JpsKotlinCompilerRunner : KotlinCompilerRunner() { setupK2JsArguments(outputFile, sourceFiles, libraries, friendModules, arguments) if (arguments.sourceMap) { - arguments.sourceMapSourceRoots = sourceRoots.joinToString(File.pathSeparator) { it.path } + arguments.sourceMapBaseDirs = sourceRoots.joinToString(File.pathSeparator) { it.path } } log.debug("K2JS: arguments after setup" + ArgumentUtils.convertArgumentsToStringList(arguments))