From 21bf497830d1ae31a46e30ff10930f5ff5a1db8c Mon Sep 17 00:00:00 2001 From: Sebastian Sellmair Date: Tue, 21 Feb 2023 15:12:21 +0100 Subject: [PATCH] [CLI] Replace K2 -Xmodule by -Xfragments and -Xfragment-sources KT-56210 --- .../arguments/CommonCompilerArguments.kt | 17 ++++-- .../jetbrains/kotlin/cli/common/arguments.kt | 46 ++++++++++------ compiler/testData/cli/js/jsExtraHelp.out | 5 +- compiler/testData/cli/js/successfulHmpp.args | 7 ++- compiler/testData/cli/jvm/extraHelp.out | 5 +- .../cli/jvm/hmpp/cycleInDependencies.args | 7 ++- .../cli/jvm/hmpp/dependsOnSingleModule.args | 3 +- ...es.args => dependsOnWithoutFragments.args} | 0 ...ules.out => dependsOnWithoutFragments.out} | 2 +- .../cli/jvm/hmpp/dependsOnWithoutModules.out | 2 +- ...ctSyntax.args => duplicatedFragments.args} | 2 +- ...rectSyntax.out => duplicatedFragments.out} | 1 - .../cli/jvm/hmpp/duplicatedModules.args | 10 ---- ...gs => fragmentSourcesIncorrectSyntax.args} | 3 +- .../hmpp/fragmentSourcesIncorrectSyntax.out | 14 +++++ ...urces.args => fragmentWithoutSources.args} | 3 +- ...Sources.out => fragmentWithoutSources.out} | 0 .../cli/jvm/hmpp/lowLanguageVersion.args | 3 +- .../cli/jvm/hmpp/lowLanguageVersion.out | 2 +- ...issingModule.args => missingFragment.args} | 4 +- ...{missingModule.out => missingFragment.out} | 2 +- .../hmpp/sameSourceInDifferentFragments.args | 11 ++++ ...out => sameSourceInDifferentFragments.out} | 3 +- ...dules.args => sourceNotInAnyFragment.args} | 4 +- ...yModule.out => sourceNotInAnyFragment.out} | 0 .../cli/jvm/hmpp/successfulCompilation.args | 9 ++- .../cli/jvm/hmpp/successfulCompilation2.args | 11 ++++ .../cli/jvm/hmpp/successfulCompilation2.out | 11 ++++ .../testData/cli/metadata/successfulHmpp.args | 7 ++- .../kotlin/cli/CliTestGenerated.java | 55 ++++++++++--------- 30 files changed, 157 insertions(+), 92 deletions(-) rename compiler/testData/cli/jvm/hmpp/{dependsOnWithoutModules.args => dependsOnWithoutFragments.args} (100%) rename compiler/testData/cli/jvm/hmpp/{duplicatedModules.out => dependsOnWithoutFragments.out} (87%) rename compiler/testData/cli/jvm/hmpp/{moduleIncorrectSyntax.args => duplicatedFragments.args} (85%) rename compiler/testData/cli/jvm/hmpp/{moduleIncorrectSyntax.out => duplicatedFragments.out} (81%) delete mode 100644 compiler/testData/cli/jvm/hmpp/duplicatedModules.args rename compiler/testData/cli/jvm/hmpp/{sourceNotInAnyModule.args => fragmentSourcesIncorrectSyntax.args} (72%) create mode 100644 compiler/testData/cli/jvm/hmpp/fragmentSourcesIncorrectSyntax.out rename compiler/testData/cli/jvm/hmpp/{moduleWithoutSources.args => fragmentWithoutSources.args} (80%) rename compiler/testData/cli/jvm/hmpp/{moduleWithoutSources.out => fragmentWithoutSources.out} (100%) rename compiler/testData/cli/jvm/hmpp/{missingModule.args => missingFragment.args} (61%) rename compiler/testData/cli/jvm/hmpp/{missingModule.out => missingFragment.out} (88%) create mode 100644 compiler/testData/cli/jvm/hmpp/sameSourceInDifferentFragments.args rename compiler/testData/cli/jvm/hmpp/{sameSourceInDifferentModules.out => sameSourceInDifferentFragments.out} (84%) rename compiler/testData/cli/jvm/hmpp/{sameSourceInDifferentModules.args => sourceNotInAnyFragment.args} (63%) rename compiler/testData/cli/jvm/hmpp/{sourceNotInAnyModule.out => sourceNotInAnyFragment.out} (100%) create mode 100644 compiler/testData/cli/jvm/hmpp/successfulCompilation2.args create mode 100644 compiler/testData/cli/jvm/hmpp/successfulCompilation2.out diff --git a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt index 7f49eeac1f2..b4ba1f0e4e9 100644 --- a/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt +++ b/compiler/cli/cli-common/src/org/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments.kt @@ -717,12 +717,18 @@ abstract class CommonCompilerArguments : CommonToolArguments() { } @Argument( - value = "-Xmodule", - valueDescription = ";", - description = "Describes module with specific sources. Usage of this arguments requires to specify module for each source file from free args", - delimiter = "" + value = "-Xfragments", + valueDescription = "", + description = "Declares all known fragments of a multiplatform compilation" ) - var modulesDescription: Array? = null + var fragments: Array? = null + + @Argument( + value = "-Xfragment-sources", + valueDescription = ";", + description = "Adds sources to a specific fragment of a multiplatform compilation", + ) + var fragmentSources: Array? = null set(value) { checkFrozen() field = value @@ -732,7 +738,6 @@ abstract class CommonCompilerArguments : CommonToolArguments() { value = "-Xdepends-on", valueDescription = ":", description = "Declares that depends on with dependsOn relation", - delimiter = "" ) var dependsOnDependencies: Array? = null set(value) { diff --git a/compiler/cli/src/org/jetbrains/kotlin/cli/common/arguments.kt b/compiler/cli/src/org/jetbrains/kotlin/cli/common/arguments.kt index 171ed7bba02..0a9019257ea 100644 --- a/compiler/cli/src/org/jetbrains/kotlin/cli/common/arguments.kt +++ b/compiler/cli/src/org/jetbrains/kotlin/cli/common/arguments.kt @@ -130,7 +130,8 @@ private fun MessageCollector.reportUnsafeInternalArgum } private fun CompilerConfiguration.buildHmppModuleStructure(arguments: CommonCompilerArguments): HmppCliModuleStructure? { - val rawModules = arguments.modulesDescription + val rawFragments = arguments.fragments + val rawFragmentSources = arguments.fragmentSources val rawDependencies = arguments.dependsOnDependencies val messageCollector = getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY) @@ -143,33 +144,41 @@ private fun CompilerConfiguration.buildHmppModuleStructure(arguments: CommonComp messageCollector.report(CompilerMessageSeverity.WARNING, message) } - if (rawModules == null) { + if (rawFragments == null) { if (rawDependencies != null) { - reportError("-Xdepends-on flag can not be used without -Xmodule") + reportError("-Xdepends-on flag can not be used without -Xfragments") } return null } if (!languageVersionSettings.languageVersion.usesK2) { - reportWarning("-Xmodule flag is not supported for language version < 2.0") + reportWarning("-Xfragments flag is not supported for language version < 2.0") return null } - var modules = rawModules.mapNotNull { arg -> - val split = arg.split(";") - val name = split.first() - when (split.size) { - 1 -> reportWarning("Incorrect syntax for -Xmodule argument. Module $name has no sources") - 2 -> {} // OK - else -> { - reportError("Incorrect syntax for -Xmodule argument. `;` expected but got `$arg`") - return@mapNotNull null + + val sourcesByFragmentName: Map> = rawFragments.associateWith { mutableSetOf() }.apply { + rawFragmentSources.orEmpty().forEach { rawFragmentSourceArg -> + val split = rawFragmentSourceArg.split(";") + if (split.size != 2) { + reportError( + "Incorrect syntax for -Xfragment-sources argument. " + + "`;` expected but got `$rawFragmentSourceArg`" + ) + return@forEach } + val fragmentName = split[0] + val fragmentSource = split[1] + + getOrElse(fragmentName) { + reportError("fragment `$fragmentName` of source file $fragmentSource is not specified in -Xfragments") + return@forEach + }.add(fragmentSource) } - val sources = split.getOrNull(1)?.split(",")?.toSet().orEmpty() - HmppCliModule(name, sources) } + var modules = sourcesByFragmentName.map { (fragmentName, sources) -> HmppCliModule(fragmentName, sources) } + var wasError = false // check sources mapping for (i in modules.indices) { @@ -185,7 +194,10 @@ private fun CompilerConfiguration.buildHmppModuleStructure(arguments: CommonComp append("Files ") append(commonFiles.joinToString(", ") { "'$it'" }) } - append(" can be a part of only one module, but is listed as a source for both `${m1.name}` and `${m2.name}`, please check you -Xmodule options.") + append( + " can be a part of only one module, but is listed as a source for both `${m1.name}` and `${m2.name}`, " + + "please check you -Xfragment-sources options." + ) } reportError(message) wasError = true @@ -233,7 +245,7 @@ private fun CompilerConfiguration.buildHmppModuleStructure(arguments: CommonComp fun findModule(name: String): HmppCliModule? { return moduleByName[name].also { module -> if (module == null) { - reportError("Module `$name` not found in -Xmodule arguments") + reportError("Module `$name` not found in -Xfragments arguments") } } } diff --git a/compiler/testData/cli/js/jsExtraHelp.out b/compiler/testData/cli/js/jsExtraHelp.out index 08e3c2c7d6f..bf08e1fab95 100644 --- a/compiler/testData/cli/js/jsExtraHelp.out +++ b/compiler/testData/cli/js/jsExtraHelp.out @@ -83,6 +83,9 @@ where advanced options include: Use 'warning' level to issue warnings instead of errors. -Xextended-compiler-checks Enable additional compiler checks that might provide verbose diagnostic information for certain errors. Warning: this mode is not backward-compatible and might cause compilation errors in previously compiled code. + -Xfragment-sources=; + Adds sources to a specific fragment of a multiplatform compilation + -Xfragments= Declares all known fragments of a multiplatform compilation -Xenable-incremental-compilation Enable incremental compilation -Xinference-compatibility Enable compatibility changes for generic type inference algorithm @@ -91,8 +94,6 @@ where advanced options include: -Xlegacy-smart-cast-after-try Allow var smart casts despite assignment in try block -Xlist-phases List backend phases -Xmetadata-version Change metadata version of the generated binary files - -Xmodule=; - Describes module with specific sources. Usage of this arguments requires to specify module for each source file from free args -Xmulti-platform Enable experimental language support for multi-platform projects -Xnew-inference Enable new experimental generic type inference algorithm -Xno-check-actual Do not check presence of 'actual' modifier in multi-platform projects diff --git a/compiler/testData/cli/js/successfulHmpp.args b/compiler/testData/cli/js/successfulHmpp.args index 4b87e05d149..df5a44f5e90 100644 --- a/compiler/testData/cli/js/successfulHmpp.args +++ b/compiler/testData/cli/js/successfulHmpp.args @@ -8,8 +8,9 @@ fir-hmpp -language-version 2.0 -XXLanguage\:+MultiPlatformProjects --Xmodule=a;$TESTDATA_DIR$/../jvm/hmpp/src/a.kt --Xmodule=b;$TESTDATA_DIR$/../jvm/hmpp/src/b.kt --Xmodule=c;$TESTDATA_DIR$/../jvm/hmpp/src/c.kt +-Xfragments=a,b,c +-Xfragment-sources=a;$TESTDATA_DIR$/../jvm/hmpp/src/a.kt +-Xfragment-sources=b;$TESTDATA_DIR$/../jvm/hmpp/src/b.kt +-Xfragment-sources=c;$TESTDATA_DIR$/../jvm/hmpp/src/c.kt -Xdepends-on=b\:a -Xdepends-on=c\:b diff --git a/compiler/testData/cli/jvm/extraHelp.out b/compiler/testData/cli/jvm/extraHelp.out index 57bfbb0450d..cf6457bb9c2 100644 --- a/compiler/testData/cli/jvm/extraHelp.out +++ b/compiler/testData/cli/jvm/extraHelp.out @@ -189,6 +189,9 @@ where advanced options include: Use 'warning' level to issue warnings instead of errors. -Xextended-compiler-checks Enable additional compiler checks that might provide verbose diagnostic information for certain errors. Warning: this mode is not backward-compatible and might cause compilation errors in previously compiled code. + -Xfragment-sources=; + Adds sources to a specific fragment of a multiplatform compilation + -Xfragments= Declares all known fragments of a multiplatform compilation -Xenable-incremental-compilation Enable incremental compilation -Xinference-compatibility Enable compatibility changes for generic type inference algorithm @@ -197,8 +200,6 @@ where advanced options include: -Xlegacy-smart-cast-after-try Allow var smart casts despite assignment in try block -Xlist-phases List backend phases -Xmetadata-version Change metadata version of the generated binary files - -Xmodule=; - Describes module with specific sources. Usage of this arguments requires to specify module for each source file from free args -Xmulti-platform Enable experimental language support for multi-platform projects -Xnew-inference Enable new experimental generic type inference algorithm -Xno-check-actual Do not check presence of 'actual' modifier in multi-platform projects diff --git a/compiler/testData/cli/jvm/hmpp/cycleInDependencies.args b/compiler/testData/cli/jvm/hmpp/cycleInDependencies.args index c8e6d791700..f738f885f54 100644 --- a/compiler/testData/cli/jvm/hmpp/cycleInDependencies.args +++ b/compiler/testData/cli/jvm/hmpp/cycleInDependencies.args @@ -6,9 +6,10 @@ $TEMP_DIR$ -language-version 2.0 -XXLanguage\:+MultiPlatformProjects --Xmodule=a;$TESTDATA_DIR$/src/a.kt --Xmodule=b;$TESTDATA_DIR$/src/b.kt --Xmodule=c;$TESTDATA_DIR$/src/c.kt +-Xfragments=a,b,c +-Xfragment-sources=a;$TESTDATA_DIR$/src/a.kt +-Xfragment-sources=b;$TESTDATA_DIR$/src/b.kt +-Xfragment-sources=c;$TESTDATA_DIR$/src/c.kt -Xdepends-on=b\:a -Xdepends-on=c\:b -Xdepends-on=a\:c diff --git a/compiler/testData/cli/jvm/hmpp/dependsOnSingleModule.args b/compiler/testData/cli/jvm/hmpp/dependsOnSingleModule.args index f9728c7f9f4..7ab57b889a1 100644 --- a/compiler/testData/cli/jvm/hmpp/dependsOnSingleModule.args +++ b/compiler/testData/cli/jvm/hmpp/dependsOnSingleModule.args @@ -4,5 +4,6 @@ $TEMP_DIR$ -language-version 2.0 -XXLanguage\:+MultiPlatformProjects --Xmodule=a;$TESTDATA_DIR$/src/a.kt +-Xfragments=a +-Xfragment-sources=a;$TESTDATA_DIR$/src/a.kt -Xdepends-on=b\:a diff --git a/compiler/testData/cli/jvm/hmpp/dependsOnWithoutModules.args b/compiler/testData/cli/jvm/hmpp/dependsOnWithoutFragments.args similarity index 100% rename from compiler/testData/cli/jvm/hmpp/dependsOnWithoutModules.args rename to compiler/testData/cli/jvm/hmpp/dependsOnWithoutFragments.args diff --git a/compiler/testData/cli/jvm/hmpp/duplicatedModules.out b/compiler/testData/cli/jvm/hmpp/dependsOnWithoutFragments.out similarity index 87% rename from compiler/testData/cli/jvm/hmpp/duplicatedModules.out rename to compiler/testData/cli/jvm/hmpp/dependsOnWithoutFragments.out index 11e3cf4a573..41c95a7bed5 100644 --- a/compiler/testData/cli/jvm/hmpp/duplicatedModules.out +++ b/compiler/testData/cli/jvm/hmpp/dependsOnWithoutFragments.out @@ -8,5 +8,5 @@ as no stability/compatibility guarantees are given on compiler or generated code. Use it at your own risk! warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features -error: there are multiple modules with same name(s): a, a +error: -Xdepends-on flag can not be used without -Xfragments COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/hmpp/dependsOnWithoutModules.out b/compiler/testData/cli/jvm/hmpp/dependsOnWithoutModules.out index 3d251418760..41c95a7bed5 100644 --- a/compiler/testData/cli/jvm/hmpp/dependsOnWithoutModules.out +++ b/compiler/testData/cli/jvm/hmpp/dependsOnWithoutModules.out @@ -8,5 +8,5 @@ as no stability/compatibility guarantees are given on compiler or generated code. Use it at your own risk! warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features -error: -Xdepends-on flag can not be used without -Xmodule +error: -Xdepends-on flag can not be used without -Xfragments COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/hmpp/moduleIncorrectSyntax.args b/compiler/testData/cli/jvm/hmpp/duplicatedFragments.args similarity index 85% rename from compiler/testData/cli/jvm/hmpp/moduleIncorrectSyntax.args rename to compiler/testData/cli/jvm/hmpp/duplicatedFragments.args index a203d933aa0..4fce009b696 100644 --- a/compiler/testData/cli/jvm/hmpp/moduleIncorrectSyntax.args +++ b/compiler/testData/cli/jvm/hmpp/duplicatedFragments.args @@ -5,4 +5,4 @@ $TEMP_DIR$ -language-version 2.0 -XXLanguage\:+MultiPlatformProjects --Xmodule=a;a.kt;b.kt +-Xfragments=a,a diff --git a/compiler/testData/cli/jvm/hmpp/moduleIncorrectSyntax.out b/compiler/testData/cli/jvm/hmpp/duplicatedFragments.out similarity index 81% rename from compiler/testData/cli/jvm/hmpp/moduleIncorrectSyntax.out rename to compiler/testData/cli/jvm/hmpp/duplicatedFragments.out index c928c8e893a..013e3ae12c6 100644 --- a/compiler/testData/cli/jvm/hmpp/moduleIncorrectSyntax.out +++ b/compiler/testData/cli/jvm/hmpp/duplicatedFragments.out @@ -8,7 +8,6 @@ as no stability/compatibility guarantees are given on compiler or generated code. Use it at your own risk! warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features -error: incorrect syntax for -Xmodule argument. `;` expected but got `a;a.kt;b.kt` error: source '$TESTDATA_DIR$/src/a.kt' does not belong to any module error: source '$TESTDATA_DIR$/src/b.kt' does not belong to any module COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/hmpp/duplicatedModules.args b/compiler/testData/cli/jvm/hmpp/duplicatedModules.args deleted file mode 100644 index b8a69ec9e11..00000000000 --- a/compiler/testData/cli/jvm/hmpp/duplicatedModules.args +++ /dev/null @@ -1,10 +0,0 @@ -$TESTDATA_DIR$/src/a.kt -$TESTDATA_DIR$/src/b.kt --d -$TEMP_DIR$ --language-version -2.0 --XXLanguage\:+MultiPlatformProjects --Xmodule=a;$TESTDATA_DIR$/src/a.kt --Xmodule=b;$TESTDATA_DIR$/src/b.kt --Xmodule=a;$TESTDATA_DIR$/src/c.kt diff --git a/compiler/testData/cli/jvm/hmpp/sourceNotInAnyModule.args b/compiler/testData/cli/jvm/hmpp/fragmentSourcesIncorrectSyntax.args similarity index 72% rename from compiler/testData/cli/jvm/hmpp/sourceNotInAnyModule.args rename to compiler/testData/cli/jvm/hmpp/fragmentSourcesIncorrectSyntax.args index f2c1a302fa3..230cbbd9fd3 100644 --- a/compiler/testData/cli/jvm/hmpp/sourceNotInAnyModule.args +++ b/compiler/testData/cli/jvm/hmpp/fragmentSourcesIncorrectSyntax.args @@ -5,4 +5,5 @@ $TEMP_DIR$ -language-version 2.0 -XXLanguage\:+MultiPlatformProjects --Xmodule=a;$TESTDATA_DIR$/src/a.kt +-Xfragments=a,b,c +-Xfragment-sources=a;a.kt; diff --git a/compiler/testData/cli/jvm/hmpp/fragmentSourcesIncorrectSyntax.out b/compiler/testData/cli/jvm/hmpp/fragmentSourcesIncorrectSyntax.out new file mode 100644 index 00000000000..5259245ab71 --- /dev/null +++ b/compiler/testData/cli/jvm/hmpp/fragmentSourcesIncorrectSyntax.out @@ -0,0 +1,14 @@ +warning: ATTENTION! +This build uses unsafe internal compiler arguments: + +-XXLanguage:+MultiPlatformProjects + +This mode is not recommended for production use, +as no stability/compatibility guarantees are given on +compiler or generated code. Use it at your own risk! + +warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features +error: incorrect syntax for -Xfragment-sources argument. `;` expected but got `a;a.kt;` +error: source '$TESTDATA_DIR$/src/a.kt' does not belong to any module +error: source '$TESTDATA_DIR$/src/b.kt' does not belong to any module +COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/hmpp/moduleWithoutSources.args b/compiler/testData/cli/jvm/hmpp/fragmentWithoutSources.args similarity index 80% rename from compiler/testData/cli/jvm/hmpp/moduleWithoutSources.args rename to compiler/testData/cli/jvm/hmpp/fragmentWithoutSources.args index a0d02b5db0f..0dc144202fd 100644 --- a/compiler/testData/cli/jvm/hmpp/moduleWithoutSources.args +++ b/compiler/testData/cli/jvm/hmpp/fragmentWithoutSources.args @@ -4,5 +4,4 @@ $TEMP_DIR$ -language-version 2.0 -XXLanguage\:+MultiPlatformProjects --Xmodule=a --Xmodule=b; +-Xfragments=a,b diff --git a/compiler/testData/cli/jvm/hmpp/moduleWithoutSources.out b/compiler/testData/cli/jvm/hmpp/fragmentWithoutSources.out similarity index 100% rename from compiler/testData/cli/jvm/hmpp/moduleWithoutSources.out rename to compiler/testData/cli/jvm/hmpp/fragmentWithoutSources.out diff --git a/compiler/testData/cli/jvm/hmpp/lowLanguageVersion.args b/compiler/testData/cli/jvm/hmpp/lowLanguageVersion.args index 8b2c3120fc8..55a13220685 100644 --- a/compiler/testData/cli/jvm/hmpp/lowLanguageVersion.args +++ b/compiler/testData/cli/jvm/hmpp/lowLanguageVersion.args @@ -6,6 +6,5 @@ $TEMP_DIR$ -language-version 1.9 -XXLanguage\:+MultiPlatformProjects --Xmodule=a;$TESTDATA_DIR$/src/a.kt --Xmodule=b;$TESTDATA_DIR$/src/b.kt,$TESTDATA_DIR$/src/c.kt +-Xfragments=a,b,c -Xcommon-sources=$TESTDATA_DIR$/src/a.kt,$TESTDATA_DIR$/src/b.kt diff --git a/compiler/testData/cli/jvm/hmpp/lowLanguageVersion.out b/compiler/testData/cli/jvm/hmpp/lowLanguageVersion.out index 44bbb9e0c72..b0896917c8e 100644 --- a/compiler/testData/cli/jvm/hmpp/lowLanguageVersion.out +++ b/compiler/testData/cli/jvm/hmpp/lowLanguageVersion.out @@ -7,5 +7,5 @@ This mode is not recommended for production use, as no stability/compatibility guarantees are given on compiler or generated code. Use it at your own risk! -warning: -Xmodule flag is not supported for language version < 2.0 +warning: -Xfragments flag is not supported for language version < 2.0 OK diff --git a/compiler/testData/cli/jvm/hmpp/missingModule.args b/compiler/testData/cli/jvm/hmpp/missingFragment.args similarity index 61% rename from compiler/testData/cli/jvm/hmpp/missingModule.args rename to compiler/testData/cli/jvm/hmpp/missingFragment.args index 1fadb859f92..06e701b4a68 100644 --- a/compiler/testData/cli/jvm/hmpp/missingModule.args +++ b/compiler/testData/cli/jvm/hmpp/missingFragment.args @@ -5,6 +5,6 @@ $TEMP_DIR$ -language-version 2.0 -XXLanguage\:+MultiPlatformProjects --Xmodule=a;$TESTDATA_DIR$/src/a.kt --Xmodule=b;$TESTDATA_DIR$/src/b.kt +-Xfragments=a,b +-Xfragment-sources=a;$TESTDATA_DIR$/src/a.kt,b;$TESTDATA_DIR$/src/b.kt -Xdepends-on=c\:a diff --git a/compiler/testData/cli/jvm/hmpp/missingModule.out b/compiler/testData/cli/jvm/hmpp/missingFragment.out similarity index 88% rename from compiler/testData/cli/jvm/hmpp/missingModule.out rename to compiler/testData/cli/jvm/hmpp/missingFragment.out index ca747003f6f..5d25de3b052 100644 --- a/compiler/testData/cli/jvm/hmpp/missingModule.out +++ b/compiler/testData/cli/jvm/hmpp/missingFragment.out @@ -8,5 +8,5 @@ as no stability/compatibility guarantees are given on compiler or generated code. Use it at your own risk! warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features -error: module `c` not found in -Xmodule arguments +error: module `c` not found in -Xfragments arguments COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/hmpp/sameSourceInDifferentFragments.args b/compiler/testData/cli/jvm/hmpp/sameSourceInDifferentFragments.args new file mode 100644 index 00000000000..fc149111a39 --- /dev/null +++ b/compiler/testData/cli/jvm/hmpp/sameSourceInDifferentFragments.args @@ -0,0 +1,11 @@ +$TESTDATA_DIR$/src/a.kt +$TESTDATA_DIR$/src/b.kt +-d +$TEMP_DIR$ +-language-version +2.0 +-XXLanguage\:+MultiPlatformProjects +-Xfragments=a,b +-Xfragment-sources=a;$TESTDATA_DIR$/src/a.kt +-Xfragment-sources=b;$TESTDATA_DIR$/src/a.kt +-Xfragment-sources=b;$TESTDATA_DIR$/src/b.kt diff --git a/compiler/testData/cli/jvm/hmpp/sameSourceInDifferentModules.out b/compiler/testData/cli/jvm/hmpp/sameSourceInDifferentFragments.out similarity index 84% rename from compiler/testData/cli/jvm/hmpp/sameSourceInDifferentModules.out rename to compiler/testData/cli/jvm/hmpp/sameSourceInDifferentFragments.out index 86feec929de..42ef08d4992 100644 --- a/compiler/testData/cli/jvm/hmpp/sameSourceInDifferentModules.out +++ b/compiler/testData/cli/jvm/hmpp/sameSourceInDifferentFragments.out @@ -8,6 +8,5 @@ as no stability/compatibility guarantees are given on compiler or generated code. Use it at your own risk! warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features -error: file '$TESTDATA_DIR$/src/a.kt' can be a part of only one module, but is listed as a source for both `a` and `b`, please check you -Xmodule options. -error: source '$TESTDATA_DIR$/src/b.kt' does not belong to any module +error: file '$TESTDATA_DIR$/src/a.kt' can be a part of only one module, but is listed as a source for both `a` and `b`, please check you -Xfragment-sources options. COMPILATION_ERROR diff --git a/compiler/testData/cli/jvm/hmpp/sameSourceInDifferentModules.args b/compiler/testData/cli/jvm/hmpp/sourceNotInAnyFragment.args similarity index 63% rename from compiler/testData/cli/jvm/hmpp/sameSourceInDifferentModules.args rename to compiler/testData/cli/jvm/hmpp/sourceNotInAnyFragment.args index fbbf735173b..9d04980e06f 100644 --- a/compiler/testData/cli/jvm/hmpp/sameSourceInDifferentModules.args +++ b/compiler/testData/cli/jvm/hmpp/sourceNotInAnyFragment.args @@ -5,5 +5,5 @@ $TEMP_DIR$ -language-version 2.0 -XXLanguage\:+MultiPlatformProjects --Xmodule=a;$TESTDATA_DIR$/src/a.kt --Xmodule=b;$TESTDATA_DIR$/src/a.kt +-Xfragments=a,b +-Xfragment-sources=a;$TESTDATA_DIR$/src/a.kt diff --git a/compiler/testData/cli/jvm/hmpp/sourceNotInAnyModule.out b/compiler/testData/cli/jvm/hmpp/sourceNotInAnyFragment.out similarity index 100% rename from compiler/testData/cli/jvm/hmpp/sourceNotInAnyModule.out rename to compiler/testData/cli/jvm/hmpp/sourceNotInAnyFragment.out diff --git a/compiler/testData/cli/jvm/hmpp/successfulCompilation.args b/compiler/testData/cli/jvm/hmpp/successfulCompilation.args index 8ce9cac14e2..2c04cc08a55 100644 --- a/compiler/testData/cli/jvm/hmpp/successfulCompilation.args +++ b/compiler/testData/cli/jvm/hmpp/successfulCompilation.args @@ -6,8 +6,11 @@ $TEMP_DIR$ -language-version 2.0 -XXLanguage\:+MultiPlatformProjects --Xmodule=a;$TESTDATA_DIR$/src/a.kt --Xmodule=b;$TESTDATA_DIR$/src/b.kt --Xmodule=c;$TESTDATA_DIR$/src/c.kt +-Xfragments=a +-Xfragments=b +-Xfragments=c +-Xfragment-sources=a;$TESTDATA_DIR$/src/a.kt +-Xfragment-sources=b;$TESTDATA_DIR$/src/b.kt +-Xfragment-sources=c;$TESTDATA_DIR$/src/c.kt -Xdepends-on=b\:a -Xdepends-on=c\:b diff --git a/compiler/testData/cli/jvm/hmpp/successfulCompilation2.args b/compiler/testData/cli/jvm/hmpp/successfulCompilation2.args new file mode 100644 index 00000000000..a276514f70e --- /dev/null +++ b/compiler/testData/cli/jvm/hmpp/successfulCompilation2.args @@ -0,0 +1,11 @@ +$TESTDATA_DIR$/src/a.kt +$TESTDATA_DIR$/src/b.kt +$TESTDATA_DIR$/src/c.kt +-d +$TEMP_DIR$ +-language-version +2.0 +-XXLanguage\:+MultiPlatformProjects +-Xfragments=a,b,c +-Xfragment-sources=a;$TESTDATA_DIR$/src/a.kt,b;$TESTDATA_DIR$/src/b.kt,c;$TESTDATA_DIR$/src/c.kt +-Xdepends-on=b\:a,c\:b diff --git a/compiler/testData/cli/jvm/hmpp/successfulCompilation2.out b/compiler/testData/cli/jvm/hmpp/successfulCompilation2.out new file mode 100644 index 00000000000..0afdba6a4b9 --- /dev/null +++ b/compiler/testData/cli/jvm/hmpp/successfulCompilation2.out @@ -0,0 +1,11 @@ +warning: ATTENTION! +This build uses unsafe internal compiler arguments: + +-XXLanguage:+MultiPlatformProjects + +This mode is not recommended for production use, +as no stability/compatibility guarantees are given on +compiler or generated code. Use it at your own risk! + +warning: language version 2.0 is experimental, there are no backwards compatibility guarantees for new language and library features +OK diff --git a/compiler/testData/cli/metadata/successfulHmpp.args b/compiler/testData/cli/metadata/successfulHmpp.args index 119a8de1afe..c5b82f4813a 100644 --- a/compiler/testData/cli/metadata/successfulHmpp.args +++ b/compiler/testData/cli/metadata/successfulHmpp.args @@ -6,8 +6,9 @@ $TEMP_DIR$ -language-version 2.0 -XXLanguage\:+MultiPlatformProjects --Xmodule=a;$TESTDATA_DIR$/../jvm/hmpp/src/a.kt --Xmodule=b;$TESTDATA_DIR$/../jvm/hmpp/src/b.kt --Xmodule=c;$TESTDATA_DIR$/../jvm/hmpp/src/c.kt +-Xfragments=a,b,c +-Xfragment-sources=a;$TESTDATA_DIR$/../jvm/hmpp/src/a.kt +-Xfragment-sources=b;$TESTDATA_DIR$/../jvm/hmpp/src/b.kt +-Xfragment-sources=c;$TESTDATA_DIR$/../jvm/hmpp/src/c.kt -Xdepends-on=b\:a -Xdepends-on=c\:b diff --git a/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java b/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java index 8d56689db2c..92d98ed2a09 100644 --- a/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java +++ b/compiler/tests-gen/org/jetbrains/kotlin/cli/CliTestGenerated.java @@ -127,14 +127,24 @@ public class CliTestGenerated extends AbstractCliTest { runTest("compiler/testData/cli/jvm/hmpp/dependsOnSingleModule.args"); } - @TestMetadata("dependsOnWithoutModules.args") - public void testDependsOnWithoutModules() throws Exception { - runTest("compiler/testData/cli/jvm/hmpp/dependsOnWithoutModules.args"); + @TestMetadata("dependsOnWithoutFragments.args") + public void testDependsOnWithoutFragments() throws Exception { + runTest("compiler/testData/cli/jvm/hmpp/dependsOnWithoutFragments.args"); } - @TestMetadata("duplicatedModules.args") - public void testDuplicatedModules() throws Exception { - runTest("compiler/testData/cli/jvm/hmpp/duplicatedModules.args"); + @TestMetadata("duplicatedFragments.args") + public void testDuplicatedFragments() throws Exception { + runTest("compiler/testData/cli/jvm/hmpp/duplicatedFragments.args"); + } + + @TestMetadata("fragmentSourcesIncorrectSyntax.args") + public void testFragmentSourcesIncorrectSyntax() throws Exception { + runTest("compiler/testData/cli/jvm/hmpp/fragmentSourcesIncorrectSyntax.args"); + } + + @TestMetadata("fragmentWithoutSources.args") + public void testFragmentWithoutSources() throws Exception { + runTest("compiler/testData/cli/jvm/hmpp/fragmentWithoutSources.args"); } @TestMetadata("lowLanguageVersion.args") @@ -142,35 +152,30 @@ public class CliTestGenerated extends AbstractCliTest { runTest("compiler/testData/cli/jvm/hmpp/lowLanguageVersion.args"); } - @TestMetadata("missingModule.args") - public void testMissingModule() throws Exception { - runTest("compiler/testData/cli/jvm/hmpp/missingModule.args"); + @TestMetadata("missingFragment.args") + public void testMissingFragment() throws Exception { + runTest("compiler/testData/cli/jvm/hmpp/missingFragment.args"); } - @TestMetadata("moduleIncorrectSyntax.args") - public void testModuleIncorrectSyntax() throws Exception { - runTest("compiler/testData/cli/jvm/hmpp/moduleIncorrectSyntax.args"); + @TestMetadata("sameSourceInDifferentFragments.args") + public void testSameSourceInDifferentFragments() throws Exception { + runTest("compiler/testData/cli/jvm/hmpp/sameSourceInDifferentFragments.args"); } - @TestMetadata("moduleWithoutSources.args") - public void testModuleWithoutSources() throws Exception { - runTest("compiler/testData/cli/jvm/hmpp/moduleWithoutSources.args"); - } - - @TestMetadata("sameSourceInDifferentModules.args") - public void testSameSourceInDifferentModules() throws Exception { - runTest("compiler/testData/cli/jvm/hmpp/sameSourceInDifferentModules.args"); - } - - @TestMetadata("sourceNotInAnyModule.args") - public void testSourceNotInAnyModule() throws Exception { - runTest("compiler/testData/cli/jvm/hmpp/sourceNotInAnyModule.args"); + @TestMetadata("sourceNotInAnyFragment.args") + public void testSourceNotInAnyFragment() throws Exception { + runTest("compiler/testData/cli/jvm/hmpp/sourceNotInAnyFragment.args"); } @TestMetadata("successfulCompilation.args") public void testSuccessfulCompilation() throws Exception { runTest("compiler/testData/cli/jvm/hmpp/successfulCompilation.args"); } + + @TestMetadata("successfulCompilation2.args") + public void testSuccessfulCompilation2() throws Exception { + runTest("compiler/testData/cli/jvm/hmpp/successfulCompilation2.args"); + } } @TestMetadata("compiler/testData/cli/jvm")